diff --git a/apis/accessanalyzer/v1beta1/zz_analyzer_terraformed.go b/apis/accessanalyzer/v1beta1/zz_analyzer_terraformed.go new file mode 100755 index 0000000000..acf59ca54b --- /dev/null +++ b/apis/accessanalyzer/v1beta1/zz_analyzer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Analyzer +func (mg *Analyzer) GetTerraformResourceType() string { + return "aws_accessanalyzer_analyzer" +} + +// GetConnectionDetailsMapping for this Analyzer +func (tr *Analyzer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Analyzer +func (tr *Analyzer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Analyzer +func (tr *Analyzer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Analyzer +func (tr *Analyzer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Analyzer +func (tr *Analyzer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Analyzer +func (tr *Analyzer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Analyzer +func (tr *Analyzer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Analyzer +func (tr *Analyzer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Analyzer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Analyzer) LateInitialize(attrs []byte) (bool, error) { + params := &AnalyzerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Analyzer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/accessanalyzer/v1beta1/zz_analyzer_types.go b/apis/accessanalyzer/v1beta1/zz_analyzer_types.go index 3c6a34c738..4701e524ec 100755 --- a/apis/accessanalyzer/v1beta1/zz_analyzer_types.go +++ b/apis/accessanalyzer/v1beta1/zz_analyzer_types.go @@ -88,13 +88,14 @@ type AnalyzerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Analyzer is the Schema for the Analyzers API. Manages an Access Analyzer Analyzer // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Analyzer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/accessanalyzer/v1beta1/zz_generated_terraformed.go b/apis/accessanalyzer/v1beta1/zz_archiverule_terraformed.go similarity index 52% rename from apis/accessanalyzer/v1beta1/zz_generated_terraformed.go rename to apis/accessanalyzer/v1beta1/zz_archiverule_terraformed.go index 0721f39a05..dd67f64bee 100755 --- a/apis/accessanalyzer/v1beta1/zz_generated_terraformed.go +++ b/apis/accessanalyzer/v1beta1/zz_archiverule_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Analyzer -func (mg *Analyzer) GetTerraformResourceType() string { - return "aws_accessanalyzer_analyzer" -} - -// GetConnectionDetailsMapping for this Analyzer -func (tr *Analyzer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Analyzer -func (tr *Analyzer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Analyzer -func (tr *Analyzer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Analyzer -func (tr *Analyzer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Analyzer -func (tr *Analyzer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Analyzer -func (tr *Analyzer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Analyzer -func (tr *Analyzer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Analyzer -func (tr *Analyzer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Analyzer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Analyzer) LateInitialize(attrs []byte) (bool, error) { - params := &AnalyzerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Analyzer) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this ArchiveRule func (mg *ArchiveRule) GetTerraformResourceType() string { return "aws_accessanalyzer_archive_rule" diff --git a/apis/accessanalyzer/v1beta1/zz_archiverule_types.go b/apis/accessanalyzer/v1beta1/zz_archiverule_types.go index 9c999f27df..53dfd3c5a6 100755 --- a/apis/accessanalyzer/v1beta1/zz_archiverule_types.go +++ b/apis/accessanalyzer/v1beta1/zz_archiverule_types.go @@ -134,13 +134,14 @@ type ArchiveRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ArchiveRule is the Schema for the ArchiveRules API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ArchiveRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/accessanalyzer/v1beta1/zz_generated.conversion_hubs.go b/apis/accessanalyzer/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..a49c6adae2 --- /dev/null +++ b/apis/accessanalyzer/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Analyzer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ArchiveRule) Hub() {} diff --git a/apis/account/v1beta1/zz_generated_terraformed.go b/apis/account/v1beta1/zz_alternatecontact_terraformed.go similarity index 100% rename from apis/account/v1beta1/zz_generated_terraformed.go rename to apis/account/v1beta1/zz_alternatecontact_terraformed.go diff --git a/apis/account/v1beta1/zz_alternatecontact_types.go b/apis/account/v1beta1/zz_alternatecontact_types.go index 3a65c881c0..04e8dc8b95 100755 --- a/apis/account/v1beta1/zz_alternatecontact_types.go +++ b/apis/account/v1beta1/zz_alternatecontact_types.go @@ -114,13 +114,14 @@ type AlternateContactStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AlternateContact is the Schema for the AlternateContacts API. Manages the specified alternate contact attached to an AWS Account. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AlternateContact struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/account/v1beta1/zz_generated.conversion_hubs.go b/apis/account/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..dbf68c723a --- /dev/null +++ b/apis/account/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AlternateContact) Hub() {} diff --git a/apis/acm/v1beta1/zz_generated_terraformed.go b/apis/acm/v1beta1/zz_certificate_terraformed.go similarity index 53% rename from apis/acm/v1beta1/zz_generated_terraformed.go rename to apis/acm/v1beta1/zz_certificate_terraformed.go index 254167516e..2bc6603521 100755 --- a/apis/acm/v1beta1/zz_generated_terraformed.go +++ b/apis/acm/v1beta1/zz_certificate_terraformed.go @@ -136,117 +136,3 @@ func (tr *Certificate) LateInitialize(attrs []byte) (bool, error) { func (tr *Certificate) GetTerraformSchemaVersion() int { return 0 } - -// GetTerraformResourceType returns Terraform resource type for this CertificateValidation -func (mg *CertificateValidation) GetTerraformResourceType() string { - return "aws_acm_certificate_validation" -} - -// GetConnectionDetailsMapping for this CertificateValidation -func (tr *CertificateValidation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CertificateValidation -func (tr *CertificateValidation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CertificateValidation -func (tr *CertificateValidation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CertificateValidation -func (tr *CertificateValidation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CertificateValidation -func (tr *CertificateValidation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CertificateValidation -func (tr *CertificateValidation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CertificateValidation -func (tr *CertificateValidation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CertificateValidation -func (tr *CertificateValidation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CertificateValidation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CertificateValidation) LateInitialize(attrs []byte) (bool, error) { - params := &CertificateValidationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CertificateValidation) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/acm/v1beta1/zz_certificate_types.go b/apis/acm/v1beta1/zz_certificate_types.go index e820b99f53..0dc70e3a76 100755 --- a/apis/acm/v1beta1/zz_certificate_types.go +++ b/apis/acm/v1beta1/zz_certificate_types.go @@ -312,13 +312,14 @@ type CertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Certificate is the Schema for the Certificates API. Requests and manages a certificate from Amazon Certificate Manager (ACM). // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Certificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/acm/v1beta1/zz_certificatevalidation_terraformed.go b/apis/acm/v1beta1/zz_certificatevalidation_terraformed.go new file mode 100755 index 0000000000..80d5b033e6 --- /dev/null +++ b/apis/acm/v1beta1/zz_certificatevalidation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CertificateValidation +func (mg *CertificateValidation) GetTerraformResourceType() string { + return "aws_acm_certificate_validation" +} + +// GetConnectionDetailsMapping for this CertificateValidation +func (tr *CertificateValidation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CertificateValidation +func (tr *CertificateValidation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CertificateValidation +func (tr *CertificateValidation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CertificateValidation +func (tr *CertificateValidation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CertificateValidation +func (tr *CertificateValidation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CertificateValidation +func (tr *CertificateValidation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CertificateValidation +func (tr *CertificateValidation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CertificateValidation +func (tr *CertificateValidation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CertificateValidation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CertificateValidation) LateInitialize(attrs []byte) (bool, error) { + params := &CertificateValidationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CertificateValidation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/acm/v1beta1/zz_certificatevalidation_types.go b/apis/acm/v1beta1/zz_certificatevalidation_types.go index 96a72d6b38..eecc16dad2 100755 --- a/apis/acm/v1beta1/zz_certificatevalidation_types.go +++ b/apis/acm/v1beta1/zz_certificatevalidation_types.go @@ -99,13 +99,14 @@ type CertificateValidationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CertificateValidation is the Schema for the CertificateValidations API. Waits for and checks successful validation of an ACM certificate. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CertificateValidation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/acm/v1beta1/zz_generated.conversion_hubs.go b/apis/acm/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..1b0ec31108 --- /dev/null +++ b/apis/acm/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Certificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CertificateValidation) Hub() {} diff --git a/apis/acmpca/v1beta1/zz_certificate_terraformed.go b/apis/acmpca/v1beta1/zz_certificate_terraformed.go new file mode 100755 index 0000000000..c0f54bff4a --- /dev/null +++ b/apis/acmpca/v1beta1/zz_certificate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Certificate +func (mg *Certificate) GetTerraformResourceType() string { + return "aws_acmpca_certificate" +} + +// GetConnectionDetailsMapping for this Certificate +func (tr *Certificate) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"certificate_signing_request": "spec.forProvider.certificateSigningRequestSecretRef"} +} + +// GetObservation of this Certificate +func (tr *Certificate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Certificate +func (tr *Certificate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Certificate +func (tr *Certificate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Certificate +func (tr *Certificate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Certificate +func (tr *Certificate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Certificate +func (tr *Certificate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Certificate +func (tr *Certificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Certificate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Certificate) LateInitialize(attrs []byte) (bool, error) { + params := &CertificateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Certificate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/acmpca/v1beta1/zz_certificate_types.go b/apis/acmpca/v1beta1/zz_certificate_types.go index d157144ea8..651449a222 100755 --- a/apis/acmpca/v1beta1/zz_certificate_types.go +++ b/apis/acmpca/v1beta1/zz_certificate_types.go @@ -170,13 +170,14 @@ type CertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Certificate is the Schema for the Certificates API. Provides a resource to issue a certificate using AWS Certificate Manager Private Certificate Authority (ACM PCA) // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Certificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/acmpca/v1beta1/zz_certificateauthority_terraformed.go b/apis/acmpca/v1beta1/zz_certificateauthority_terraformed.go new file mode 100755 index 0000000000..4ddf328cf0 --- /dev/null +++ b/apis/acmpca/v1beta1/zz_certificateauthority_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CertificateAuthority +func (mg *CertificateAuthority) GetTerraformResourceType() string { + return "aws_acmpca_certificate_authority" +} + +// GetConnectionDetailsMapping for this CertificateAuthority +func (tr *CertificateAuthority) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CertificateAuthority +func (tr *CertificateAuthority) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CertificateAuthority +func (tr *CertificateAuthority) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CertificateAuthority +func (tr *CertificateAuthority) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CertificateAuthority +func (tr *CertificateAuthority) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CertificateAuthority +func (tr *CertificateAuthority) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CertificateAuthority +func (tr *CertificateAuthority) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CertificateAuthority +func (tr *CertificateAuthority) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CertificateAuthority using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CertificateAuthority) LateInitialize(attrs []byte) (bool, error) { + params := &CertificateAuthorityParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("RevocationConfiguration")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CertificateAuthority) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/acmpca/v1beta1/zz_certificateauthority_types.go b/apis/acmpca/v1beta1/zz_certificateauthority_types.go index 5912395834..c4dec7ad8d 100755 --- a/apis/acmpca/v1beta1/zz_certificateauthority_types.go +++ b/apis/acmpca/v1beta1/zz_certificateauthority_types.go @@ -467,13 +467,14 @@ type CertificateAuthorityStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CertificateAuthority is the Schema for the CertificateAuthoritys API. Provides a resource to manage AWS Certificate Manager Private Certificate Authorities // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CertificateAuthority struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/acmpca/v1beta1/zz_certificateauthoritycertificate_terraformed.go b/apis/acmpca/v1beta1/zz_certificateauthoritycertificate_terraformed.go new file mode 100755 index 0000000000..9b9f90e3ac --- /dev/null +++ b/apis/acmpca/v1beta1/zz_certificateauthoritycertificate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CertificateAuthorityCertificate +func (mg *CertificateAuthorityCertificate) GetTerraformResourceType() string { + return "aws_acmpca_certificate_authority_certificate" +} + +// GetConnectionDetailsMapping for this CertificateAuthorityCertificate +func (tr *CertificateAuthorityCertificate) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"certificate": "spec.forProvider.certificateSecretRef", "certificate_chain": "spec.forProvider.certificateChainSecretRef"} +} + +// GetObservation of this CertificateAuthorityCertificate +func (tr *CertificateAuthorityCertificate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CertificateAuthorityCertificate +func (tr *CertificateAuthorityCertificate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CertificateAuthorityCertificate +func (tr *CertificateAuthorityCertificate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CertificateAuthorityCertificate +func (tr *CertificateAuthorityCertificate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CertificateAuthorityCertificate +func (tr *CertificateAuthorityCertificate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CertificateAuthorityCertificate +func (tr *CertificateAuthorityCertificate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CertificateAuthorityCertificate +func (tr *CertificateAuthorityCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CertificateAuthorityCertificate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CertificateAuthorityCertificate) LateInitialize(attrs []byte) (bool, error) { + params := &CertificateAuthorityCertificateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CertificateAuthorityCertificate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/acmpca/v1beta1/zz_certificateauthoritycertificate_types.go b/apis/acmpca/v1beta1/zz_certificateauthoritycertificate_types.go index 744a0fc462..5a87fc8773 100755 --- a/apis/acmpca/v1beta1/zz_certificateauthoritycertificate_types.go +++ b/apis/acmpca/v1beta1/zz_certificateauthoritycertificate_types.go @@ -93,13 +93,14 @@ type CertificateAuthorityCertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CertificateAuthorityCertificate is the Schema for the CertificateAuthorityCertificates API. Associates a certificate with an AWS Certificate Manager Private Certificate Authority // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CertificateAuthorityCertificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/acmpca/v1beta1/zz_generated.conversion_hubs.go b/apis/acmpca/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..06983fc7e4 --- /dev/null +++ b/apis/acmpca/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Certificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CertificateAuthority) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CertificateAuthorityCertificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Permission) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Policy) Hub() {} diff --git a/apis/acmpca/v1beta1/zz_generated_terraformed.go b/apis/acmpca/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index e1ae65c109..0000000000 --- a/apis/acmpca/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,590 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Certificate -func (mg *Certificate) GetTerraformResourceType() string { - return "aws_acmpca_certificate" -} - -// GetConnectionDetailsMapping for this Certificate -func (tr *Certificate) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"certificate_signing_request": "spec.forProvider.certificateSigningRequestSecretRef"} -} - -// GetObservation of this Certificate -func (tr *Certificate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Certificate -func (tr *Certificate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Certificate -func (tr *Certificate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Certificate -func (tr *Certificate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Certificate -func (tr *Certificate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Certificate -func (tr *Certificate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Certificate -func (tr *Certificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Certificate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Certificate) LateInitialize(attrs []byte) (bool, error) { - params := &CertificateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Certificate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CertificateAuthority -func (mg *CertificateAuthority) GetTerraformResourceType() string { - return "aws_acmpca_certificate_authority" -} - -// GetConnectionDetailsMapping for this CertificateAuthority -func (tr *CertificateAuthority) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CertificateAuthority -func (tr *CertificateAuthority) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CertificateAuthority -func (tr *CertificateAuthority) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CertificateAuthority -func (tr *CertificateAuthority) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CertificateAuthority -func (tr *CertificateAuthority) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CertificateAuthority -func (tr *CertificateAuthority) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CertificateAuthority -func (tr *CertificateAuthority) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CertificateAuthority -func (tr *CertificateAuthority) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CertificateAuthority using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CertificateAuthority) LateInitialize(attrs []byte) (bool, error) { - params := &CertificateAuthorityParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("RevocationConfiguration")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CertificateAuthority) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this CertificateAuthorityCertificate -func (mg *CertificateAuthorityCertificate) GetTerraformResourceType() string { - return "aws_acmpca_certificate_authority_certificate" -} - -// GetConnectionDetailsMapping for this CertificateAuthorityCertificate -func (tr *CertificateAuthorityCertificate) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"certificate": "spec.forProvider.certificateSecretRef", "certificate_chain": "spec.forProvider.certificateChainSecretRef"} -} - -// GetObservation of this CertificateAuthorityCertificate -func (tr *CertificateAuthorityCertificate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CertificateAuthorityCertificate -func (tr *CertificateAuthorityCertificate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CertificateAuthorityCertificate -func (tr *CertificateAuthorityCertificate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CertificateAuthorityCertificate -func (tr *CertificateAuthorityCertificate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CertificateAuthorityCertificate -func (tr *CertificateAuthorityCertificate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CertificateAuthorityCertificate -func (tr *CertificateAuthorityCertificate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CertificateAuthorityCertificate -func (tr *CertificateAuthorityCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CertificateAuthorityCertificate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CertificateAuthorityCertificate) LateInitialize(attrs []byte) (bool, error) { - params := &CertificateAuthorityCertificateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CertificateAuthorityCertificate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Permission -func (mg *Permission) GetTerraformResourceType() string { - return "aws_acmpca_permission" -} - -// GetConnectionDetailsMapping for this Permission -func (tr *Permission) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Permission -func (tr *Permission) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Permission -func (tr *Permission) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Permission -func (tr *Permission) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Permission -func (tr *Permission) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Permission -func (tr *Permission) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Permission -func (tr *Permission) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Permission -func (tr *Permission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Permission using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Permission) LateInitialize(attrs []byte) (bool, error) { - params := &PermissionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Permission) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Policy -func (mg *Policy) GetTerraformResourceType() string { - return "aws_acmpca_policy" -} - -// GetConnectionDetailsMapping for this Policy -func (tr *Policy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Policy -func (tr *Policy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Policy -func (tr *Policy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Policy -func (tr *Policy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Policy -func (tr *Policy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Policy -func (tr *Policy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Policy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { - params := &PolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Policy) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/acmpca/v1beta1/zz_permission_terraformed.go b/apis/acmpca/v1beta1/zz_permission_terraformed.go new file mode 100755 index 0000000000..a3371aeabb --- /dev/null +++ b/apis/acmpca/v1beta1/zz_permission_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Permission +func (mg *Permission) GetTerraformResourceType() string { + return "aws_acmpca_permission" +} + +// GetConnectionDetailsMapping for this Permission +func (tr *Permission) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Permission +func (tr *Permission) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Permission +func (tr *Permission) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Permission +func (tr *Permission) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Permission +func (tr *Permission) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Permission +func (tr *Permission) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Permission +func (tr *Permission) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Permission +func (tr *Permission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Permission using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Permission) LateInitialize(attrs []byte) (bool, error) { + params := &PermissionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Permission) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/acmpca/v1beta1/zz_permission_types.go b/apis/acmpca/v1beta1/zz_permission_types.go index bd60670862..15c05c3bf1 100755 --- a/apis/acmpca/v1beta1/zz_permission_types.go +++ b/apis/acmpca/v1beta1/zz_permission_types.go @@ -123,13 +123,14 @@ type PermissionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Permission is the Schema for the Permissions API. Provides a resource to manage an AWS Certificate Manager Private Certificate Authorities Permission // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Permission struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/acmpca/v1beta1/zz_policy_terraformed.go b/apis/acmpca/v1beta1/zz_policy_terraformed.go new file mode 100755 index 0000000000..8bc7ad28cd --- /dev/null +++ b/apis/acmpca/v1beta1/zz_policy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Policy +func (mg *Policy) GetTerraformResourceType() string { + return "aws_acmpca_policy" +} + +// GetConnectionDetailsMapping for this Policy +func (tr *Policy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Policy +func (tr *Policy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Policy +func (tr *Policy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Policy +func (tr *Policy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Policy +func (tr *Policy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Policy +func (tr *Policy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Policy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { + params := &PolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Policy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/acmpca/v1beta1/zz_policy_types.go b/apis/acmpca/v1beta1/zz_policy_types.go index 416145c7d3..44c1e0b1d3 100755 --- a/apis/acmpca/v1beta1/zz_policy_types.go +++ b/apis/acmpca/v1beta1/zz_policy_types.go @@ -96,13 +96,14 @@ type PolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Policy is the Schema for the Policys API. Attaches a resource based policy to an AWS Certificate Manager Private Certificate Authority (ACM PCA) // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Policy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/amp/v1beta1/zz_alertmanagerdefinition_terraformed.go b/apis/amp/v1beta1/zz_alertmanagerdefinition_terraformed.go new file mode 100755 index 0000000000..e697065e36 --- /dev/null +++ b/apis/amp/v1beta1/zz_alertmanagerdefinition_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AlertManagerDefinition +func (mg *AlertManagerDefinition) GetTerraformResourceType() string { + return "aws_prometheus_alert_manager_definition" +} + +// GetConnectionDetailsMapping for this AlertManagerDefinition +func (tr *AlertManagerDefinition) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AlertManagerDefinition +func (tr *AlertManagerDefinition) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AlertManagerDefinition +func (tr *AlertManagerDefinition) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AlertManagerDefinition +func (tr *AlertManagerDefinition) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AlertManagerDefinition +func (tr *AlertManagerDefinition) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AlertManagerDefinition +func (tr *AlertManagerDefinition) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AlertManagerDefinition +func (tr *AlertManagerDefinition) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AlertManagerDefinition +func (tr *AlertManagerDefinition) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AlertManagerDefinition using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AlertManagerDefinition) LateInitialize(attrs []byte) (bool, error) { + params := &AlertManagerDefinitionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AlertManagerDefinition) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/amp/v1beta1/zz_alertmanagerdefinition_types.go b/apis/amp/v1beta1/zz_alertmanagerdefinition_types.go index d8d0f56e06..325ac9ab58 100755 --- a/apis/amp/v1beta1/zz_alertmanagerdefinition_types.go +++ b/apis/amp/v1beta1/zz_alertmanagerdefinition_types.go @@ -97,13 +97,14 @@ type AlertManagerDefinitionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AlertManagerDefinition is the Schema for the AlertManagerDefinitions API. Manages an Amazon Managed Service for Prometheus (AMP) Alert Manager Definition // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AlertManagerDefinition struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/amp/v1beta1/zz_generated.conversion_hubs.go b/apis/amp/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..365baf2c2b --- /dev/null +++ b/apis/amp/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AlertManagerDefinition) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RuleGroupNamespace) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Workspace) Hub() {} diff --git a/apis/amp/v1beta1/zz_generated_terraformed.go b/apis/amp/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index b372d53a1d..0000000000 --- a/apis/amp/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AlertManagerDefinition -func (mg *AlertManagerDefinition) GetTerraformResourceType() string { - return "aws_prometheus_alert_manager_definition" -} - -// GetConnectionDetailsMapping for this AlertManagerDefinition -func (tr *AlertManagerDefinition) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AlertManagerDefinition -func (tr *AlertManagerDefinition) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AlertManagerDefinition -func (tr *AlertManagerDefinition) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AlertManagerDefinition -func (tr *AlertManagerDefinition) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AlertManagerDefinition -func (tr *AlertManagerDefinition) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AlertManagerDefinition -func (tr *AlertManagerDefinition) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AlertManagerDefinition -func (tr *AlertManagerDefinition) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AlertManagerDefinition -func (tr *AlertManagerDefinition) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AlertManagerDefinition using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AlertManagerDefinition) LateInitialize(attrs []byte) (bool, error) { - params := &AlertManagerDefinitionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AlertManagerDefinition) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RuleGroupNamespace -func (mg *RuleGroupNamespace) GetTerraformResourceType() string { - return "aws_prometheus_rule_group_namespace" -} - -// GetConnectionDetailsMapping for this RuleGroupNamespace -func (tr *RuleGroupNamespace) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RuleGroupNamespace -func (tr *RuleGroupNamespace) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RuleGroupNamespace -func (tr *RuleGroupNamespace) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RuleGroupNamespace -func (tr *RuleGroupNamespace) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RuleGroupNamespace -func (tr *RuleGroupNamespace) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RuleGroupNamespace -func (tr *RuleGroupNamespace) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RuleGroupNamespace -func (tr *RuleGroupNamespace) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RuleGroupNamespace -func (tr *RuleGroupNamespace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RuleGroupNamespace using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RuleGroupNamespace) LateInitialize(attrs []byte) (bool, error) { - params := &RuleGroupNamespaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RuleGroupNamespace) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Workspace -func (mg *Workspace) GetTerraformResourceType() string { - return "aws_prometheus_workspace" -} - -// GetConnectionDetailsMapping for this Workspace -func (tr *Workspace) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Workspace -func (tr *Workspace) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Workspace -func (tr *Workspace) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Workspace -func (tr *Workspace) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Workspace -func (tr *Workspace) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Workspace -func (tr *Workspace) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Workspace -func (tr *Workspace) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Workspace -func (tr *Workspace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Workspace using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Workspace) LateInitialize(attrs []byte) (bool, error) { - params := &WorkspaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Workspace) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/amp/v1beta1/zz_rulegroupnamespace_terraformed.go b/apis/amp/v1beta1/zz_rulegroupnamespace_terraformed.go new file mode 100755 index 0000000000..2770ee5127 --- /dev/null +++ b/apis/amp/v1beta1/zz_rulegroupnamespace_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RuleGroupNamespace +func (mg *RuleGroupNamespace) GetTerraformResourceType() string { + return "aws_prometheus_rule_group_namespace" +} + +// GetConnectionDetailsMapping for this RuleGroupNamespace +func (tr *RuleGroupNamespace) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RuleGroupNamespace +func (tr *RuleGroupNamespace) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RuleGroupNamespace +func (tr *RuleGroupNamespace) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RuleGroupNamespace +func (tr *RuleGroupNamespace) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RuleGroupNamespace +func (tr *RuleGroupNamespace) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RuleGroupNamespace +func (tr *RuleGroupNamespace) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RuleGroupNamespace +func (tr *RuleGroupNamespace) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RuleGroupNamespace +func (tr *RuleGroupNamespace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RuleGroupNamespace using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RuleGroupNamespace) LateInitialize(attrs []byte) (bool, error) { + params := &RuleGroupNamespaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RuleGroupNamespace) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/amp/v1beta1/zz_rulegroupnamespace_types.go b/apis/amp/v1beta1/zz_rulegroupnamespace_types.go index 80b2c7d72e..5cc6705f06 100755 --- a/apis/amp/v1beta1/zz_rulegroupnamespace_types.go +++ b/apis/amp/v1beta1/zz_rulegroupnamespace_types.go @@ -84,13 +84,14 @@ type RuleGroupNamespaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RuleGroupNamespace is the Schema for the RuleGroupNamespaces API. Manages an Amazon Managed Service for Prometheus (AMP) Rule Group Namespace // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RuleGroupNamespace struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/amp/v1beta1/zz_workspace_terraformed.go b/apis/amp/v1beta1/zz_workspace_terraformed.go new file mode 100755 index 0000000000..3077726c35 --- /dev/null +++ b/apis/amp/v1beta1/zz_workspace_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Workspace +func (mg *Workspace) GetTerraformResourceType() string { + return "aws_prometheus_workspace" +} + +// GetConnectionDetailsMapping for this Workspace +func (tr *Workspace) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Workspace +func (tr *Workspace) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Workspace +func (tr *Workspace) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Workspace +func (tr *Workspace) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Workspace +func (tr *Workspace) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Workspace +func (tr *Workspace) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Workspace +func (tr *Workspace) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Workspace +func (tr *Workspace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Workspace using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Workspace) LateInitialize(attrs []byte) (bool, error) { + params := &WorkspaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Workspace) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/amp/v1beta1/zz_workspace_types.go b/apis/amp/v1beta1/zz_workspace_types.go index 49ac2e2564..bfd30837af 100755 --- a/apis/amp/v1beta1/zz_workspace_types.go +++ b/apis/amp/v1beta1/zz_workspace_types.go @@ -120,13 +120,14 @@ type WorkspaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Workspace is the Schema for the Workspaces API. Manages an Amazon Managed Service for Prometheus (AMP) Workspace // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Workspace struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/amplify/v1beta1/zz_app_terraformed.go b/apis/amplify/v1beta1/zz_app_terraformed.go new file mode 100755 index 0000000000..40588e170f --- /dev/null +++ b/apis/amplify/v1beta1/zz_app_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this App +func (mg *App) GetTerraformResourceType() string { + return "aws_amplify_app" +} + +// GetConnectionDetailsMapping for this App +func (tr *App) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"access_token": "spec.forProvider.accessTokenSecretRef", "auto_branch_creation_config[*].basic_auth_credentials": "spec.forProvider.autoBranchCreationConfig[*].basicAuthCredentialsSecretRef", "basic_auth_credentials": "spec.forProvider.basicAuthCredentialsSecretRef", "oauth_token": "spec.forProvider.oauthTokenSecretRef"} +} + +// GetObservation of this App +func (tr *App) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this App +func (tr *App) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this App +func (tr *App) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this App +func (tr *App) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this App +func (tr *App) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this App +func (tr *App) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this App +func (tr *App) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this App using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *App) LateInitialize(attrs []byte) (bool, error) { + params := &AppParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *App) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/amplify/v1beta1/zz_app_types.go b/apis/amplify/v1beta1/zz_app_types.go index 50e918db85..3d599c3feb 100755 --- a/apis/amplify/v1beta1/zz_app_types.go +++ b/apis/amplify/v1beta1/zz_app_types.go @@ -438,13 +438,14 @@ type AppStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // App is the Schema for the Apps API. Provides an Amplify App resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type App struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/amplify/v1beta1/zz_backendenvironment_terraformed.go b/apis/amplify/v1beta1/zz_backendenvironment_terraformed.go new file mode 100755 index 0000000000..c6f93ddc8a --- /dev/null +++ b/apis/amplify/v1beta1/zz_backendenvironment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BackendEnvironment +func (mg *BackendEnvironment) GetTerraformResourceType() string { + return "aws_amplify_backend_environment" +} + +// GetConnectionDetailsMapping for this BackendEnvironment +func (tr *BackendEnvironment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BackendEnvironment +func (tr *BackendEnvironment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BackendEnvironment +func (tr *BackendEnvironment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BackendEnvironment +func (tr *BackendEnvironment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BackendEnvironment +func (tr *BackendEnvironment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BackendEnvironment +func (tr *BackendEnvironment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BackendEnvironment +func (tr *BackendEnvironment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BackendEnvironment +func (tr *BackendEnvironment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BackendEnvironment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BackendEnvironment) LateInitialize(attrs []byte) (bool, error) { + params := &BackendEnvironmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BackendEnvironment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/amplify/v1beta1/zz_backendenvironment_types.go b/apis/amplify/v1beta1/zz_backendenvironment_types.go index 1cded24fa4..26a89ac0d9 100755 --- a/apis/amplify/v1beta1/zz_backendenvironment_types.go +++ b/apis/amplify/v1beta1/zz_backendenvironment_types.go @@ -98,13 +98,14 @@ type BackendEnvironmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BackendEnvironment is the Schema for the BackendEnvironments API. Provides an Amplify Backend Environment resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BackendEnvironment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/amplify/v1beta1/zz_branch_terraformed.go b/apis/amplify/v1beta1/zz_branch_terraformed.go new file mode 100755 index 0000000000..f585074ff7 --- /dev/null +++ b/apis/amplify/v1beta1/zz_branch_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Branch +func (mg *Branch) GetTerraformResourceType() string { + return "aws_amplify_branch" +} + +// GetConnectionDetailsMapping for this Branch +func (tr *Branch) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"basic_auth_credentials": "spec.forProvider.basicAuthCredentialsSecretRef"} +} + +// GetObservation of this Branch +func (tr *Branch) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Branch +func (tr *Branch) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Branch +func (tr *Branch) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Branch +func (tr *Branch) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Branch +func (tr *Branch) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Branch +func (tr *Branch) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Branch +func (tr *Branch) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Branch using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Branch) LateInitialize(attrs []byte) (bool, error) { + params := &BranchParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Branch) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/amplify/v1beta1/zz_branch_types.go b/apis/amplify/v1beta1/zz_branch_types.go index d32afd0fff..2f47b4eff4 100755 --- a/apis/amplify/v1beta1/zz_branch_types.go +++ b/apis/amplify/v1beta1/zz_branch_types.go @@ -243,13 +243,14 @@ type BranchStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Branch is the Schema for the Branchs API. Provides an Amplify Branch resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Branch struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/amplify/v1beta1/zz_generated.conversion_hubs.go b/apis/amplify/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..a1de5fea45 --- /dev/null +++ b/apis/amplify/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *App) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BackendEnvironment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Branch) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Webhook) Hub() {} diff --git a/apis/amplify/v1beta1/zz_generated_terraformed.go b/apis/amplify/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index c15659feaf..0000000000 --- a/apis/amplify/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this App -func (mg *App) GetTerraformResourceType() string { - return "aws_amplify_app" -} - -// GetConnectionDetailsMapping for this App -func (tr *App) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"access_token": "spec.forProvider.accessTokenSecretRef", "auto_branch_creation_config[*].basic_auth_credentials": "spec.forProvider.autoBranchCreationConfig[*].basicAuthCredentialsSecretRef", "basic_auth_credentials": "spec.forProvider.basicAuthCredentialsSecretRef", "oauth_token": "spec.forProvider.oauthTokenSecretRef"} -} - -// GetObservation of this App -func (tr *App) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this App -func (tr *App) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this App -func (tr *App) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this App -func (tr *App) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this App -func (tr *App) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this App -func (tr *App) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this App -func (tr *App) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this App using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *App) LateInitialize(attrs []byte) (bool, error) { - params := &AppParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *App) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BackendEnvironment -func (mg *BackendEnvironment) GetTerraformResourceType() string { - return "aws_amplify_backend_environment" -} - -// GetConnectionDetailsMapping for this BackendEnvironment -func (tr *BackendEnvironment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BackendEnvironment -func (tr *BackendEnvironment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BackendEnvironment -func (tr *BackendEnvironment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BackendEnvironment -func (tr *BackendEnvironment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BackendEnvironment -func (tr *BackendEnvironment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BackendEnvironment -func (tr *BackendEnvironment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BackendEnvironment -func (tr *BackendEnvironment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BackendEnvironment -func (tr *BackendEnvironment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BackendEnvironment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BackendEnvironment) LateInitialize(attrs []byte) (bool, error) { - params := &BackendEnvironmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BackendEnvironment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Branch -func (mg *Branch) GetTerraformResourceType() string { - return "aws_amplify_branch" -} - -// GetConnectionDetailsMapping for this Branch -func (tr *Branch) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"basic_auth_credentials": "spec.forProvider.basicAuthCredentialsSecretRef"} -} - -// GetObservation of this Branch -func (tr *Branch) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Branch -func (tr *Branch) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Branch -func (tr *Branch) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Branch -func (tr *Branch) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Branch -func (tr *Branch) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Branch -func (tr *Branch) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Branch -func (tr *Branch) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Branch using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Branch) LateInitialize(attrs []byte) (bool, error) { - params := &BranchParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Branch) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Webhook -func (mg *Webhook) GetTerraformResourceType() string { - return "aws_amplify_webhook" -} - -// GetConnectionDetailsMapping for this Webhook -func (tr *Webhook) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Webhook -func (tr *Webhook) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Webhook -func (tr *Webhook) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Webhook -func (tr *Webhook) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Webhook -func (tr *Webhook) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Webhook -func (tr *Webhook) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Webhook -func (tr *Webhook) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Webhook -func (tr *Webhook) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Webhook using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Webhook) LateInitialize(attrs []byte) (bool, error) { - params := &WebhookParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Webhook) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/amplify/v1beta1/zz_webhook_terraformed.go b/apis/amplify/v1beta1/zz_webhook_terraformed.go new file mode 100755 index 0000000000..6acb2dc2f5 --- /dev/null +++ b/apis/amplify/v1beta1/zz_webhook_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Webhook +func (mg *Webhook) GetTerraformResourceType() string { + return "aws_amplify_webhook" +} + +// GetConnectionDetailsMapping for this Webhook +func (tr *Webhook) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Webhook +func (tr *Webhook) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Webhook +func (tr *Webhook) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Webhook +func (tr *Webhook) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Webhook +func (tr *Webhook) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Webhook +func (tr *Webhook) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Webhook +func (tr *Webhook) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Webhook +func (tr *Webhook) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Webhook using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Webhook) LateInitialize(attrs []byte) (bool, error) { + params := &WebhookParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Webhook) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/amplify/v1beta1/zz_webhook_types.go b/apis/amplify/v1beta1/zz_webhook_types.go index f50b40f241..ee52e04b67 100755 --- a/apis/amplify/v1beta1/zz_webhook_types.go +++ b/apis/amplify/v1beta1/zz_webhook_types.go @@ -131,13 +131,14 @@ type WebhookStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Webhook is the Schema for the Webhooks API. Provides an Amplify Webhook resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Webhook struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_account_terraformed.go b/apis/apigateway/v1beta1/zz_account_terraformed.go new file mode 100755 index 0000000000..6d0762d0eb --- /dev/null +++ b/apis/apigateway/v1beta1/zz_account_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Account +func (mg *Account) GetTerraformResourceType() string { + return "aws_api_gateway_account" +} + +// GetConnectionDetailsMapping for this Account +func (tr *Account) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Account +func (tr *Account) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Account +func (tr *Account) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Account +func (tr *Account) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Account +func (tr *Account) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Account +func (tr *Account) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Account +func (tr *Account) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Account +func (tr *Account) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Account using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Account) LateInitialize(attrs []byte) (bool, error) { + params := &AccountParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Account) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_account_types.go b/apis/apigateway/v1beta1/zz_account_types.go index 9104a7b7d5..06a95c7a72 100755 --- a/apis/apigateway/v1beta1/zz_account_types.go +++ b/apis/apigateway/v1beta1/zz_account_types.go @@ -105,13 +105,14 @@ type AccountStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Account is the Schema for the Accounts API. Provides a settings of an API Gateway Account. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Account struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_apikey_terraformed.go b/apis/apigateway/v1beta1/zz_apikey_terraformed.go new file mode 100755 index 0000000000..d6c5843855 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_apikey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this APIKey +func (mg *APIKey) GetTerraformResourceType() string { + return "aws_api_gateway_api_key" +} + +// GetConnectionDetailsMapping for this APIKey +func (tr *APIKey) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"value": "spec.forProvider.valueSecretRef"} +} + +// GetObservation of this APIKey +func (tr *APIKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this APIKey +func (tr *APIKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this APIKey +func (tr *APIKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this APIKey +func (tr *APIKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this APIKey +func (tr *APIKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this APIKey +func (tr *APIKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this APIKey +func (tr *APIKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this APIKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *APIKey) LateInitialize(attrs []byte) (bool, error) { + params := &APIKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *APIKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_apikey_types.go b/apis/apigateway/v1beta1/zz_apikey_types.go index 699dbf0fbf..1dc4bc74b0 100755 --- a/apis/apigateway/v1beta1/zz_apikey_types.go +++ b/apis/apigateway/v1beta1/zz_apikey_types.go @@ -118,13 +118,14 @@ type APIKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // APIKey is the Schema for the APIKeys API. Provides an API Gateway API Key. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type APIKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_authorizer_terraformed.go b/apis/apigateway/v1beta1/zz_authorizer_terraformed.go new file mode 100755 index 0000000000..9f902ff7c0 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_authorizer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Authorizer +func (mg *Authorizer) GetTerraformResourceType() string { + return "aws_api_gateway_authorizer" +} + +// GetConnectionDetailsMapping for this Authorizer +func (tr *Authorizer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Authorizer +func (tr *Authorizer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Authorizer +func (tr *Authorizer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Authorizer +func (tr *Authorizer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Authorizer +func (tr *Authorizer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Authorizer +func (tr *Authorizer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Authorizer +func (tr *Authorizer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Authorizer +func (tr *Authorizer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Authorizer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Authorizer) LateInitialize(attrs []byte) (bool, error) { + params := &AuthorizerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Authorizer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_authorizer_types.go b/apis/apigateway/v1beta1/zz_authorizer_types.go index 0f662607f2..ed717df530 100755 --- a/apis/apigateway/v1beta1/zz_authorizer_types.go +++ b/apis/apigateway/v1beta1/zz_authorizer_types.go @@ -217,13 +217,14 @@ type AuthorizerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Authorizer is the Schema for the Authorizers API. Provides an API Gateway Authorizer. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Authorizer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_basepathmapping_terraformed.go b/apis/apigateway/v1beta1/zz_basepathmapping_terraformed.go new file mode 100755 index 0000000000..ed01829ddf --- /dev/null +++ b/apis/apigateway/v1beta1/zz_basepathmapping_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BasePathMapping +func (mg *BasePathMapping) GetTerraformResourceType() string { + return "aws_api_gateway_base_path_mapping" +} + +// GetConnectionDetailsMapping for this BasePathMapping +func (tr *BasePathMapping) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BasePathMapping +func (tr *BasePathMapping) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BasePathMapping +func (tr *BasePathMapping) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BasePathMapping +func (tr *BasePathMapping) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BasePathMapping +func (tr *BasePathMapping) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BasePathMapping +func (tr *BasePathMapping) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BasePathMapping +func (tr *BasePathMapping) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BasePathMapping +func (tr *BasePathMapping) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BasePathMapping using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BasePathMapping) LateInitialize(attrs []byte) (bool, error) { + params := &BasePathMappingParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BasePathMapping) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_basepathmapping_types.go b/apis/apigateway/v1beta1/zz_basepathmapping_types.go index f1c4ec2204..10cf7e0c61 100755 --- a/apis/apigateway/v1beta1/zz_basepathmapping_types.go +++ b/apis/apigateway/v1beta1/zz_basepathmapping_types.go @@ -157,13 +157,14 @@ type BasePathMappingStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BasePathMapping is the Schema for the BasePathMappings API. Connects a custom domain with a deployed API // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BasePathMapping struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_clientcertificate_terraformed.go b/apis/apigateway/v1beta1/zz_clientcertificate_terraformed.go new file mode 100755 index 0000000000..6f135b7289 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_clientcertificate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClientCertificate +func (mg *ClientCertificate) GetTerraformResourceType() string { + return "aws_api_gateway_client_certificate" +} + +// GetConnectionDetailsMapping for this ClientCertificate +func (tr *ClientCertificate) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClientCertificate +func (tr *ClientCertificate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClientCertificate +func (tr *ClientCertificate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClientCertificate +func (tr *ClientCertificate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClientCertificate +func (tr *ClientCertificate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClientCertificate +func (tr *ClientCertificate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClientCertificate +func (tr *ClientCertificate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClientCertificate +func (tr *ClientCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClientCertificate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClientCertificate) LateInitialize(attrs []byte) (bool, error) { + params := &ClientCertificateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClientCertificate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_clientcertificate_types.go b/apis/apigateway/v1beta1/zz_clientcertificate_types.go index cdfd591232..0d93954c37 100755 --- a/apis/apigateway/v1beta1/zz_clientcertificate_types.go +++ b/apis/apigateway/v1beta1/zz_clientcertificate_types.go @@ -97,13 +97,14 @@ type ClientCertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClientCertificate is the Schema for the ClientCertificates API. Provides an API Gateway Client Certificate. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClientCertificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_deployment_terraformed.go b/apis/apigateway/v1beta1/zz_deployment_terraformed.go new file mode 100755 index 0000000000..1302b9ce12 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_deployment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Deployment +func (mg *Deployment) GetTerraformResourceType() string { + return "aws_api_gateway_deployment" +} + +// GetConnectionDetailsMapping for this Deployment +func (tr *Deployment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Deployment +func (tr *Deployment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Deployment +func (tr *Deployment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Deployment +func (tr *Deployment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Deployment +func (tr *Deployment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Deployment +func (tr *Deployment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Deployment +func (tr *Deployment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Deployment +func (tr *Deployment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Deployment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Deployment) LateInitialize(attrs []byte) (bool, error) { + params := &DeploymentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Deployment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_deployment_types.go b/apis/apigateway/v1beta1/zz_deployment_types.go index 546780141f..a02c94801f 100755 --- a/apis/apigateway/v1beta1/zz_deployment_types.go +++ b/apis/apigateway/v1beta1/zz_deployment_types.go @@ -156,13 +156,14 @@ type DeploymentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Deployment is the Schema for the Deployments API. Manages an API Gateway REST Deployment. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Deployment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_documentationpart_terraformed.go b/apis/apigateway/v1beta1/zz_documentationpart_terraformed.go new file mode 100755 index 0000000000..328e587991 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_documentationpart_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DocumentationPart +func (mg *DocumentationPart) GetTerraformResourceType() string { + return "aws_api_gateway_documentation_part" +} + +// GetConnectionDetailsMapping for this DocumentationPart +func (tr *DocumentationPart) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DocumentationPart +func (tr *DocumentationPart) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DocumentationPart +func (tr *DocumentationPart) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DocumentationPart +func (tr *DocumentationPart) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DocumentationPart +func (tr *DocumentationPart) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DocumentationPart +func (tr *DocumentationPart) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DocumentationPart +func (tr *DocumentationPart) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DocumentationPart +func (tr *DocumentationPart) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DocumentationPart using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DocumentationPart) LateInitialize(attrs []byte) (bool, error) { + params := &DocumentationPartParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DocumentationPart) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_documentationpart_types.go b/apis/apigateway/v1beta1/zz_documentationpart_types.go index 39c0e03b12..386fe79854 100755 --- a/apis/apigateway/v1beta1/zz_documentationpart_types.go +++ b/apis/apigateway/v1beta1/zz_documentationpart_types.go @@ -167,13 +167,14 @@ type DocumentationPartStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DocumentationPart is the Schema for the DocumentationParts API. Provides a settings of an API Gateway Documentation Part. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DocumentationPart struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_documentationversion_terraformed.go b/apis/apigateway/v1beta1/zz_documentationversion_terraformed.go new file mode 100755 index 0000000000..34d00be1fc --- /dev/null +++ b/apis/apigateway/v1beta1/zz_documentationversion_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DocumentationVersion +func (mg *DocumentationVersion) GetTerraformResourceType() string { + return "aws_api_gateway_documentation_version" +} + +// GetConnectionDetailsMapping for this DocumentationVersion +func (tr *DocumentationVersion) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DocumentationVersion +func (tr *DocumentationVersion) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DocumentationVersion +func (tr *DocumentationVersion) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DocumentationVersion +func (tr *DocumentationVersion) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DocumentationVersion +func (tr *DocumentationVersion) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DocumentationVersion +func (tr *DocumentationVersion) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DocumentationVersion +func (tr *DocumentationVersion) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DocumentationVersion +func (tr *DocumentationVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DocumentationVersion using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DocumentationVersion) LateInitialize(attrs []byte) (bool, error) { + params := &DocumentationVersionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DocumentationVersion) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_documentationversion_types.go b/apis/apigateway/v1beta1/zz_documentationversion_types.go index 4977ad9b0a..e8c2023482 100755 --- a/apis/apigateway/v1beta1/zz_documentationversion_types.go +++ b/apis/apigateway/v1beta1/zz_documentationversion_types.go @@ -107,13 +107,14 @@ type DocumentationVersionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DocumentationVersion is the Schema for the DocumentationVersions API. Provides a resource to manage an API Gateway Documentation Version. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DocumentationVersion struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_domainname_terraformed.go b/apis/apigateway/v1beta1/zz_domainname_terraformed.go new file mode 100755 index 0000000000..c0f0fdfeef --- /dev/null +++ b/apis/apigateway/v1beta1/zz_domainname_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DomainName +func (mg *DomainName) GetTerraformResourceType() string { + return "aws_api_gateway_domain_name" +} + +// GetConnectionDetailsMapping for this DomainName +func (tr *DomainName) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"certificate_private_key": "spec.forProvider.certificatePrivateKeySecretRef"} +} + +// GetObservation of this DomainName +func (tr *DomainName) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DomainName +func (tr *DomainName) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DomainName +func (tr *DomainName) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DomainName +func (tr *DomainName) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DomainName +func (tr *DomainName) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DomainName +func (tr *DomainName) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DomainName +func (tr *DomainName) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DomainName using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DomainName) LateInitialize(attrs []byte) (bool, error) { + params := &DomainNameParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DomainName) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_domainname_types.go b/apis/apigateway/v1beta1/zz_domainname_types.go index 0caf344d26..1524853269 100755 --- a/apis/apigateway/v1beta1/zz_domainname_types.go +++ b/apis/apigateway/v1beta1/zz_domainname_types.go @@ -295,13 +295,14 @@ type DomainNameStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DomainName is the Schema for the DomainNames API. Registers a custom domain name for use with AWS API Gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DomainName struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_gatewayresponse_terraformed.go b/apis/apigateway/v1beta1/zz_gatewayresponse_terraformed.go new file mode 100755 index 0000000000..0185956b67 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_gatewayresponse_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GatewayResponse +func (mg *GatewayResponse) GetTerraformResourceType() string { + return "aws_api_gateway_gateway_response" +} + +// GetConnectionDetailsMapping for this GatewayResponse +func (tr *GatewayResponse) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GatewayResponse +func (tr *GatewayResponse) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GatewayResponse +func (tr *GatewayResponse) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GatewayResponse +func (tr *GatewayResponse) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GatewayResponse +func (tr *GatewayResponse) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GatewayResponse +func (tr *GatewayResponse) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GatewayResponse +func (tr *GatewayResponse) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GatewayResponse +func (tr *GatewayResponse) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GatewayResponse using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GatewayResponse) LateInitialize(attrs []byte) (bool, error) { + params := &GatewayResponseParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GatewayResponse) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_gatewayresponse_types.go b/apis/apigateway/v1beta1/zz_gatewayresponse_types.go index f810e579e5..4e33b2aadf 100755 --- a/apis/apigateway/v1beta1/zz_gatewayresponse_types.go +++ b/apis/apigateway/v1beta1/zz_gatewayresponse_types.go @@ -132,13 +132,14 @@ type GatewayResponseStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GatewayResponse is the Schema for the GatewayResponses API. Provides an API Gateway Gateway Response for a REST API Gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GatewayResponse struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_generated.conversion_hubs.go b/apis/apigateway/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..2e1cde4cda --- /dev/null +++ b/apis/apigateway/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,83 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Account) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *APIKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Authorizer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BasePathMapping) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClientCertificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Deployment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DocumentationPart) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DocumentationVersion) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DomainName) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GatewayResponse) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Integration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *IntegrationResponse) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Method) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MethodResponse) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MethodSettings) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Model) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RequestValidator) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Resource) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RestAPI) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RestAPIPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Stage) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UsagePlan) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UsagePlanKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCLink) Hub() {} diff --git a/apis/apigateway/v1beta1/zz_generated_terraformed.go b/apis/apigateway/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index ffd7534260..0000000000 --- a/apis/apigateway/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,2755 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Account -func (mg *Account) GetTerraformResourceType() string { - return "aws_api_gateway_account" -} - -// GetConnectionDetailsMapping for this Account -func (tr *Account) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Account -func (tr *Account) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Account -func (tr *Account) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Account -func (tr *Account) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Account -func (tr *Account) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Account -func (tr *Account) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Account -func (tr *Account) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Account -func (tr *Account) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Account using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Account) LateInitialize(attrs []byte) (bool, error) { - params := &AccountParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Account) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this APIKey -func (mg *APIKey) GetTerraformResourceType() string { - return "aws_api_gateway_api_key" -} - -// GetConnectionDetailsMapping for this APIKey -func (tr *APIKey) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"value": "spec.forProvider.valueSecretRef"} -} - -// GetObservation of this APIKey -func (tr *APIKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this APIKey -func (tr *APIKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this APIKey -func (tr *APIKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this APIKey -func (tr *APIKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this APIKey -func (tr *APIKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this APIKey -func (tr *APIKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this APIKey -func (tr *APIKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this APIKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *APIKey) LateInitialize(attrs []byte) (bool, error) { - params := &APIKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *APIKey) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Authorizer -func (mg *Authorizer) GetTerraformResourceType() string { - return "aws_api_gateway_authorizer" -} - -// GetConnectionDetailsMapping for this Authorizer -func (tr *Authorizer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Authorizer -func (tr *Authorizer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Authorizer -func (tr *Authorizer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Authorizer -func (tr *Authorizer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Authorizer -func (tr *Authorizer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Authorizer -func (tr *Authorizer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Authorizer -func (tr *Authorizer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Authorizer -func (tr *Authorizer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Authorizer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Authorizer) LateInitialize(attrs []byte) (bool, error) { - params := &AuthorizerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Authorizer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BasePathMapping -func (mg *BasePathMapping) GetTerraformResourceType() string { - return "aws_api_gateway_base_path_mapping" -} - -// GetConnectionDetailsMapping for this BasePathMapping -func (tr *BasePathMapping) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BasePathMapping -func (tr *BasePathMapping) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BasePathMapping -func (tr *BasePathMapping) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BasePathMapping -func (tr *BasePathMapping) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BasePathMapping -func (tr *BasePathMapping) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BasePathMapping -func (tr *BasePathMapping) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BasePathMapping -func (tr *BasePathMapping) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BasePathMapping -func (tr *BasePathMapping) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BasePathMapping using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BasePathMapping) LateInitialize(attrs []byte) (bool, error) { - params := &BasePathMappingParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BasePathMapping) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClientCertificate -func (mg *ClientCertificate) GetTerraformResourceType() string { - return "aws_api_gateway_client_certificate" -} - -// GetConnectionDetailsMapping for this ClientCertificate -func (tr *ClientCertificate) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClientCertificate -func (tr *ClientCertificate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClientCertificate -func (tr *ClientCertificate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClientCertificate -func (tr *ClientCertificate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClientCertificate -func (tr *ClientCertificate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClientCertificate -func (tr *ClientCertificate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClientCertificate -func (tr *ClientCertificate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClientCertificate -func (tr *ClientCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClientCertificate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClientCertificate) LateInitialize(attrs []byte) (bool, error) { - params := &ClientCertificateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClientCertificate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Deployment -func (mg *Deployment) GetTerraformResourceType() string { - return "aws_api_gateway_deployment" -} - -// GetConnectionDetailsMapping for this Deployment -func (tr *Deployment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Deployment -func (tr *Deployment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Deployment -func (tr *Deployment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Deployment -func (tr *Deployment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Deployment -func (tr *Deployment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Deployment -func (tr *Deployment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Deployment -func (tr *Deployment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Deployment -func (tr *Deployment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Deployment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Deployment) LateInitialize(attrs []byte) (bool, error) { - params := &DeploymentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Deployment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DocumentationPart -func (mg *DocumentationPart) GetTerraformResourceType() string { - return "aws_api_gateway_documentation_part" -} - -// GetConnectionDetailsMapping for this DocumentationPart -func (tr *DocumentationPart) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DocumentationPart -func (tr *DocumentationPart) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DocumentationPart -func (tr *DocumentationPart) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DocumentationPart -func (tr *DocumentationPart) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DocumentationPart -func (tr *DocumentationPart) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DocumentationPart -func (tr *DocumentationPart) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DocumentationPart -func (tr *DocumentationPart) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DocumentationPart -func (tr *DocumentationPart) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DocumentationPart using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DocumentationPart) LateInitialize(attrs []byte) (bool, error) { - params := &DocumentationPartParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DocumentationPart) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DocumentationVersion -func (mg *DocumentationVersion) GetTerraformResourceType() string { - return "aws_api_gateway_documentation_version" -} - -// GetConnectionDetailsMapping for this DocumentationVersion -func (tr *DocumentationVersion) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DocumentationVersion -func (tr *DocumentationVersion) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DocumentationVersion -func (tr *DocumentationVersion) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DocumentationVersion -func (tr *DocumentationVersion) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DocumentationVersion -func (tr *DocumentationVersion) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DocumentationVersion -func (tr *DocumentationVersion) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DocumentationVersion -func (tr *DocumentationVersion) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DocumentationVersion -func (tr *DocumentationVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DocumentationVersion using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DocumentationVersion) LateInitialize(attrs []byte) (bool, error) { - params := &DocumentationVersionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DocumentationVersion) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DomainName -func (mg *DomainName) GetTerraformResourceType() string { - return "aws_api_gateway_domain_name" -} - -// GetConnectionDetailsMapping for this DomainName -func (tr *DomainName) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"certificate_private_key": "spec.forProvider.certificatePrivateKeySecretRef"} -} - -// GetObservation of this DomainName -func (tr *DomainName) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DomainName -func (tr *DomainName) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DomainName -func (tr *DomainName) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DomainName -func (tr *DomainName) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DomainName -func (tr *DomainName) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DomainName -func (tr *DomainName) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DomainName -func (tr *DomainName) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DomainName using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DomainName) LateInitialize(attrs []byte) (bool, error) { - params := &DomainNameParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DomainName) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GatewayResponse -func (mg *GatewayResponse) GetTerraformResourceType() string { - return "aws_api_gateway_gateway_response" -} - -// GetConnectionDetailsMapping for this GatewayResponse -func (tr *GatewayResponse) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GatewayResponse -func (tr *GatewayResponse) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GatewayResponse -func (tr *GatewayResponse) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GatewayResponse -func (tr *GatewayResponse) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GatewayResponse -func (tr *GatewayResponse) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GatewayResponse -func (tr *GatewayResponse) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GatewayResponse -func (tr *GatewayResponse) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GatewayResponse -func (tr *GatewayResponse) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GatewayResponse using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GatewayResponse) LateInitialize(attrs []byte) (bool, error) { - params := &GatewayResponseParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GatewayResponse) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Integration -func (mg *Integration) GetTerraformResourceType() string { - return "aws_api_gateway_integration" -} - -// GetConnectionDetailsMapping for this Integration -func (tr *Integration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Integration -func (tr *Integration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Integration -func (tr *Integration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Integration -func (tr *Integration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Integration -func (tr *Integration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Integration -func (tr *Integration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Integration -func (tr *Integration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Integration -func (tr *Integration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Integration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Integration) LateInitialize(attrs []byte) (bool, error) { - params := &IntegrationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Integration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this IntegrationResponse -func (mg *IntegrationResponse) GetTerraformResourceType() string { - return "aws_api_gateway_integration_response" -} - -// GetConnectionDetailsMapping for this IntegrationResponse -func (tr *IntegrationResponse) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this IntegrationResponse -func (tr *IntegrationResponse) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this IntegrationResponse -func (tr *IntegrationResponse) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this IntegrationResponse -func (tr *IntegrationResponse) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this IntegrationResponse -func (tr *IntegrationResponse) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this IntegrationResponse -func (tr *IntegrationResponse) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this IntegrationResponse -func (tr *IntegrationResponse) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this IntegrationResponse -func (tr *IntegrationResponse) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this IntegrationResponse using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *IntegrationResponse) LateInitialize(attrs []byte) (bool, error) { - params := &IntegrationResponseParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *IntegrationResponse) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Method -func (mg *Method) GetTerraformResourceType() string { - return "aws_api_gateway_method" -} - -// GetConnectionDetailsMapping for this Method -func (tr *Method) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Method -func (tr *Method) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Method -func (tr *Method) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Method -func (tr *Method) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Method -func (tr *Method) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Method -func (tr *Method) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Method -func (tr *Method) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Method -func (tr *Method) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Method using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Method) LateInitialize(attrs []byte) (bool, error) { - params := &MethodParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Method) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MethodResponse -func (mg *MethodResponse) GetTerraformResourceType() string { - return "aws_api_gateway_method_response" -} - -// GetConnectionDetailsMapping for this MethodResponse -func (tr *MethodResponse) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MethodResponse -func (tr *MethodResponse) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MethodResponse -func (tr *MethodResponse) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MethodResponse -func (tr *MethodResponse) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MethodResponse -func (tr *MethodResponse) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MethodResponse -func (tr *MethodResponse) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MethodResponse -func (tr *MethodResponse) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MethodResponse -func (tr *MethodResponse) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MethodResponse using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MethodResponse) LateInitialize(attrs []byte) (bool, error) { - params := &MethodResponseParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MethodResponse) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MethodSettings -func (mg *MethodSettings) GetTerraformResourceType() string { - return "aws_api_gateway_method_settings" -} - -// GetConnectionDetailsMapping for this MethodSettings -func (tr *MethodSettings) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MethodSettings -func (tr *MethodSettings) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MethodSettings -func (tr *MethodSettings) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MethodSettings -func (tr *MethodSettings) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MethodSettings -func (tr *MethodSettings) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MethodSettings -func (tr *MethodSettings) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MethodSettings -func (tr *MethodSettings) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MethodSettings -func (tr *MethodSettings) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MethodSettings using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MethodSettings) LateInitialize(attrs []byte) (bool, error) { - params := &MethodSettingsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MethodSettings) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Model -func (mg *Model) GetTerraformResourceType() string { - return "aws_api_gateway_model" -} - -// GetConnectionDetailsMapping for this Model -func (tr *Model) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Model -func (tr *Model) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Model -func (tr *Model) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Model -func (tr *Model) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Model -func (tr *Model) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Model -func (tr *Model) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Model -func (tr *Model) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Model -func (tr *Model) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Model using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Model) LateInitialize(attrs []byte) (bool, error) { - params := &ModelParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Model) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RequestValidator -func (mg *RequestValidator) GetTerraformResourceType() string { - return "aws_api_gateway_request_validator" -} - -// GetConnectionDetailsMapping for this RequestValidator -func (tr *RequestValidator) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RequestValidator -func (tr *RequestValidator) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RequestValidator -func (tr *RequestValidator) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RequestValidator -func (tr *RequestValidator) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RequestValidator -func (tr *RequestValidator) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RequestValidator -func (tr *RequestValidator) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RequestValidator -func (tr *RequestValidator) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RequestValidator -func (tr *RequestValidator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RequestValidator using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RequestValidator) LateInitialize(attrs []byte) (bool, error) { - params := &RequestValidatorParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RequestValidator) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Resource -func (mg *Resource) GetTerraformResourceType() string { - return "aws_api_gateway_resource" -} - -// GetConnectionDetailsMapping for this Resource -func (tr *Resource) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Resource -func (tr *Resource) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Resource -func (tr *Resource) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Resource -func (tr *Resource) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Resource -func (tr *Resource) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Resource -func (tr *Resource) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Resource -func (tr *Resource) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Resource -func (tr *Resource) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Resource using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Resource) LateInitialize(attrs []byte) (bool, error) { - params := &ResourceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Resource) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RestAPI -func (mg *RestAPI) GetTerraformResourceType() string { - return "aws_api_gateway_rest_api" -} - -// GetConnectionDetailsMapping for this RestAPI -func (tr *RestAPI) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RestAPI -func (tr *RestAPI) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RestAPI -func (tr *RestAPI) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RestAPI -func (tr *RestAPI) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RestAPI -func (tr *RestAPI) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RestAPI -func (tr *RestAPI) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RestAPI -func (tr *RestAPI) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RestAPI -func (tr *RestAPI) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RestAPI using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RestAPI) LateInitialize(attrs []byte) (bool, error) { - params := &RestAPIParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RestAPI) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RestAPIPolicy -func (mg *RestAPIPolicy) GetTerraformResourceType() string { - return "aws_api_gateway_rest_api_policy" -} - -// GetConnectionDetailsMapping for this RestAPIPolicy -func (tr *RestAPIPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RestAPIPolicy -func (tr *RestAPIPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RestAPIPolicy -func (tr *RestAPIPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RestAPIPolicy -func (tr *RestAPIPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RestAPIPolicy -func (tr *RestAPIPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RestAPIPolicy -func (tr *RestAPIPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RestAPIPolicy -func (tr *RestAPIPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RestAPIPolicy -func (tr *RestAPIPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RestAPIPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RestAPIPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &RestAPIPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RestAPIPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Stage -func (mg *Stage) GetTerraformResourceType() string { - return "aws_api_gateway_stage" -} - -// GetConnectionDetailsMapping for this Stage -func (tr *Stage) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Stage -func (tr *Stage) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Stage -func (tr *Stage) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Stage -func (tr *Stage) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Stage -func (tr *Stage) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Stage -func (tr *Stage) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Stage -func (tr *Stage) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Stage -func (tr *Stage) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Stage using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Stage) LateInitialize(attrs []byte) (bool, error) { - params := &StageParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Stage) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UsagePlan -func (mg *UsagePlan) GetTerraformResourceType() string { - return "aws_api_gateway_usage_plan" -} - -// GetConnectionDetailsMapping for this UsagePlan -func (tr *UsagePlan) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UsagePlan -func (tr *UsagePlan) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UsagePlan -func (tr *UsagePlan) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UsagePlan -func (tr *UsagePlan) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UsagePlan -func (tr *UsagePlan) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UsagePlan -func (tr *UsagePlan) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UsagePlan -func (tr *UsagePlan) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UsagePlan -func (tr *UsagePlan) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UsagePlan using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UsagePlan) LateInitialize(attrs []byte) (bool, error) { - params := &UsagePlanParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UsagePlan) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UsagePlanKey -func (mg *UsagePlanKey) GetTerraformResourceType() string { - return "aws_api_gateway_usage_plan_key" -} - -// GetConnectionDetailsMapping for this UsagePlanKey -func (tr *UsagePlanKey) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UsagePlanKey -func (tr *UsagePlanKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UsagePlanKey -func (tr *UsagePlanKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UsagePlanKey -func (tr *UsagePlanKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UsagePlanKey -func (tr *UsagePlanKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UsagePlanKey -func (tr *UsagePlanKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UsagePlanKey -func (tr *UsagePlanKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UsagePlanKey -func (tr *UsagePlanKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UsagePlanKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UsagePlanKey) LateInitialize(attrs []byte) (bool, error) { - params := &UsagePlanKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UsagePlanKey) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCLink -func (mg *VPCLink) GetTerraformResourceType() string { - return "aws_api_gateway_vpc_link" -} - -// GetConnectionDetailsMapping for this VPCLink -func (tr *VPCLink) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCLink -func (tr *VPCLink) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCLink -func (tr *VPCLink) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCLink -func (tr *VPCLink) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCLink -func (tr *VPCLink) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCLink -func (tr *VPCLink) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCLink -func (tr *VPCLink) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCLink -func (tr *VPCLink) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCLink using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCLink) LateInitialize(attrs []byte) (bool, error) { - params := &VPCLinkParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCLink) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/apigateway/v1beta1/zz_integration_terraformed.go b/apis/apigateway/v1beta1/zz_integration_terraformed.go new file mode 100755 index 0000000000..529f09786a --- /dev/null +++ b/apis/apigateway/v1beta1/zz_integration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Integration +func (mg *Integration) GetTerraformResourceType() string { + return "aws_api_gateway_integration" +} + +// GetConnectionDetailsMapping for this Integration +func (tr *Integration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Integration +func (tr *Integration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Integration +func (tr *Integration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Integration +func (tr *Integration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Integration +func (tr *Integration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Integration +func (tr *Integration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Integration +func (tr *Integration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Integration +func (tr *Integration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Integration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Integration) LateInitialize(attrs []byte) (bool, error) { + params := &IntegrationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Integration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_integration_types.go b/apis/apigateway/v1beta1/zz_integration_types.go index 37e9a30f2a..c14f3dd130 100755 --- a/apis/apigateway/v1beta1/zz_integration_types.go +++ b/apis/apigateway/v1beta1/zz_integration_types.go @@ -379,13 +379,14 @@ type IntegrationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Integration is the Schema for the Integrations API. Provides an HTTP Method Integration for an API Gateway Integration. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Integration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_integrationresponse_terraformed.go b/apis/apigateway/v1beta1/zz_integrationresponse_terraformed.go new file mode 100755 index 0000000000..0c9e614428 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_integrationresponse_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this IntegrationResponse +func (mg *IntegrationResponse) GetTerraformResourceType() string { + return "aws_api_gateway_integration_response" +} + +// GetConnectionDetailsMapping for this IntegrationResponse +func (tr *IntegrationResponse) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this IntegrationResponse +func (tr *IntegrationResponse) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this IntegrationResponse +func (tr *IntegrationResponse) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this IntegrationResponse +func (tr *IntegrationResponse) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this IntegrationResponse +func (tr *IntegrationResponse) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this IntegrationResponse +func (tr *IntegrationResponse) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this IntegrationResponse +func (tr *IntegrationResponse) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this IntegrationResponse +func (tr *IntegrationResponse) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this IntegrationResponse using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *IntegrationResponse) LateInitialize(attrs []byte) (bool, error) { + params := &IntegrationResponseParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *IntegrationResponse) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_integrationresponse_types.go b/apis/apigateway/v1beta1/zz_integrationresponse_types.go index 5c046eab9d..9e2048d5c0 100755 --- a/apis/apigateway/v1beta1/zz_integrationresponse_types.go +++ b/apis/apigateway/v1beta1/zz_integrationresponse_types.go @@ -223,13 +223,14 @@ type IntegrationResponseStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IntegrationResponse is the Schema for the IntegrationResponses API. Provides an HTTP Method Integration Response for an API Gateway Resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type IntegrationResponse struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_method_terraformed.go b/apis/apigateway/v1beta1/zz_method_terraformed.go new file mode 100755 index 0000000000..20edf44955 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_method_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Method +func (mg *Method) GetTerraformResourceType() string { + return "aws_api_gateway_method" +} + +// GetConnectionDetailsMapping for this Method +func (tr *Method) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Method +func (tr *Method) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Method +func (tr *Method) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Method +func (tr *Method) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Method +func (tr *Method) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Method +func (tr *Method) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Method +func (tr *Method) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Method +func (tr *Method) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Method using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Method) LateInitialize(attrs []byte) (bool, error) { + params := &MethodParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Method) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_method_types.go b/apis/apigateway/v1beta1/zz_method_types.go index 8de4451417..fb3c208aaf 100755 --- a/apis/apigateway/v1beta1/zz_method_types.go +++ b/apis/apigateway/v1beta1/zz_method_types.go @@ -245,13 +245,14 @@ type MethodStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Method is the Schema for the Methods API. Provides a HTTP Method for an API Gateway Resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Method struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_methodresponse_terraformed.go b/apis/apigateway/v1beta1/zz_methodresponse_terraformed.go new file mode 100755 index 0000000000..a7792d5eb4 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_methodresponse_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MethodResponse +func (mg *MethodResponse) GetTerraformResourceType() string { + return "aws_api_gateway_method_response" +} + +// GetConnectionDetailsMapping for this MethodResponse +func (tr *MethodResponse) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MethodResponse +func (tr *MethodResponse) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MethodResponse +func (tr *MethodResponse) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MethodResponse +func (tr *MethodResponse) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MethodResponse +func (tr *MethodResponse) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MethodResponse +func (tr *MethodResponse) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MethodResponse +func (tr *MethodResponse) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MethodResponse +func (tr *MethodResponse) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MethodResponse using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MethodResponse) LateInitialize(attrs []byte) (bool, error) { + params := &MethodResponseParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MethodResponse) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_methodresponse_types.go b/apis/apigateway/v1beta1/zz_methodresponse_types.go index 512cb71675..b04c5da48f 100755 --- a/apis/apigateway/v1beta1/zz_methodresponse_types.go +++ b/apis/apigateway/v1beta1/zz_methodresponse_types.go @@ -189,13 +189,14 @@ type MethodResponseStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MethodResponse is the Schema for the MethodResponses API. Provides an HTTP Method Response for an API Gateway Resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MethodResponse struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_methodsettings_terraformed.go b/apis/apigateway/v1beta1/zz_methodsettings_terraformed.go new file mode 100755 index 0000000000..1dbc0201a1 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_methodsettings_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MethodSettings +func (mg *MethodSettings) GetTerraformResourceType() string { + return "aws_api_gateway_method_settings" +} + +// GetConnectionDetailsMapping for this MethodSettings +func (tr *MethodSettings) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MethodSettings +func (tr *MethodSettings) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MethodSettings +func (tr *MethodSettings) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MethodSettings +func (tr *MethodSettings) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MethodSettings +func (tr *MethodSettings) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MethodSettings +func (tr *MethodSettings) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MethodSettings +func (tr *MethodSettings) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MethodSettings +func (tr *MethodSettings) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MethodSettings using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MethodSettings) LateInitialize(attrs []byte) (bool, error) { + params := &MethodSettingsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MethodSettings) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_methodsettings_types.go b/apis/apigateway/v1beta1/zz_methodsettings_types.go index 8565658260..38e3353eaf 100755 --- a/apis/apigateway/v1beta1/zz_methodsettings_types.go +++ b/apis/apigateway/v1beta1/zz_methodsettings_types.go @@ -245,13 +245,14 @@ type MethodSettingsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MethodSettings is the Schema for the MethodSettingss API. Manages API Gateway Stage Method Settings // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MethodSettings struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_model_terraformed.go b/apis/apigateway/v1beta1/zz_model_terraformed.go new file mode 100755 index 0000000000..7f1ca6a746 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_model_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Model +func (mg *Model) GetTerraformResourceType() string { + return "aws_api_gateway_model" +} + +// GetConnectionDetailsMapping for this Model +func (tr *Model) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Model +func (tr *Model) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Model +func (tr *Model) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Model +func (tr *Model) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Model +func (tr *Model) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Model +func (tr *Model) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Model +func (tr *Model) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Model +func (tr *Model) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Model using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Model) LateInitialize(attrs []byte) (bool, error) { + params := &ModelParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Model) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_model_types.go b/apis/apigateway/v1beta1/zz_model_types.go index 5c8194ac88..a8430efb21 100755 --- a/apis/apigateway/v1beta1/zz_model_types.go +++ b/apis/apigateway/v1beta1/zz_model_types.go @@ -128,13 +128,14 @@ type ModelStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Model is the Schema for the Models API. Provides a Model for a REST API Gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Model struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_requestvalidator_terraformed.go b/apis/apigateway/v1beta1/zz_requestvalidator_terraformed.go new file mode 100755 index 0000000000..aacee31e77 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_requestvalidator_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RequestValidator +func (mg *RequestValidator) GetTerraformResourceType() string { + return "aws_api_gateway_request_validator" +} + +// GetConnectionDetailsMapping for this RequestValidator +func (tr *RequestValidator) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RequestValidator +func (tr *RequestValidator) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RequestValidator +func (tr *RequestValidator) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RequestValidator +func (tr *RequestValidator) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RequestValidator +func (tr *RequestValidator) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RequestValidator +func (tr *RequestValidator) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RequestValidator +func (tr *RequestValidator) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RequestValidator +func (tr *RequestValidator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RequestValidator using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RequestValidator) LateInitialize(attrs []byte) (bool, error) { + params := &RequestValidatorParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RequestValidator) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_requestvalidator_types.go b/apis/apigateway/v1beta1/zz_requestvalidator_types.go index 152af635b0..f012d606d0 100755 --- a/apis/apigateway/v1beta1/zz_requestvalidator_types.go +++ b/apis/apigateway/v1beta1/zz_requestvalidator_types.go @@ -118,13 +118,14 @@ type RequestValidatorStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RequestValidator is the Schema for the RequestValidators API. Manages an API Gateway Request Validator. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RequestValidator struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_resource_terraformed.go b/apis/apigateway/v1beta1/zz_resource_terraformed.go new file mode 100755 index 0000000000..24c0fa5f03 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_resource_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Resource +func (mg *Resource) GetTerraformResourceType() string { + return "aws_api_gateway_resource" +} + +// GetConnectionDetailsMapping for this Resource +func (tr *Resource) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Resource +func (tr *Resource) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Resource +func (tr *Resource) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Resource +func (tr *Resource) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Resource +func (tr *Resource) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Resource +func (tr *Resource) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Resource +func (tr *Resource) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Resource +func (tr *Resource) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Resource using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Resource) LateInitialize(attrs []byte) (bool, error) { + params := &ResourceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Resource) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_resource_types.go b/apis/apigateway/v1beta1/zz_resource_types.go index 48699579e1..74fb873081 100755 --- a/apis/apigateway/v1beta1/zz_resource_types.go +++ b/apis/apigateway/v1beta1/zz_resource_types.go @@ -131,13 +131,14 @@ type ResourceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Resource is the Schema for the Resources API. Provides an API Gateway Resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Resource struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_restapi_terraformed.go b/apis/apigateway/v1beta1/zz_restapi_terraformed.go new file mode 100755 index 0000000000..94fc9a060f --- /dev/null +++ b/apis/apigateway/v1beta1/zz_restapi_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RestAPI +func (mg *RestAPI) GetTerraformResourceType() string { + return "aws_api_gateway_rest_api" +} + +// GetConnectionDetailsMapping for this RestAPI +func (tr *RestAPI) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RestAPI +func (tr *RestAPI) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RestAPI +func (tr *RestAPI) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RestAPI +func (tr *RestAPI) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RestAPI +func (tr *RestAPI) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RestAPI +func (tr *RestAPI) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RestAPI +func (tr *RestAPI) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RestAPI +func (tr *RestAPI) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RestAPI using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RestAPI) LateInitialize(attrs []byte) (bool, error) { + params := &RestAPIParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RestAPI) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_restapi_types.go b/apis/apigateway/v1beta1/zz_restapi_types.go index 52013807b9..15c6436fd5 100755 --- a/apis/apigateway/v1beta1/zz_restapi_types.go +++ b/apis/apigateway/v1beta1/zz_restapi_types.go @@ -237,13 +237,14 @@ type RestAPIStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RestAPI is the Schema for the RestAPIs API. Manages an API Gateway REST API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RestAPI struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_restapipolicy_terraformed.go b/apis/apigateway/v1beta1/zz_restapipolicy_terraformed.go new file mode 100755 index 0000000000..e251a11479 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_restapipolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RestAPIPolicy +func (mg *RestAPIPolicy) GetTerraformResourceType() string { + return "aws_api_gateway_rest_api_policy" +} + +// GetConnectionDetailsMapping for this RestAPIPolicy +func (tr *RestAPIPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RestAPIPolicy +func (tr *RestAPIPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RestAPIPolicy +func (tr *RestAPIPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RestAPIPolicy +func (tr *RestAPIPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RestAPIPolicy +func (tr *RestAPIPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RestAPIPolicy +func (tr *RestAPIPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RestAPIPolicy +func (tr *RestAPIPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RestAPIPolicy +func (tr *RestAPIPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RestAPIPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RestAPIPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &RestAPIPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RestAPIPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_restapipolicy_types.go b/apis/apigateway/v1beta1/zz_restapipolicy_types.go index 34d6a7adef..a3111a99b5 100755 --- a/apis/apigateway/v1beta1/zz_restapipolicy_types.go +++ b/apis/apigateway/v1beta1/zz_restapipolicy_types.go @@ -98,13 +98,14 @@ type RestAPIPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RestAPIPolicy is the Schema for the RestAPIPolicys API. Provides an API Gateway REST API Policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RestAPIPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_stage_terraformed.go b/apis/apigateway/v1beta1/zz_stage_terraformed.go new file mode 100755 index 0000000000..8890d89e64 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_stage_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Stage +func (mg *Stage) GetTerraformResourceType() string { + return "aws_api_gateway_stage" +} + +// GetConnectionDetailsMapping for this Stage +func (tr *Stage) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Stage +func (tr *Stage) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Stage +func (tr *Stage) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Stage +func (tr *Stage) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Stage +func (tr *Stage) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Stage +func (tr *Stage) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Stage +func (tr *Stage) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Stage +func (tr *Stage) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Stage using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Stage) LateInitialize(attrs []byte) (bool, error) { + params := &StageParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Stage) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_stage_types.go b/apis/apigateway/v1beta1/zz_stage_types.go index 9f5e610aaf..f282a22068 100755 --- a/apis/apigateway/v1beta1/zz_stage_types.go +++ b/apis/apigateway/v1beta1/zz_stage_types.go @@ -327,13 +327,14 @@ type StageStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Stage is the Schema for the Stages API. Manages an API Gateway Stage. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Stage struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_usageplan_terraformed.go b/apis/apigateway/v1beta1/zz_usageplan_terraformed.go new file mode 100755 index 0000000000..60c67a2d8d --- /dev/null +++ b/apis/apigateway/v1beta1/zz_usageplan_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UsagePlan +func (mg *UsagePlan) GetTerraformResourceType() string { + return "aws_api_gateway_usage_plan" +} + +// GetConnectionDetailsMapping for this UsagePlan +func (tr *UsagePlan) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UsagePlan +func (tr *UsagePlan) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UsagePlan +func (tr *UsagePlan) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UsagePlan +func (tr *UsagePlan) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UsagePlan +func (tr *UsagePlan) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UsagePlan +func (tr *UsagePlan) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UsagePlan +func (tr *UsagePlan) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UsagePlan +func (tr *UsagePlan) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UsagePlan using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UsagePlan) LateInitialize(attrs []byte) (bool, error) { + params := &UsagePlanParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UsagePlan) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_usageplan_types.go b/apis/apigateway/v1beta1/zz_usageplan_types.go index 5fae999895..34e2997477 100755 --- a/apis/apigateway/v1beta1/zz_usageplan_types.go +++ b/apis/apigateway/v1beta1/zz_usageplan_types.go @@ -324,13 +324,14 @@ type UsagePlanStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UsagePlan is the Schema for the UsagePlans API. Provides an API Gateway Usage Plan. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UsagePlan struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_usageplankey_terraformed.go b/apis/apigateway/v1beta1/zz_usageplankey_terraformed.go new file mode 100755 index 0000000000..97df93f55d --- /dev/null +++ b/apis/apigateway/v1beta1/zz_usageplankey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UsagePlanKey +func (mg *UsagePlanKey) GetTerraformResourceType() string { + return "aws_api_gateway_usage_plan_key" +} + +// GetConnectionDetailsMapping for this UsagePlanKey +func (tr *UsagePlanKey) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UsagePlanKey +func (tr *UsagePlanKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UsagePlanKey +func (tr *UsagePlanKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UsagePlanKey +func (tr *UsagePlanKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UsagePlanKey +func (tr *UsagePlanKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UsagePlanKey +func (tr *UsagePlanKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UsagePlanKey +func (tr *UsagePlanKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UsagePlanKey +func (tr *UsagePlanKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UsagePlanKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UsagePlanKey) LateInitialize(attrs []byte) (bool, error) { + params := &UsagePlanKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UsagePlanKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_usageplankey_types.go b/apis/apigateway/v1beta1/zz_usageplankey_types.go index 454051f79f..92fa331c37 100755 --- a/apis/apigateway/v1beta1/zz_usageplankey_types.go +++ b/apis/apigateway/v1beta1/zz_usageplankey_types.go @@ -134,13 +134,14 @@ type UsagePlanKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UsagePlanKey is the Schema for the UsagePlanKeys API. Provides an API Gateway Usage Plan Key. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UsagePlanKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigateway/v1beta1/zz_vpclink_terraformed.go b/apis/apigateway/v1beta1/zz_vpclink_terraformed.go new file mode 100755 index 0000000000..6e31da55f5 --- /dev/null +++ b/apis/apigateway/v1beta1/zz_vpclink_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCLink +func (mg *VPCLink) GetTerraformResourceType() string { + return "aws_api_gateway_vpc_link" +} + +// GetConnectionDetailsMapping for this VPCLink +func (tr *VPCLink) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCLink +func (tr *VPCLink) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCLink +func (tr *VPCLink) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCLink +func (tr *VPCLink) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCLink +func (tr *VPCLink) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCLink +func (tr *VPCLink) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCLink +func (tr *VPCLink) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCLink +func (tr *VPCLink) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCLink using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCLink) LateInitialize(attrs []byte) (bool, error) { + params := &VPCLinkParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCLink) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigateway/v1beta1/zz_vpclink_types.go b/apis/apigateway/v1beta1/zz_vpclink_types.go index 761a28e14f..b979641f4f 100755 --- a/apis/apigateway/v1beta1/zz_vpclink_types.go +++ b/apis/apigateway/v1beta1/zz_vpclink_types.go @@ -130,13 +130,14 @@ type VPCLinkStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCLink is the Schema for the VPCLinks API. Provides an API Gateway VPC Link. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCLink struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_api_terraformed.go b/apis/apigatewayv2/v1beta1/zz_api_terraformed.go new file mode 100755 index 0000000000..77a57fc667 --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_api_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this API +func (mg *API) GetTerraformResourceType() string { + return "aws_apigatewayv2_api" +} + +// GetConnectionDetailsMapping for this API +func (tr *API) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this API +func (tr *API) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this API +func (tr *API) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this API +func (tr *API) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this API +func (tr *API) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this API +func (tr *API) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this API +func (tr *API) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this API +func (tr *API) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this API using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *API) LateInitialize(attrs []byte) (bool, error) { + params := &APIParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *API) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_api_types.go b/apis/apigatewayv2/v1beta1/zz_api_types.go index 6e4d4b98d7..2b67309393 100755 --- a/apis/apigatewayv2/v1beta1/zz_api_types.go +++ b/apis/apigatewayv2/v1beta1/zz_api_types.go @@ -318,13 +318,14 @@ type APIStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // API is the Schema for the APIs API. Manages an Amazon API Gateway Version 2 API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type API struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_apimapping_terraformed.go b/apis/apigatewayv2/v1beta1/zz_apimapping_terraformed.go new file mode 100755 index 0000000000..2d0ba5660f --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_apimapping_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this APIMapping +func (mg *APIMapping) GetTerraformResourceType() string { + return "aws_apigatewayv2_api_mapping" +} + +// GetConnectionDetailsMapping for this APIMapping +func (tr *APIMapping) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this APIMapping +func (tr *APIMapping) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this APIMapping +func (tr *APIMapping) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this APIMapping +func (tr *APIMapping) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this APIMapping +func (tr *APIMapping) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this APIMapping +func (tr *APIMapping) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this APIMapping +func (tr *APIMapping) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this APIMapping +func (tr *APIMapping) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this APIMapping using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *APIMapping) LateInitialize(attrs []byte) (bool, error) { + params := &APIMappingParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *APIMapping) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_apimapping_types.go b/apis/apigatewayv2/v1beta1/zz_apimapping_types.go index 2f7e5300da..954e372792 100755 --- a/apis/apigatewayv2/v1beta1/zz_apimapping_types.go +++ b/apis/apigatewayv2/v1beta1/zz_apimapping_types.go @@ -154,13 +154,14 @@ type APIMappingStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // APIMapping is the Schema for the APIMappings API. Manages an Amazon API Gateway Version 2 API mapping. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type APIMapping struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_authorizer_terraformed.go b/apis/apigatewayv2/v1beta1/zz_authorizer_terraformed.go new file mode 100755 index 0000000000..1466e3701c --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_authorizer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Authorizer +func (mg *Authorizer) GetTerraformResourceType() string { + return "aws_apigatewayv2_authorizer" +} + +// GetConnectionDetailsMapping for this Authorizer +func (tr *Authorizer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Authorizer +func (tr *Authorizer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Authorizer +func (tr *Authorizer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Authorizer +func (tr *Authorizer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Authorizer +func (tr *Authorizer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Authorizer +func (tr *Authorizer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Authorizer +func (tr *Authorizer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Authorizer +func (tr *Authorizer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Authorizer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Authorizer) LateInitialize(attrs []byte) (bool, error) { + params := &AuthorizerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Authorizer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_authorizer_types.go b/apis/apigatewayv2/v1beta1/zz_authorizer_types.go index 73e5d5177d..d115ed4681 100755 --- a/apis/apigatewayv2/v1beta1/zz_authorizer_types.go +++ b/apis/apigatewayv2/v1beta1/zz_authorizer_types.go @@ -267,13 +267,14 @@ type AuthorizerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Authorizer is the Schema for the Authorizers API. Manages an Amazon API Gateway Version 2 authorizer. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Authorizer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_deployment_terraformed.go b/apis/apigatewayv2/v1beta1/zz_deployment_terraformed.go new file mode 100755 index 0000000000..36bdda933f --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_deployment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Deployment +func (mg *Deployment) GetTerraformResourceType() string { + return "aws_apigatewayv2_deployment" +} + +// GetConnectionDetailsMapping for this Deployment +func (tr *Deployment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Deployment +func (tr *Deployment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Deployment +func (tr *Deployment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Deployment +func (tr *Deployment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Deployment +func (tr *Deployment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Deployment +func (tr *Deployment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Deployment +func (tr *Deployment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Deployment +func (tr *Deployment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Deployment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Deployment) LateInitialize(attrs []byte) (bool, error) { + params := &DeploymentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Deployment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_deployment_types.go b/apis/apigatewayv2/v1beta1/zz_deployment_types.go index 807cf44c5d..5a3b07a64e 100755 --- a/apis/apigatewayv2/v1beta1/zz_deployment_types.go +++ b/apis/apigatewayv2/v1beta1/zz_deployment_types.go @@ -99,13 +99,14 @@ type DeploymentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Deployment is the Schema for the Deployments API. Manages an Amazon API Gateway Version 2 deployment. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Deployment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_domainname_terraformed.go b/apis/apigatewayv2/v1beta1/zz_domainname_terraformed.go new file mode 100755 index 0000000000..b59cfe4d25 --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_domainname_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DomainName +func (mg *DomainName) GetTerraformResourceType() string { + return "aws_apigatewayv2_domain_name" +} + +// GetConnectionDetailsMapping for this DomainName +func (tr *DomainName) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DomainName +func (tr *DomainName) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DomainName +func (tr *DomainName) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DomainName +func (tr *DomainName) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DomainName +func (tr *DomainName) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DomainName +func (tr *DomainName) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DomainName +func (tr *DomainName) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DomainName +func (tr *DomainName) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DomainName using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DomainName) LateInitialize(attrs []byte) (bool, error) { + params := &DomainNameParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DomainName) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_domainname_types.go b/apis/apigatewayv2/v1beta1/zz_domainname_types.go index 2d37d5a533..9163a8a584 100755 --- a/apis/apigatewayv2/v1beta1/zz_domainname_types.go +++ b/apis/apigatewayv2/v1beta1/zz_domainname_types.go @@ -205,13 +205,14 @@ type DomainNameStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DomainName is the Schema for the DomainNames API. Manages an Amazon API Gateway Version 2 domain name. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DomainName struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_generated.conversion_hubs.go b/apis/apigatewayv2/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..0a9d371a84 --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *API) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *APIMapping) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Authorizer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Deployment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DomainName) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Integration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *IntegrationResponse) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Model) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Route) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RouteResponse) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Stage) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCLink) Hub() {} diff --git a/apis/apigatewayv2/v1beta1/zz_generated_terraformed.go b/apis/apigatewayv2/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 8f0b61996c..0000000000 --- a/apis/apigatewayv2/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1387 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this API -func (mg *API) GetTerraformResourceType() string { - return "aws_apigatewayv2_api" -} - -// GetConnectionDetailsMapping for this API -func (tr *API) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this API -func (tr *API) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this API -func (tr *API) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this API -func (tr *API) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this API -func (tr *API) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this API -func (tr *API) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this API -func (tr *API) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this API -func (tr *API) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this API using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *API) LateInitialize(attrs []byte) (bool, error) { - params := &APIParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *API) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this APIMapping -func (mg *APIMapping) GetTerraformResourceType() string { - return "aws_apigatewayv2_api_mapping" -} - -// GetConnectionDetailsMapping for this APIMapping -func (tr *APIMapping) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this APIMapping -func (tr *APIMapping) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this APIMapping -func (tr *APIMapping) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this APIMapping -func (tr *APIMapping) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this APIMapping -func (tr *APIMapping) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this APIMapping -func (tr *APIMapping) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this APIMapping -func (tr *APIMapping) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this APIMapping -func (tr *APIMapping) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this APIMapping using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *APIMapping) LateInitialize(attrs []byte) (bool, error) { - params := &APIMappingParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *APIMapping) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Authorizer -func (mg *Authorizer) GetTerraformResourceType() string { - return "aws_apigatewayv2_authorizer" -} - -// GetConnectionDetailsMapping for this Authorizer -func (tr *Authorizer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Authorizer -func (tr *Authorizer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Authorizer -func (tr *Authorizer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Authorizer -func (tr *Authorizer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Authorizer -func (tr *Authorizer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Authorizer -func (tr *Authorizer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Authorizer -func (tr *Authorizer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Authorizer -func (tr *Authorizer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Authorizer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Authorizer) LateInitialize(attrs []byte) (bool, error) { - params := &AuthorizerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Authorizer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Deployment -func (mg *Deployment) GetTerraformResourceType() string { - return "aws_apigatewayv2_deployment" -} - -// GetConnectionDetailsMapping for this Deployment -func (tr *Deployment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Deployment -func (tr *Deployment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Deployment -func (tr *Deployment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Deployment -func (tr *Deployment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Deployment -func (tr *Deployment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Deployment -func (tr *Deployment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Deployment -func (tr *Deployment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Deployment -func (tr *Deployment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Deployment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Deployment) LateInitialize(attrs []byte) (bool, error) { - params := &DeploymentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Deployment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DomainName -func (mg *DomainName) GetTerraformResourceType() string { - return "aws_apigatewayv2_domain_name" -} - -// GetConnectionDetailsMapping for this DomainName -func (tr *DomainName) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DomainName -func (tr *DomainName) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DomainName -func (tr *DomainName) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DomainName -func (tr *DomainName) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DomainName -func (tr *DomainName) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DomainName -func (tr *DomainName) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DomainName -func (tr *DomainName) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DomainName -func (tr *DomainName) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DomainName using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DomainName) LateInitialize(attrs []byte) (bool, error) { - params := &DomainNameParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DomainName) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Integration -func (mg *Integration) GetTerraformResourceType() string { - return "aws_apigatewayv2_integration" -} - -// GetConnectionDetailsMapping for this Integration -func (tr *Integration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Integration -func (tr *Integration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Integration -func (tr *Integration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Integration -func (tr *Integration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Integration -func (tr *Integration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Integration -func (tr *Integration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Integration -func (tr *Integration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Integration -func (tr *Integration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Integration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Integration) LateInitialize(attrs []byte) (bool, error) { - params := &IntegrationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Integration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this IntegrationResponse -func (mg *IntegrationResponse) GetTerraformResourceType() string { - return "aws_apigatewayv2_integration_response" -} - -// GetConnectionDetailsMapping for this IntegrationResponse -func (tr *IntegrationResponse) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this IntegrationResponse -func (tr *IntegrationResponse) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this IntegrationResponse -func (tr *IntegrationResponse) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this IntegrationResponse -func (tr *IntegrationResponse) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this IntegrationResponse -func (tr *IntegrationResponse) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this IntegrationResponse -func (tr *IntegrationResponse) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this IntegrationResponse -func (tr *IntegrationResponse) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this IntegrationResponse -func (tr *IntegrationResponse) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this IntegrationResponse using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *IntegrationResponse) LateInitialize(attrs []byte) (bool, error) { - params := &IntegrationResponseParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *IntegrationResponse) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Model -func (mg *Model) GetTerraformResourceType() string { - return "aws_apigatewayv2_model" -} - -// GetConnectionDetailsMapping for this Model -func (tr *Model) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Model -func (tr *Model) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Model -func (tr *Model) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Model -func (tr *Model) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Model -func (tr *Model) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Model -func (tr *Model) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Model -func (tr *Model) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Model -func (tr *Model) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Model using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Model) LateInitialize(attrs []byte) (bool, error) { - params := &ModelParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Model) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Route -func (mg *Route) GetTerraformResourceType() string { - return "aws_apigatewayv2_route" -} - -// GetConnectionDetailsMapping for this Route -func (tr *Route) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Route -func (tr *Route) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Route -func (tr *Route) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Route -func (tr *Route) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Route -func (tr *Route) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Route -func (tr *Route) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Route -func (tr *Route) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Route -func (tr *Route) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Route using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Route) LateInitialize(attrs []byte) (bool, error) { - params := &RouteParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Route) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RouteResponse -func (mg *RouteResponse) GetTerraformResourceType() string { - return "aws_apigatewayv2_route_response" -} - -// GetConnectionDetailsMapping for this RouteResponse -func (tr *RouteResponse) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RouteResponse -func (tr *RouteResponse) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RouteResponse -func (tr *RouteResponse) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RouteResponse -func (tr *RouteResponse) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RouteResponse -func (tr *RouteResponse) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RouteResponse -func (tr *RouteResponse) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RouteResponse -func (tr *RouteResponse) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RouteResponse -func (tr *RouteResponse) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RouteResponse using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RouteResponse) LateInitialize(attrs []byte) (bool, error) { - params := &RouteResponseParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RouteResponse) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Stage -func (mg *Stage) GetTerraformResourceType() string { - return "aws_apigatewayv2_stage" -} - -// GetConnectionDetailsMapping for this Stage -func (tr *Stage) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Stage -func (tr *Stage) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Stage -func (tr *Stage) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Stage -func (tr *Stage) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Stage -func (tr *Stage) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Stage -func (tr *Stage) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Stage -func (tr *Stage) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Stage -func (tr *Stage) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Stage using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Stage) LateInitialize(attrs []byte) (bool, error) { - params := &StageParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Stage) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCLink -func (mg *VPCLink) GetTerraformResourceType() string { - return "aws_apigatewayv2_vpc_link" -} - -// GetConnectionDetailsMapping for this VPCLink -func (tr *VPCLink) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCLink -func (tr *VPCLink) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCLink -func (tr *VPCLink) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCLink -func (tr *VPCLink) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCLink -func (tr *VPCLink) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCLink -func (tr *VPCLink) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCLink -func (tr *VPCLink) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCLink -func (tr *VPCLink) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCLink using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCLink) LateInitialize(attrs []byte) (bool, error) { - params := &VPCLinkParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCLink) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/apigatewayv2/v1beta1/zz_integration_terraformed.go b/apis/apigatewayv2/v1beta1/zz_integration_terraformed.go new file mode 100755 index 0000000000..676bb3c326 --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_integration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Integration +func (mg *Integration) GetTerraformResourceType() string { + return "aws_apigatewayv2_integration" +} + +// GetConnectionDetailsMapping for this Integration +func (tr *Integration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Integration +func (tr *Integration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Integration +func (tr *Integration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Integration +func (tr *Integration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Integration +func (tr *Integration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Integration +func (tr *Integration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Integration +func (tr *Integration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Integration +func (tr *Integration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Integration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Integration) LateInitialize(attrs []byte) (bool, error) { + params := &IntegrationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Integration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_integration_types.go b/apis/apigatewayv2/v1beta1/zz_integration_types.go index d440209a25..e3fe907656 100755 --- a/apis/apigatewayv2/v1beta1/zz_integration_types.go +++ b/apis/apigatewayv2/v1beta1/zz_integration_types.go @@ -400,13 +400,14 @@ type IntegrationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Integration is the Schema for the Integrations API. Manages an Amazon API Gateway Version 2 integration. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Integration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_integrationresponse_terraformed.go b/apis/apigatewayv2/v1beta1/zz_integrationresponse_terraformed.go new file mode 100755 index 0000000000..c849a3c8e5 --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_integrationresponse_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this IntegrationResponse +func (mg *IntegrationResponse) GetTerraformResourceType() string { + return "aws_apigatewayv2_integration_response" +} + +// GetConnectionDetailsMapping for this IntegrationResponse +func (tr *IntegrationResponse) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this IntegrationResponse +func (tr *IntegrationResponse) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this IntegrationResponse +func (tr *IntegrationResponse) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this IntegrationResponse +func (tr *IntegrationResponse) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this IntegrationResponse +func (tr *IntegrationResponse) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this IntegrationResponse +func (tr *IntegrationResponse) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this IntegrationResponse +func (tr *IntegrationResponse) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this IntegrationResponse +func (tr *IntegrationResponse) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this IntegrationResponse using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *IntegrationResponse) LateInitialize(attrs []byte) (bool, error) { + params := &IntegrationResponseParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *IntegrationResponse) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_integrationresponse_types.go b/apis/apigatewayv2/v1beta1/zz_integrationresponse_types.go index 474f880705..01ce32fa74 100755 --- a/apis/apigatewayv2/v1beta1/zz_integrationresponse_types.go +++ b/apis/apigatewayv2/v1beta1/zz_integrationresponse_types.go @@ -157,13 +157,14 @@ type IntegrationResponseStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IntegrationResponse is the Schema for the IntegrationResponses API. Manages an Amazon API Gateway Version 2 integration response. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type IntegrationResponse struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_model_terraformed.go b/apis/apigatewayv2/v1beta1/zz_model_terraformed.go new file mode 100755 index 0000000000..7fc4df1faf --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_model_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Model +func (mg *Model) GetTerraformResourceType() string { + return "aws_apigatewayv2_model" +} + +// GetConnectionDetailsMapping for this Model +func (tr *Model) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Model +func (tr *Model) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Model +func (tr *Model) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Model +func (tr *Model) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Model +func (tr *Model) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Model +func (tr *Model) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Model +func (tr *Model) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Model +func (tr *Model) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Model using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Model) LateInitialize(attrs []byte) (bool, error) { + params := &ModelParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Model) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_model_types.go b/apis/apigatewayv2/v1beta1/zz_model_types.go index 2bebf1066d..53cfaa83ef 100755 --- a/apis/apigatewayv2/v1beta1/zz_model_types.go +++ b/apis/apigatewayv2/v1beta1/zz_model_types.go @@ -126,13 +126,14 @@ type ModelStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Model is the Schema for the Models API. Manages an Amazon API Gateway Version 2 model. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Model struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_route_terraformed.go b/apis/apigatewayv2/v1beta1/zz_route_terraformed.go new file mode 100755 index 0000000000..a086f17922 --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_route_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Route +func (mg *Route) GetTerraformResourceType() string { + return "aws_apigatewayv2_route" +} + +// GetConnectionDetailsMapping for this Route +func (tr *Route) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Route +func (tr *Route) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Route +func (tr *Route) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Route +func (tr *Route) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Route +func (tr *Route) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Route +func (tr *Route) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Route +func (tr *Route) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Route +func (tr *Route) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Route using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Route) LateInitialize(attrs []byte) (bool, error) { + params := &RouteParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Route) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_route_types.go b/apis/apigatewayv2/v1beta1/zz_route_types.go index d474f1089e..ef343a4c20 100755 --- a/apis/apigatewayv2/v1beta1/zz_route_types.go +++ b/apis/apigatewayv2/v1beta1/zz_route_types.go @@ -278,13 +278,14 @@ type RouteStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Route is the Schema for the Routes API. Manages an Amazon API Gateway Version 2 route. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Route struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_routeresponse_terraformed.go b/apis/apigatewayv2/v1beta1/zz_routeresponse_terraformed.go new file mode 100755 index 0000000000..8818384d40 --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_routeresponse_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RouteResponse +func (mg *RouteResponse) GetTerraformResourceType() string { + return "aws_apigatewayv2_route_response" +} + +// GetConnectionDetailsMapping for this RouteResponse +func (tr *RouteResponse) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RouteResponse +func (tr *RouteResponse) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RouteResponse +func (tr *RouteResponse) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RouteResponse +func (tr *RouteResponse) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RouteResponse +func (tr *RouteResponse) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RouteResponse +func (tr *RouteResponse) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RouteResponse +func (tr *RouteResponse) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RouteResponse +func (tr *RouteResponse) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RouteResponse using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RouteResponse) LateInitialize(attrs []byte) (bool, error) { + params := &RouteResponseParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RouteResponse) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_routeresponse_types.go b/apis/apigatewayv2/v1beta1/zz_routeresponse_types.go index 195cd861d2..c8e0085d6f 100755 --- a/apis/apigatewayv2/v1beta1/zz_routeresponse_types.go +++ b/apis/apigatewayv2/v1beta1/zz_routeresponse_types.go @@ -147,13 +147,14 @@ type RouteResponseStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RouteResponse is the Schema for the RouteResponses API. Manages an Amazon API Gateway Version 2 route response. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RouteResponse struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_stage_terraformed.go b/apis/apigatewayv2/v1beta1/zz_stage_terraformed.go new file mode 100755 index 0000000000..f533a04289 --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_stage_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Stage +func (mg *Stage) GetTerraformResourceType() string { + return "aws_apigatewayv2_stage" +} + +// GetConnectionDetailsMapping for this Stage +func (tr *Stage) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Stage +func (tr *Stage) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Stage +func (tr *Stage) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Stage +func (tr *Stage) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Stage +func (tr *Stage) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Stage +func (tr *Stage) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Stage +func (tr *Stage) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Stage +func (tr *Stage) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Stage using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Stage) LateInitialize(attrs []byte) (bool, error) { + params := &StageParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Stage) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_stage_types.go b/apis/apigatewayv2/v1beta1/zz_stage_types.go index a8fd48cc4d..963e7fbffd 100755 --- a/apis/apigatewayv2/v1beta1/zz_stage_types.go +++ b/apis/apigatewayv2/v1beta1/zz_stage_types.go @@ -391,13 +391,14 @@ type StageStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Stage is the Schema for the Stages API. Manages an Amazon API Gateway Version 2 stage. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Stage struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apigatewayv2/v1beta1/zz_vpclink_terraformed.go b/apis/apigatewayv2/v1beta1/zz_vpclink_terraformed.go new file mode 100755 index 0000000000..f1b6cb3411 --- /dev/null +++ b/apis/apigatewayv2/v1beta1/zz_vpclink_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCLink +func (mg *VPCLink) GetTerraformResourceType() string { + return "aws_apigatewayv2_vpc_link" +} + +// GetConnectionDetailsMapping for this VPCLink +func (tr *VPCLink) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCLink +func (tr *VPCLink) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCLink +func (tr *VPCLink) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCLink +func (tr *VPCLink) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCLink +func (tr *VPCLink) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCLink +func (tr *VPCLink) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCLink +func (tr *VPCLink) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCLink +func (tr *VPCLink) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCLink using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCLink) LateInitialize(attrs []byte) (bool, error) { + params := &VPCLinkParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCLink) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apigatewayv2/v1beta1/zz_vpclink_types.go b/apis/apigatewayv2/v1beta1/zz_vpclink_types.go index 58c9d7e652..1f4a3f5307 100755 --- a/apis/apigatewayv2/v1beta1/zz_vpclink_types.go +++ b/apis/apigatewayv2/v1beta1/zz_vpclink_types.go @@ -158,13 +158,14 @@ type VPCLinkStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCLink is the Schema for the VPCLinks API. Manages an Amazon API Gateway Version 2 VPC Link. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCLink struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appautoscaling/v1beta1/zz_generated.conversion_hubs.go b/apis/appautoscaling/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..1300070706 --- /dev/null +++ b/apis/appautoscaling/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Policy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ScheduledAction) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Target) Hub() {} diff --git a/apis/appautoscaling/v1beta1/zz_generated_terraformed.go b/apis/appautoscaling/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 425e18a732..0000000000 --- a/apis/appautoscaling/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Policy -func (mg *Policy) GetTerraformResourceType() string { - return "aws_appautoscaling_policy" -} - -// GetConnectionDetailsMapping for this Policy -func (tr *Policy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Policy -func (tr *Policy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Policy -func (tr *Policy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Policy -func (tr *Policy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Policy -func (tr *Policy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Policy -func (tr *Policy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Policy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { - params := &PolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Policy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ScheduledAction -func (mg *ScheduledAction) GetTerraformResourceType() string { - return "aws_appautoscaling_scheduled_action" -} - -// GetConnectionDetailsMapping for this ScheduledAction -func (tr *ScheduledAction) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ScheduledAction -func (tr *ScheduledAction) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ScheduledAction -func (tr *ScheduledAction) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ScheduledAction -func (tr *ScheduledAction) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ScheduledAction -func (tr *ScheduledAction) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ScheduledAction -func (tr *ScheduledAction) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ScheduledAction -func (tr *ScheduledAction) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ScheduledAction -func (tr *ScheduledAction) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ScheduledAction using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ScheduledAction) LateInitialize(attrs []byte) (bool, error) { - params := &ScheduledActionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ScheduledAction) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Target -func (mg *Target) GetTerraformResourceType() string { - return "aws_appautoscaling_target" -} - -// GetConnectionDetailsMapping for this Target -func (tr *Target) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Target -func (tr *Target) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Target -func (tr *Target) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Target -func (tr *Target) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Target -func (tr *Target) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Target -func (tr *Target) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Target -func (tr *Target) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Target -func (tr *Target) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Target using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Target) LateInitialize(attrs []byte) (bool, error) { - params := &TargetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Target) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/appautoscaling/v1beta1/zz_policy_terraformed.go b/apis/appautoscaling/v1beta1/zz_policy_terraformed.go new file mode 100755 index 0000000000..370579c49c --- /dev/null +++ b/apis/appautoscaling/v1beta1/zz_policy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Policy +func (mg *Policy) GetTerraformResourceType() string { + return "aws_appautoscaling_policy" +} + +// GetConnectionDetailsMapping for this Policy +func (tr *Policy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Policy +func (tr *Policy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Policy +func (tr *Policy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Policy +func (tr *Policy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Policy +func (tr *Policy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Policy +func (tr *Policy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Policy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { + params := &PolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Policy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appautoscaling/v1beta1/zz_policy_types.go b/apis/appautoscaling/v1beta1/zz_policy_types.go index af84cbb716..1e6a2d38f1 100755 --- a/apis/appautoscaling/v1beta1/zz_policy_types.go +++ b/apis/appautoscaling/v1beta1/zz_policy_types.go @@ -605,13 +605,14 @@ type PolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Policy is the Schema for the Policys API. Provides an Application AutoScaling Policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Policy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appautoscaling/v1beta1/zz_scheduledaction_terraformed.go b/apis/appautoscaling/v1beta1/zz_scheduledaction_terraformed.go new file mode 100755 index 0000000000..dd7ee9dc00 --- /dev/null +++ b/apis/appautoscaling/v1beta1/zz_scheduledaction_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ScheduledAction +func (mg *ScheduledAction) GetTerraformResourceType() string { + return "aws_appautoscaling_scheduled_action" +} + +// GetConnectionDetailsMapping for this ScheduledAction +func (tr *ScheduledAction) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ScheduledAction +func (tr *ScheduledAction) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ScheduledAction +func (tr *ScheduledAction) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ScheduledAction +func (tr *ScheduledAction) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ScheduledAction +func (tr *ScheduledAction) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ScheduledAction +func (tr *ScheduledAction) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ScheduledAction +func (tr *ScheduledAction) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ScheduledAction +func (tr *ScheduledAction) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ScheduledAction using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ScheduledAction) LateInitialize(attrs []byte) (bool, error) { + params := &ScheduledActionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ScheduledAction) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appautoscaling/v1beta1/zz_scheduledaction_types.go b/apis/appautoscaling/v1beta1/zz_scheduledaction_types.go index 99e35402c8..f1409511a8 100755 --- a/apis/appautoscaling/v1beta1/zz_scheduledaction_types.go +++ b/apis/appautoscaling/v1beta1/zz_scheduledaction_types.go @@ -239,13 +239,14 @@ type ScheduledActionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ScheduledAction is the Schema for the ScheduledActions API. Provides an Application AutoScaling ScheduledAction resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ScheduledAction struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appautoscaling/v1beta1/zz_target_terraformed.go b/apis/appautoscaling/v1beta1/zz_target_terraformed.go new file mode 100755 index 0000000000..04f8a2b39b --- /dev/null +++ b/apis/appautoscaling/v1beta1/zz_target_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Target +func (mg *Target) GetTerraformResourceType() string { + return "aws_appautoscaling_target" +} + +// GetConnectionDetailsMapping for this Target +func (tr *Target) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Target +func (tr *Target) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Target +func (tr *Target) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Target +func (tr *Target) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Target +func (tr *Target) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Target +func (tr *Target) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Target +func (tr *Target) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Target +func (tr *Target) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Target using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Target) LateInitialize(attrs []byte) (bool, error) { + params := &TargetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Target) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appautoscaling/v1beta1/zz_target_types.go b/apis/appautoscaling/v1beta1/zz_target_types.go index 0f1ed233b1..9a789a6860 100755 --- a/apis/appautoscaling/v1beta1/zz_target_types.go +++ b/apis/appautoscaling/v1beta1/zz_target_types.go @@ -157,13 +157,14 @@ type TargetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Target is the Schema for the Targets API. Provides an Application AutoScaling ScalableTarget resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Target struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appconfig/v1beta1/zz_application_terraformed.go b/apis/appconfig/v1beta1/zz_application_terraformed.go new file mode 100755 index 0000000000..933c5df7d8 --- /dev/null +++ b/apis/appconfig/v1beta1/zz_application_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Application +func (mg *Application) GetTerraformResourceType() string { + return "aws_appconfig_application" +} + +// GetConnectionDetailsMapping for this Application +func (tr *Application) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Application +func (tr *Application) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Application +func (tr *Application) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Application +func (tr *Application) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Application +func (tr *Application) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Application +func (tr *Application) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Application +func (tr *Application) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Application +func (tr *Application) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Application using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Application) LateInitialize(attrs []byte) (bool, error) { + params := &ApplicationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Application) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appconfig/v1beta1/zz_application_types.go b/apis/appconfig/v1beta1/zz_application_types.go index b00f5b191c..7626425d45 100755 --- a/apis/appconfig/v1beta1/zz_application_types.go +++ b/apis/appconfig/v1beta1/zz_application_types.go @@ -98,13 +98,14 @@ type ApplicationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Application is the Schema for the Applications API. Provides an AppConfig Application resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Application struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appconfig/v1beta1/zz_configurationprofile_terraformed.go b/apis/appconfig/v1beta1/zz_configurationprofile_terraformed.go new file mode 100755 index 0000000000..f9b82ce086 --- /dev/null +++ b/apis/appconfig/v1beta1/zz_configurationprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConfigurationProfile +func (mg *ConfigurationProfile) GetTerraformResourceType() string { + return "aws_appconfig_configuration_profile" +} + +// GetConnectionDetailsMapping for this ConfigurationProfile +func (tr *ConfigurationProfile) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"validator[*].content": "spec.forProvider.validator[*].contentSecretRef"} +} + +// GetObservation of this ConfigurationProfile +func (tr *ConfigurationProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConfigurationProfile +func (tr *ConfigurationProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConfigurationProfile +func (tr *ConfigurationProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConfigurationProfile +func (tr *ConfigurationProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConfigurationProfile +func (tr *ConfigurationProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConfigurationProfile +func (tr *ConfigurationProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConfigurationProfile +func (tr *ConfigurationProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConfigurationProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConfigurationProfile) LateInitialize(attrs []byte) (bool, error) { + params := &ConfigurationProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConfigurationProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appconfig/v1beta1/zz_configurationprofile_types.go b/apis/appconfig/v1beta1/zz_configurationprofile_types.go index 10b4e8b960..72b5a40406 100755 --- a/apis/appconfig/v1beta1/zz_configurationprofile_types.go +++ b/apis/appconfig/v1beta1/zz_configurationprofile_types.go @@ -214,13 +214,14 @@ type ConfigurationProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConfigurationProfile is the Schema for the ConfigurationProfiles API. Provides an AppConfig Configuration Profile resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConfigurationProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appconfig/v1beta1/zz_deployment_terraformed.go b/apis/appconfig/v1beta1/zz_deployment_terraformed.go new file mode 100755 index 0000000000..003fc631cd --- /dev/null +++ b/apis/appconfig/v1beta1/zz_deployment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Deployment +func (mg *Deployment) GetTerraformResourceType() string { + return "aws_appconfig_deployment" +} + +// GetConnectionDetailsMapping for this Deployment +func (tr *Deployment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Deployment +func (tr *Deployment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Deployment +func (tr *Deployment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Deployment +func (tr *Deployment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Deployment +func (tr *Deployment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Deployment +func (tr *Deployment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Deployment +func (tr *Deployment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Deployment +func (tr *Deployment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Deployment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Deployment) LateInitialize(attrs []byte) (bool, error) { + params := &DeploymentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Deployment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appconfig/v1beta1/zz_deployment_types.go b/apis/appconfig/v1beta1/zz_deployment_types.go index 4b0ee3ba13..1c0bf0dfb9 100755 --- a/apis/appconfig/v1beta1/zz_deployment_types.go +++ b/apis/appconfig/v1beta1/zz_deployment_types.go @@ -244,13 +244,14 @@ type DeploymentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Deployment is the Schema for the Deployments API. Provides an AppConfig Deployment resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Deployment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appconfig/v1beta1/zz_deploymentstrategy_terraformed.go b/apis/appconfig/v1beta1/zz_deploymentstrategy_terraformed.go new file mode 100755 index 0000000000..d064b7229d --- /dev/null +++ b/apis/appconfig/v1beta1/zz_deploymentstrategy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DeploymentStrategy +func (mg *DeploymentStrategy) GetTerraformResourceType() string { + return "aws_appconfig_deployment_strategy" +} + +// GetConnectionDetailsMapping for this DeploymentStrategy +func (tr *DeploymentStrategy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DeploymentStrategy +func (tr *DeploymentStrategy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DeploymentStrategy +func (tr *DeploymentStrategy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DeploymentStrategy +func (tr *DeploymentStrategy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DeploymentStrategy +func (tr *DeploymentStrategy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DeploymentStrategy +func (tr *DeploymentStrategy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DeploymentStrategy +func (tr *DeploymentStrategy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DeploymentStrategy +func (tr *DeploymentStrategy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DeploymentStrategy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DeploymentStrategy) LateInitialize(attrs []byte) (bool, error) { + params := &DeploymentStrategyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DeploymentStrategy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appconfig/v1beta1/zz_deploymentstrategy_types.go b/apis/appconfig/v1beta1/zz_deploymentstrategy_types.go index 9b48fc7364..4653b3c82c 100755 --- a/apis/appconfig/v1beta1/zz_deploymentstrategy_types.go +++ b/apis/appconfig/v1beta1/zz_deploymentstrategy_types.go @@ -148,13 +148,14 @@ type DeploymentStrategyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DeploymentStrategy is the Schema for the DeploymentStrategys API. Provides an AppConfig Deployment Strategy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DeploymentStrategy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appconfig/v1beta1/zz_environment_terraformed.go b/apis/appconfig/v1beta1/zz_environment_terraformed.go new file mode 100755 index 0000000000..7dc67be30c --- /dev/null +++ b/apis/appconfig/v1beta1/zz_environment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Environment +func (mg *Environment) GetTerraformResourceType() string { + return "aws_appconfig_environment" +} + +// GetConnectionDetailsMapping for this Environment +func (tr *Environment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Environment +func (tr *Environment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Environment +func (tr *Environment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Environment +func (tr *Environment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Environment +func (tr *Environment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Environment +func (tr *Environment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Environment +func (tr *Environment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Environment +func (tr *Environment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Environment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Environment) LateInitialize(attrs []byte) (bool, error) { + params := &EnvironmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Environment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appconfig/v1beta1/zz_environment_types.go b/apis/appconfig/v1beta1/zz_environment_types.go index 0ca0fbb740..5ff8c85cb0 100755 --- a/apis/appconfig/v1beta1/zz_environment_types.go +++ b/apis/appconfig/v1beta1/zz_environment_types.go @@ -214,13 +214,14 @@ type EnvironmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Environment is the Schema for the Environments API. Provides an AppConfig Environment resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Environment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appconfig/v1beta1/zz_extension_terraformed.go b/apis/appconfig/v1beta1/zz_extension_terraformed.go new file mode 100755 index 0000000000..04a9498935 --- /dev/null +++ b/apis/appconfig/v1beta1/zz_extension_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Extension +func (mg *Extension) GetTerraformResourceType() string { + return "aws_appconfig_extension" +} + +// GetConnectionDetailsMapping for this Extension +func (tr *Extension) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Extension +func (tr *Extension) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Extension +func (tr *Extension) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Extension +func (tr *Extension) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Extension +func (tr *Extension) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Extension +func (tr *Extension) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Extension +func (tr *Extension) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Extension +func (tr *Extension) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Extension using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Extension) LateInitialize(attrs []byte) (bool, error) { + params := &ExtensionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Extension) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appconfig/v1beta1/zz_extension_types.go b/apis/appconfig/v1beta1/zz_extension_types.go index 8e51a51238..ba781020f4 100755 --- a/apis/appconfig/v1beta1/zz_extension_types.go +++ b/apis/appconfig/v1beta1/zz_extension_types.go @@ -277,13 +277,14 @@ type ExtensionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Extension is the Schema for the Extensions API. Provides an AppConfig Extension resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Extension struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appconfig/v1beta1/zz_extensionassociation_terraformed.go b/apis/appconfig/v1beta1/zz_extensionassociation_terraformed.go new file mode 100755 index 0000000000..b528c98287 --- /dev/null +++ b/apis/appconfig/v1beta1/zz_extensionassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ExtensionAssociation +func (mg *ExtensionAssociation) GetTerraformResourceType() string { + return "aws_appconfig_extension_association" +} + +// GetConnectionDetailsMapping for this ExtensionAssociation +func (tr *ExtensionAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ExtensionAssociation +func (tr *ExtensionAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ExtensionAssociation +func (tr *ExtensionAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ExtensionAssociation +func (tr *ExtensionAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ExtensionAssociation +func (tr *ExtensionAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ExtensionAssociation +func (tr *ExtensionAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ExtensionAssociation +func (tr *ExtensionAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ExtensionAssociation +func (tr *ExtensionAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ExtensionAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ExtensionAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &ExtensionAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ExtensionAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appconfig/v1beta1/zz_extensionassociation_types.go b/apis/appconfig/v1beta1/zz_extensionassociation_types.go index 35220b1efb..f4f012f4cc 100755 --- a/apis/appconfig/v1beta1/zz_extensionassociation_types.go +++ b/apis/appconfig/v1beta1/zz_extensionassociation_types.go @@ -137,13 +137,14 @@ type ExtensionAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ExtensionAssociation is the Schema for the ExtensionAssociations API. Associates an AppConfig Extension with a Resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ExtensionAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appconfig/v1beta1/zz_generated.conversion_hubs.go b/apis/appconfig/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b14abb9838 --- /dev/null +++ b/apis/appconfig/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Application) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ConfigurationProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Deployment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DeploymentStrategy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Environment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Extension) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ExtensionAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HostedConfigurationVersion) Hub() {} diff --git a/apis/appconfig/v1beta1/zz_generated_terraformed.go b/apis/appconfig/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index cbfd9beadb..0000000000 --- a/apis/appconfig/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,931 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Application -func (mg *Application) GetTerraformResourceType() string { - return "aws_appconfig_application" -} - -// GetConnectionDetailsMapping for this Application -func (tr *Application) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Application -func (tr *Application) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Application -func (tr *Application) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Application -func (tr *Application) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Application -func (tr *Application) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Application -func (tr *Application) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Application -func (tr *Application) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Application -func (tr *Application) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Application using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Application) LateInitialize(attrs []byte) (bool, error) { - params := &ApplicationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Application) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ConfigurationProfile -func (mg *ConfigurationProfile) GetTerraformResourceType() string { - return "aws_appconfig_configuration_profile" -} - -// GetConnectionDetailsMapping for this ConfigurationProfile -func (tr *ConfigurationProfile) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"validator[*].content": "spec.forProvider.validator[*].contentSecretRef"} -} - -// GetObservation of this ConfigurationProfile -func (tr *ConfigurationProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConfigurationProfile -func (tr *ConfigurationProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConfigurationProfile -func (tr *ConfigurationProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConfigurationProfile -func (tr *ConfigurationProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConfigurationProfile -func (tr *ConfigurationProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConfigurationProfile -func (tr *ConfigurationProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConfigurationProfile -func (tr *ConfigurationProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConfigurationProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConfigurationProfile) LateInitialize(attrs []byte) (bool, error) { - params := &ConfigurationProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConfigurationProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Deployment -func (mg *Deployment) GetTerraformResourceType() string { - return "aws_appconfig_deployment" -} - -// GetConnectionDetailsMapping for this Deployment -func (tr *Deployment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Deployment -func (tr *Deployment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Deployment -func (tr *Deployment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Deployment -func (tr *Deployment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Deployment -func (tr *Deployment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Deployment -func (tr *Deployment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Deployment -func (tr *Deployment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Deployment -func (tr *Deployment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Deployment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Deployment) LateInitialize(attrs []byte) (bool, error) { - params := &DeploymentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Deployment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DeploymentStrategy -func (mg *DeploymentStrategy) GetTerraformResourceType() string { - return "aws_appconfig_deployment_strategy" -} - -// GetConnectionDetailsMapping for this DeploymentStrategy -func (tr *DeploymentStrategy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DeploymentStrategy -func (tr *DeploymentStrategy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DeploymentStrategy -func (tr *DeploymentStrategy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DeploymentStrategy -func (tr *DeploymentStrategy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DeploymentStrategy -func (tr *DeploymentStrategy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DeploymentStrategy -func (tr *DeploymentStrategy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DeploymentStrategy -func (tr *DeploymentStrategy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DeploymentStrategy -func (tr *DeploymentStrategy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DeploymentStrategy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DeploymentStrategy) LateInitialize(attrs []byte) (bool, error) { - params := &DeploymentStrategyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DeploymentStrategy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Environment -func (mg *Environment) GetTerraformResourceType() string { - return "aws_appconfig_environment" -} - -// GetConnectionDetailsMapping for this Environment -func (tr *Environment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Environment -func (tr *Environment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Environment -func (tr *Environment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Environment -func (tr *Environment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Environment -func (tr *Environment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Environment -func (tr *Environment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Environment -func (tr *Environment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Environment -func (tr *Environment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Environment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Environment) LateInitialize(attrs []byte) (bool, error) { - params := &EnvironmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Environment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Extension -func (mg *Extension) GetTerraformResourceType() string { - return "aws_appconfig_extension" -} - -// GetConnectionDetailsMapping for this Extension -func (tr *Extension) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Extension -func (tr *Extension) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Extension -func (tr *Extension) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Extension -func (tr *Extension) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Extension -func (tr *Extension) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Extension -func (tr *Extension) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Extension -func (tr *Extension) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Extension -func (tr *Extension) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Extension using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Extension) LateInitialize(attrs []byte) (bool, error) { - params := &ExtensionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Extension) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ExtensionAssociation -func (mg *ExtensionAssociation) GetTerraformResourceType() string { - return "aws_appconfig_extension_association" -} - -// GetConnectionDetailsMapping for this ExtensionAssociation -func (tr *ExtensionAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ExtensionAssociation -func (tr *ExtensionAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ExtensionAssociation -func (tr *ExtensionAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ExtensionAssociation -func (tr *ExtensionAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ExtensionAssociation -func (tr *ExtensionAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ExtensionAssociation -func (tr *ExtensionAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ExtensionAssociation -func (tr *ExtensionAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ExtensionAssociation -func (tr *ExtensionAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ExtensionAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ExtensionAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &ExtensionAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ExtensionAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HostedConfigurationVersion -func (mg *HostedConfigurationVersion) GetTerraformResourceType() string { - return "aws_appconfig_hosted_configuration_version" -} - -// GetConnectionDetailsMapping for this HostedConfigurationVersion -func (tr *HostedConfigurationVersion) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"content": "spec.forProvider.contentSecretRef"} -} - -// GetObservation of this HostedConfigurationVersion -func (tr *HostedConfigurationVersion) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HostedConfigurationVersion -func (tr *HostedConfigurationVersion) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HostedConfigurationVersion -func (tr *HostedConfigurationVersion) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HostedConfigurationVersion -func (tr *HostedConfigurationVersion) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HostedConfigurationVersion -func (tr *HostedConfigurationVersion) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HostedConfigurationVersion -func (tr *HostedConfigurationVersion) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HostedConfigurationVersion -func (tr *HostedConfigurationVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HostedConfigurationVersion using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HostedConfigurationVersion) LateInitialize(attrs []byte) (bool, error) { - params := &HostedConfigurationVersionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HostedConfigurationVersion) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/appconfig/v1beta1/zz_hostedconfigurationversion_terraformed.go b/apis/appconfig/v1beta1/zz_hostedconfigurationversion_terraformed.go new file mode 100755 index 0000000000..77ec978c18 --- /dev/null +++ b/apis/appconfig/v1beta1/zz_hostedconfigurationversion_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HostedConfigurationVersion +func (mg *HostedConfigurationVersion) GetTerraformResourceType() string { + return "aws_appconfig_hosted_configuration_version" +} + +// GetConnectionDetailsMapping for this HostedConfigurationVersion +func (tr *HostedConfigurationVersion) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"content": "spec.forProvider.contentSecretRef"} +} + +// GetObservation of this HostedConfigurationVersion +func (tr *HostedConfigurationVersion) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HostedConfigurationVersion +func (tr *HostedConfigurationVersion) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HostedConfigurationVersion +func (tr *HostedConfigurationVersion) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HostedConfigurationVersion +func (tr *HostedConfigurationVersion) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HostedConfigurationVersion +func (tr *HostedConfigurationVersion) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HostedConfigurationVersion +func (tr *HostedConfigurationVersion) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HostedConfigurationVersion +func (tr *HostedConfigurationVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HostedConfigurationVersion using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HostedConfigurationVersion) LateInitialize(attrs []byte) (bool, error) { + params := &HostedConfigurationVersionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HostedConfigurationVersion) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appconfig/v1beta1/zz_hostedconfigurationversion_types.go b/apis/appconfig/v1beta1/zz_hostedconfigurationversion_types.go index 21de36dea7..abe0b32771 100755 --- a/apis/appconfig/v1beta1/zz_hostedconfigurationversion_types.go +++ b/apis/appconfig/v1beta1/zz_hostedconfigurationversion_types.go @@ -148,13 +148,14 @@ type HostedConfigurationVersionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HostedConfigurationVersion is the Schema for the HostedConfigurationVersions API. Provides an AppConfig Hosted Configuration Version resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HostedConfigurationVersion struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appflow/v1beta1/zz_generated_terraformed.go b/apis/appflow/v1beta1/zz_flow_terraformed.go similarity index 100% rename from apis/appflow/v1beta1/zz_generated_terraformed.go rename to apis/appflow/v1beta1/zz_flow_terraformed.go diff --git a/apis/appflow/v1beta1/zz_flow_types.go b/apis/appflow/v1beta1/zz_flow_types.go index f75fe66870..b45ebec8eb 100755 --- a/apis/appflow/v1beta1/zz_flow_types.go +++ b/apis/appflow/v1beta1/zz_flow_types.go @@ -2462,13 +2462,14 @@ type FlowStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Flow is the Schema for the Flows API. Provides an AppFlow Flow resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Flow struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appflow/v1beta1/zz_generated.conversion_hubs.go b/apis/appflow/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..eb60dbeaf7 --- /dev/null +++ b/apis/appflow/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Flow) Hub() {} diff --git a/apis/appintegrations/v1beta1/zz_generated_terraformed.go b/apis/appintegrations/v1beta1/zz_eventintegration_terraformed.go similarity index 100% rename from apis/appintegrations/v1beta1/zz_generated_terraformed.go rename to apis/appintegrations/v1beta1/zz_eventintegration_terraformed.go diff --git a/apis/appintegrations/v1beta1/zz_eventintegration_types.go b/apis/appintegrations/v1beta1/zz_eventintegration_types.go index d3e6b2c8cb..5b254d7ae1 100755 --- a/apis/appintegrations/v1beta1/zz_eventintegration_types.go +++ b/apis/appintegrations/v1beta1/zz_eventintegration_types.go @@ -127,13 +127,14 @@ type EventIntegrationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EventIntegration is the Schema for the EventIntegrations API. Provides details about a specific Amazon AppIntegrations Event Integration // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EventIntegration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appintegrations/v1beta1/zz_generated.conversion_hubs.go b/apis/appintegrations/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..634cff502b --- /dev/null +++ b/apis/appintegrations/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *EventIntegration) Hub() {} diff --git a/apis/applicationinsights/v1beta1/zz_generated_terraformed.go b/apis/applicationinsights/v1beta1/zz_application_terraformed.go similarity index 100% rename from apis/applicationinsights/v1beta1/zz_generated_terraformed.go rename to apis/applicationinsights/v1beta1/zz_application_terraformed.go diff --git a/apis/applicationinsights/v1beta1/zz_application_types.go b/apis/applicationinsights/v1beta1/zz_application_types.go index aef3a59d0d..c9729e677a 100755 --- a/apis/applicationinsights/v1beta1/zz_application_types.go +++ b/apis/applicationinsights/v1beta1/zz_application_types.go @@ -138,13 +138,14 @@ type ApplicationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Application is the Schema for the Applications API. Provides a CloudWatch Application Insights Application resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Application struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/applicationinsights/v1beta1/zz_generated.conversion_hubs.go b/apis/applicationinsights/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..dfc9ca8265 --- /dev/null +++ b/apis/applicationinsights/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Application) Hub() {} diff --git a/apis/appmesh/v1beta1/zz_gatewayroute_terraformed.go b/apis/appmesh/v1beta1/zz_gatewayroute_terraformed.go new file mode 100755 index 0000000000..90d83d99d7 --- /dev/null +++ b/apis/appmesh/v1beta1/zz_gatewayroute_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GatewayRoute +func (mg *GatewayRoute) GetTerraformResourceType() string { + return "aws_appmesh_gateway_route" +} + +// GetConnectionDetailsMapping for this GatewayRoute +func (tr *GatewayRoute) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GatewayRoute +func (tr *GatewayRoute) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GatewayRoute +func (tr *GatewayRoute) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GatewayRoute +func (tr *GatewayRoute) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GatewayRoute +func (tr *GatewayRoute) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GatewayRoute +func (tr *GatewayRoute) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GatewayRoute +func (tr *GatewayRoute) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GatewayRoute +func (tr *GatewayRoute) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GatewayRoute using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GatewayRoute) LateInitialize(attrs []byte) (bool, error) { + params := &GatewayRouteParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GatewayRoute) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appmesh/v1beta1/zz_gatewayroute_types.go b/apis/appmesh/v1beta1/zz_gatewayroute_types.go index 8e7aace058..9cb8964bc6 100755 --- a/apis/appmesh/v1beta1/zz_gatewayroute_types.go +++ b/apis/appmesh/v1beta1/zz_gatewayroute_types.go @@ -1321,13 +1321,14 @@ type GatewayRouteStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GatewayRoute is the Schema for the GatewayRoutes API. Provides an AWS App Mesh gateway route resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GatewayRoute struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appmesh/v1beta1/zz_generated.conversion_hubs.go b/apis/appmesh/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..5e13945da3 --- /dev/null +++ b/apis/appmesh/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *GatewayRoute) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Mesh) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Route) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VirtualGateway) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VirtualNode) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VirtualRouter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VirtualService) Hub() {} diff --git a/apis/appmesh/v1beta1/zz_generated_terraformed.go b/apis/appmesh/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 9b31a777ef..0000000000 --- a/apis/appmesh/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,817 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this GatewayRoute -func (mg *GatewayRoute) GetTerraformResourceType() string { - return "aws_appmesh_gateway_route" -} - -// GetConnectionDetailsMapping for this GatewayRoute -func (tr *GatewayRoute) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GatewayRoute -func (tr *GatewayRoute) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GatewayRoute -func (tr *GatewayRoute) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GatewayRoute -func (tr *GatewayRoute) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GatewayRoute -func (tr *GatewayRoute) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GatewayRoute -func (tr *GatewayRoute) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GatewayRoute -func (tr *GatewayRoute) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GatewayRoute -func (tr *GatewayRoute) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GatewayRoute using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GatewayRoute) LateInitialize(attrs []byte) (bool, error) { - params := &GatewayRouteParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GatewayRoute) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Mesh -func (mg *Mesh) GetTerraformResourceType() string { - return "aws_appmesh_mesh" -} - -// GetConnectionDetailsMapping for this Mesh -func (tr *Mesh) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Mesh -func (tr *Mesh) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Mesh -func (tr *Mesh) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Mesh -func (tr *Mesh) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Mesh -func (tr *Mesh) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Mesh -func (tr *Mesh) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Mesh -func (tr *Mesh) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Mesh -func (tr *Mesh) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Mesh using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Mesh) LateInitialize(attrs []byte) (bool, error) { - params := &MeshParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Mesh) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Route -func (mg *Route) GetTerraformResourceType() string { - return "aws_appmesh_route" -} - -// GetConnectionDetailsMapping for this Route -func (tr *Route) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Route -func (tr *Route) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Route -func (tr *Route) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Route -func (tr *Route) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Route -func (tr *Route) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Route -func (tr *Route) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Route -func (tr *Route) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Route -func (tr *Route) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Route using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Route) LateInitialize(attrs []byte) (bool, error) { - params := &RouteParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Route) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VirtualGateway -func (mg *VirtualGateway) GetTerraformResourceType() string { - return "aws_appmesh_virtual_gateway" -} - -// GetConnectionDetailsMapping for this VirtualGateway -func (tr *VirtualGateway) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VirtualGateway -func (tr *VirtualGateway) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VirtualGateway -func (tr *VirtualGateway) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VirtualGateway -func (tr *VirtualGateway) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VirtualGateway -func (tr *VirtualGateway) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VirtualGateway -func (tr *VirtualGateway) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VirtualGateway -func (tr *VirtualGateway) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VirtualGateway -func (tr *VirtualGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VirtualGateway using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VirtualGateway) LateInitialize(attrs []byte) (bool, error) { - params := &VirtualGatewayParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VirtualGateway) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VirtualNode -func (mg *VirtualNode) GetTerraformResourceType() string { - return "aws_appmesh_virtual_node" -} - -// GetConnectionDetailsMapping for this VirtualNode -func (tr *VirtualNode) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VirtualNode -func (tr *VirtualNode) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VirtualNode -func (tr *VirtualNode) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VirtualNode -func (tr *VirtualNode) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VirtualNode -func (tr *VirtualNode) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VirtualNode -func (tr *VirtualNode) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VirtualNode -func (tr *VirtualNode) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VirtualNode -func (tr *VirtualNode) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VirtualNode using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VirtualNode) LateInitialize(attrs []byte) (bool, error) { - params := &VirtualNodeParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VirtualNode) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this VirtualRouter -func (mg *VirtualRouter) GetTerraformResourceType() string { - return "aws_appmesh_virtual_router" -} - -// GetConnectionDetailsMapping for this VirtualRouter -func (tr *VirtualRouter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VirtualRouter -func (tr *VirtualRouter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VirtualRouter -func (tr *VirtualRouter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VirtualRouter -func (tr *VirtualRouter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VirtualRouter -func (tr *VirtualRouter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VirtualRouter -func (tr *VirtualRouter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VirtualRouter -func (tr *VirtualRouter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VirtualRouter -func (tr *VirtualRouter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VirtualRouter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VirtualRouter) LateInitialize(attrs []byte) (bool, error) { - params := &VirtualRouterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VirtualRouter) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this VirtualService -func (mg *VirtualService) GetTerraformResourceType() string { - return "aws_appmesh_virtual_service" -} - -// GetConnectionDetailsMapping for this VirtualService -func (tr *VirtualService) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VirtualService -func (tr *VirtualService) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VirtualService -func (tr *VirtualService) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VirtualService -func (tr *VirtualService) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VirtualService -func (tr *VirtualService) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VirtualService -func (tr *VirtualService) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VirtualService -func (tr *VirtualService) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VirtualService -func (tr *VirtualService) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VirtualService using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VirtualService) LateInitialize(attrs []byte) (bool, error) { - params := &VirtualServiceParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VirtualService) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/appmesh/v1beta1/zz_mesh_terraformed.go b/apis/appmesh/v1beta1/zz_mesh_terraformed.go new file mode 100755 index 0000000000..1f4b914c42 --- /dev/null +++ b/apis/appmesh/v1beta1/zz_mesh_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Mesh +func (mg *Mesh) GetTerraformResourceType() string { + return "aws_appmesh_mesh" +} + +// GetConnectionDetailsMapping for this Mesh +func (tr *Mesh) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Mesh +func (tr *Mesh) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Mesh +func (tr *Mesh) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Mesh +func (tr *Mesh) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Mesh +func (tr *Mesh) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Mesh +func (tr *Mesh) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Mesh +func (tr *Mesh) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Mesh +func (tr *Mesh) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Mesh using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Mesh) LateInitialize(attrs []byte) (bool, error) { + params := &MeshParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Mesh) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appmesh/v1beta1/zz_mesh_types.go b/apis/appmesh/v1beta1/zz_mesh_types.go index d3b0b99aa7..102ef407d7 100755 --- a/apis/appmesh/v1beta1/zz_mesh_types.go +++ b/apis/appmesh/v1beta1/zz_mesh_types.go @@ -141,13 +141,14 @@ type MeshStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Mesh is the Schema for the Meshs API. Provides an AWS App Mesh service mesh resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Mesh struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appmesh/v1beta1/zz_route_terraformed.go b/apis/appmesh/v1beta1/zz_route_terraformed.go new file mode 100755 index 0000000000..71523aa73c --- /dev/null +++ b/apis/appmesh/v1beta1/zz_route_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Route +func (mg *Route) GetTerraformResourceType() string { + return "aws_appmesh_route" +} + +// GetConnectionDetailsMapping for this Route +func (tr *Route) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Route +func (tr *Route) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Route +func (tr *Route) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Route +func (tr *Route) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Route +func (tr *Route) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Route +func (tr *Route) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Route +func (tr *Route) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Route +func (tr *Route) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Route using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Route) LateInitialize(attrs []byte) (bool, error) { + params := &RouteParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Route) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appmesh/v1beta1/zz_route_types.go b/apis/appmesh/v1beta1/zz_route_types.go index bcb8c7d823..534ad69396 100755 --- a/apis/appmesh/v1beta1/zz_route_types.go +++ b/apis/appmesh/v1beta1/zz_route_types.go @@ -2066,13 +2066,14 @@ type RouteStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Route is the Schema for the Routes API. Provides an AWS App Mesh route resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Route struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appmesh/v1beta1/zz_virtualgateway_terraformed.go b/apis/appmesh/v1beta1/zz_virtualgateway_terraformed.go new file mode 100755 index 0000000000..9513097a0f --- /dev/null +++ b/apis/appmesh/v1beta1/zz_virtualgateway_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VirtualGateway +func (mg *VirtualGateway) GetTerraformResourceType() string { + return "aws_appmesh_virtual_gateway" +} + +// GetConnectionDetailsMapping for this VirtualGateway +func (tr *VirtualGateway) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VirtualGateway +func (tr *VirtualGateway) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VirtualGateway +func (tr *VirtualGateway) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VirtualGateway +func (tr *VirtualGateway) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VirtualGateway +func (tr *VirtualGateway) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VirtualGateway +func (tr *VirtualGateway) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VirtualGateway +func (tr *VirtualGateway) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VirtualGateway +func (tr *VirtualGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VirtualGateway using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VirtualGateway) LateInitialize(attrs []byte) (bool, error) { + params := &VirtualGatewayParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VirtualGateway) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appmesh/v1beta1/zz_virtualgateway_types.go b/apis/appmesh/v1beta1/zz_virtualgateway_types.go index 2cc005e866..a40abe0af3 100755 --- a/apis/appmesh/v1beta1/zz_virtualgateway_types.go +++ b/apis/appmesh/v1beta1/zz_virtualgateway_types.go @@ -1192,13 +1192,14 @@ type VirtualGatewayStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VirtualGateway is the Schema for the VirtualGateways API. Provides an AWS App Mesh virtual gateway resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VirtualGateway struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appmesh/v1beta1/zz_virtualnode_terraformed.go b/apis/appmesh/v1beta1/zz_virtualnode_terraformed.go new file mode 100755 index 0000000000..32f1c4fea1 --- /dev/null +++ b/apis/appmesh/v1beta1/zz_virtualnode_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VirtualNode +func (mg *VirtualNode) GetTerraformResourceType() string { + return "aws_appmesh_virtual_node" +} + +// GetConnectionDetailsMapping for this VirtualNode +func (tr *VirtualNode) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VirtualNode +func (tr *VirtualNode) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VirtualNode +func (tr *VirtualNode) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VirtualNode +func (tr *VirtualNode) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VirtualNode +func (tr *VirtualNode) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VirtualNode +func (tr *VirtualNode) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VirtualNode +func (tr *VirtualNode) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VirtualNode +func (tr *VirtualNode) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VirtualNode using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VirtualNode) LateInitialize(attrs []byte) (bool, error) { + params := &VirtualNodeParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VirtualNode) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/appmesh/v1beta1/zz_virtualnode_types.go b/apis/appmesh/v1beta1/zz_virtualnode_types.go index 63b7db54cb..986a7a9b6e 100755 --- a/apis/appmesh/v1beta1/zz_virtualnode_types.go +++ b/apis/appmesh/v1beta1/zz_virtualnode_types.go @@ -2227,13 +2227,14 @@ type VirtualNodeStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VirtualNode is the Schema for the VirtualNodes API. Provides an AWS App Mesh virtual node resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VirtualNode struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appmesh/v1beta1/zz_virtualrouter_terraformed.go b/apis/appmesh/v1beta1/zz_virtualrouter_terraformed.go new file mode 100755 index 0000000000..93adfed1c2 --- /dev/null +++ b/apis/appmesh/v1beta1/zz_virtualrouter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VirtualRouter +func (mg *VirtualRouter) GetTerraformResourceType() string { + return "aws_appmesh_virtual_router" +} + +// GetConnectionDetailsMapping for this VirtualRouter +func (tr *VirtualRouter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VirtualRouter +func (tr *VirtualRouter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VirtualRouter +func (tr *VirtualRouter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VirtualRouter +func (tr *VirtualRouter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VirtualRouter +func (tr *VirtualRouter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VirtualRouter +func (tr *VirtualRouter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VirtualRouter +func (tr *VirtualRouter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VirtualRouter +func (tr *VirtualRouter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VirtualRouter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VirtualRouter) LateInitialize(attrs []byte) (bool, error) { + params := &VirtualRouterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VirtualRouter) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/appmesh/v1beta1/zz_virtualrouter_types.go b/apis/appmesh/v1beta1/zz_virtualrouter_types.go index 83172ffe3b..96fa96ef1b 100755 --- a/apis/appmesh/v1beta1/zz_virtualrouter_types.go +++ b/apis/appmesh/v1beta1/zz_virtualrouter_types.go @@ -214,13 +214,14 @@ type VirtualRouterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VirtualRouter is the Schema for the VirtualRouters API. Provides an AWS App Mesh virtual router resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VirtualRouter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appmesh/v1beta1/zz_virtualservice_terraformed.go b/apis/appmesh/v1beta1/zz_virtualservice_terraformed.go new file mode 100755 index 0000000000..3d8355e462 --- /dev/null +++ b/apis/appmesh/v1beta1/zz_virtualservice_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VirtualService +func (mg *VirtualService) GetTerraformResourceType() string { + return "aws_appmesh_virtual_service" +} + +// GetConnectionDetailsMapping for this VirtualService +func (tr *VirtualService) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VirtualService +func (tr *VirtualService) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VirtualService +func (tr *VirtualService) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VirtualService +func (tr *VirtualService) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VirtualService +func (tr *VirtualService) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VirtualService +func (tr *VirtualService) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VirtualService +func (tr *VirtualService) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VirtualService +func (tr *VirtualService) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VirtualService using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VirtualService) LateInitialize(attrs []byte) (bool, error) { + params := &VirtualServiceParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VirtualService) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appmesh/v1beta1/zz_virtualservice_types.go b/apis/appmesh/v1beta1/zz_virtualservice_types.go index f98019b4cd..25d4e0d559 100755 --- a/apis/appmesh/v1beta1/zz_virtualservice_types.go +++ b/apis/appmesh/v1beta1/zz_virtualservice_types.go @@ -273,13 +273,14 @@ type VirtualServiceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VirtualService is the Schema for the VirtualServices API. Provides an AWS App Mesh virtual service resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VirtualService struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apprunner/v1beta1/zz_autoscalingconfigurationversion_terraformed.go b/apis/apprunner/v1beta1/zz_autoscalingconfigurationversion_terraformed.go new file mode 100755 index 0000000000..cf0fcb0f40 --- /dev/null +++ b/apis/apprunner/v1beta1/zz_autoscalingconfigurationversion_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AutoScalingConfigurationVersion +func (mg *AutoScalingConfigurationVersion) GetTerraformResourceType() string { + return "aws_apprunner_auto_scaling_configuration_version" +} + +// GetConnectionDetailsMapping for this AutoScalingConfigurationVersion +func (tr *AutoScalingConfigurationVersion) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AutoScalingConfigurationVersion +func (tr *AutoScalingConfigurationVersion) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AutoScalingConfigurationVersion +func (tr *AutoScalingConfigurationVersion) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AutoScalingConfigurationVersion +func (tr *AutoScalingConfigurationVersion) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AutoScalingConfigurationVersion +func (tr *AutoScalingConfigurationVersion) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AutoScalingConfigurationVersion +func (tr *AutoScalingConfigurationVersion) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AutoScalingConfigurationVersion +func (tr *AutoScalingConfigurationVersion) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AutoScalingConfigurationVersion +func (tr *AutoScalingConfigurationVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AutoScalingConfigurationVersion using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AutoScalingConfigurationVersion) LateInitialize(attrs []byte) (bool, error) { + params := &AutoScalingConfigurationVersionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AutoScalingConfigurationVersion) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apprunner/v1beta1/zz_autoscalingconfigurationversion_types.go b/apis/apprunner/v1beta1/zz_autoscalingconfigurationversion_types.go index 97ec8e56f1..b62b8b1cf6 100755 --- a/apis/apprunner/v1beta1/zz_autoscalingconfigurationversion_types.go +++ b/apis/apprunner/v1beta1/zz_autoscalingconfigurationversion_types.go @@ -126,13 +126,14 @@ type AutoScalingConfigurationVersionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AutoScalingConfigurationVersion is the Schema for the AutoScalingConfigurationVersions API. Manages an App Runner AutoScaling Configuration Version. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AutoScalingConfigurationVersion struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apprunner/v1beta1/zz_connection_terraformed.go b/apis/apprunner/v1beta1/zz_connection_terraformed.go new file mode 100755 index 0000000000..79f9f5ab95 --- /dev/null +++ b/apis/apprunner/v1beta1/zz_connection_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Connection +func (mg *Connection) GetTerraformResourceType() string { + return "aws_apprunner_connection" +} + +// GetConnectionDetailsMapping for this Connection +func (tr *Connection) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Connection +func (tr *Connection) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Connection +func (tr *Connection) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Connection +func (tr *Connection) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Connection +func (tr *Connection) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Connection +func (tr *Connection) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Connection +func (tr *Connection) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Connection +func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Connection using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { + params := &ConnectionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Connection) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apprunner/v1beta1/zz_connection_types.go b/apis/apprunner/v1beta1/zz_connection_types.go index 6540a0e12a..cd9392c2ca 100755 --- a/apis/apprunner/v1beta1/zz_connection_types.go +++ b/apis/apprunner/v1beta1/zz_connection_types.go @@ -90,13 +90,14 @@ type ConnectionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Connection is the Schema for the Connections API. Manages an App Runner Connection. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Connection struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apprunner/v1beta1/zz_generated.conversion_hubs.go b/apis/apprunner/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..65da7ed300 --- /dev/null +++ b/apis/apprunner/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AutoScalingConfigurationVersion) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Connection) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ObservabilityConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Service) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCConnector) Hub() {} diff --git a/apis/apprunner/v1beta1/zz_generated_terraformed.go b/apis/apprunner/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index f55ad94660..0000000000 --- a/apis/apprunner/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,589 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AutoScalingConfigurationVersion -func (mg *AutoScalingConfigurationVersion) GetTerraformResourceType() string { - return "aws_apprunner_auto_scaling_configuration_version" -} - -// GetConnectionDetailsMapping for this AutoScalingConfigurationVersion -func (tr *AutoScalingConfigurationVersion) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AutoScalingConfigurationVersion -func (tr *AutoScalingConfigurationVersion) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AutoScalingConfigurationVersion -func (tr *AutoScalingConfigurationVersion) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AutoScalingConfigurationVersion -func (tr *AutoScalingConfigurationVersion) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AutoScalingConfigurationVersion -func (tr *AutoScalingConfigurationVersion) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AutoScalingConfigurationVersion -func (tr *AutoScalingConfigurationVersion) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AutoScalingConfigurationVersion -func (tr *AutoScalingConfigurationVersion) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AutoScalingConfigurationVersion -func (tr *AutoScalingConfigurationVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AutoScalingConfigurationVersion using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AutoScalingConfigurationVersion) LateInitialize(attrs []byte) (bool, error) { - params := &AutoScalingConfigurationVersionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AutoScalingConfigurationVersion) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Connection -func (mg *Connection) GetTerraformResourceType() string { - return "aws_apprunner_connection" -} - -// GetConnectionDetailsMapping for this Connection -func (tr *Connection) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Connection -func (tr *Connection) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Connection -func (tr *Connection) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Connection -func (tr *Connection) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Connection -func (tr *Connection) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Connection -func (tr *Connection) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Connection -func (tr *Connection) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Connection -func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Connection using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { - params := &ConnectionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Connection) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ObservabilityConfiguration -func (mg *ObservabilityConfiguration) GetTerraformResourceType() string { - return "aws_apprunner_observability_configuration" -} - -// GetConnectionDetailsMapping for this ObservabilityConfiguration -func (tr *ObservabilityConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ObservabilityConfiguration -func (tr *ObservabilityConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ObservabilityConfiguration -func (tr *ObservabilityConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ObservabilityConfiguration -func (tr *ObservabilityConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ObservabilityConfiguration -func (tr *ObservabilityConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ObservabilityConfiguration -func (tr *ObservabilityConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ObservabilityConfiguration -func (tr *ObservabilityConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ObservabilityConfiguration -func (tr *ObservabilityConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ObservabilityConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ObservabilityConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &ObservabilityConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ObservabilityConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Service -func (mg *Service) GetTerraformResourceType() string { - return "aws_apprunner_service" -} - -// GetConnectionDetailsMapping for this Service -func (tr *Service) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Service -func (tr *Service) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Service -func (tr *Service) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Service -func (tr *Service) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Service -func (tr *Service) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Service -func (tr *Service) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Service -func (tr *Service) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Service -func (tr *Service) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Service using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Service) LateInitialize(attrs []byte) (bool, error) { - params := &ServiceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Service) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCConnector -func (mg *VPCConnector) GetTerraformResourceType() string { - return "aws_apprunner_vpc_connector" -} - -// GetConnectionDetailsMapping for this VPCConnector -func (tr *VPCConnector) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCConnector -func (tr *VPCConnector) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCConnector -func (tr *VPCConnector) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCConnector -func (tr *VPCConnector) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCConnector -func (tr *VPCConnector) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCConnector -func (tr *VPCConnector) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCConnector -func (tr *VPCConnector) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCConnector -func (tr *VPCConnector) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCConnector using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCConnector) LateInitialize(attrs []byte) (bool, error) { - params := &VPCConnectorParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCConnector) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/apprunner/v1beta1/zz_observabilityconfiguration_terraformed.go b/apis/apprunner/v1beta1/zz_observabilityconfiguration_terraformed.go new file mode 100755 index 0000000000..1726007173 --- /dev/null +++ b/apis/apprunner/v1beta1/zz_observabilityconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ObservabilityConfiguration +func (mg *ObservabilityConfiguration) GetTerraformResourceType() string { + return "aws_apprunner_observability_configuration" +} + +// GetConnectionDetailsMapping for this ObservabilityConfiguration +func (tr *ObservabilityConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ObservabilityConfiguration +func (tr *ObservabilityConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ObservabilityConfiguration +func (tr *ObservabilityConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ObservabilityConfiguration +func (tr *ObservabilityConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ObservabilityConfiguration +func (tr *ObservabilityConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ObservabilityConfiguration +func (tr *ObservabilityConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ObservabilityConfiguration +func (tr *ObservabilityConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ObservabilityConfiguration +func (tr *ObservabilityConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ObservabilityConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ObservabilityConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &ObservabilityConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ObservabilityConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apprunner/v1beta1/zz_observabilityconfiguration_types.go b/apis/apprunner/v1beta1/zz_observabilityconfiguration_types.go index e5f4f846c9..0b77799d20 100755 --- a/apis/apprunner/v1beta1/zz_observabilityconfiguration_types.go +++ b/apis/apprunner/v1beta1/zz_observabilityconfiguration_types.go @@ -125,13 +125,14 @@ type ObservabilityConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ObservabilityConfiguration is the Schema for the ObservabilityConfigurations API. Manages an App Runner Observability Configuration. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ObservabilityConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apprunner/v1beta1/zz_service_terraformed.go b/apis/apprunner/v1beta1/zz_service_terraformed.go new file mode 100755 index 0000000000..e22f31a0d5 --- /dev/null +++ b/apis/apprunner/v1beta1/zz_service_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Service +func (mg *Service) GetTerraformResourceType() string { + return "aws_apprunner_service" +} + +// GetConnectionDetailsMapping for this Service +func (tr *Service) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Service +func (tr *Service) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Service +func (tr *Service) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Service +func (tr *Service) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Service +func (tr *Service) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Service +func (tr *Service) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Service +func (tr *Service) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Service +func (tr *Service) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Service using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Service) LateInitialize(attrs []byte) (bool, error) { + params := &ServiceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Service) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apprunner/v1beta1/zz_service_types.go b/apis/apprunner/v1beta1/zz_service_types.go index f6ee8336c2..e6b549f159 100755 --- a/apis/apprunner/v1beta1/zz_service_types.go +++ b/apis/apprunner/v1beta1/zz_service_types.go @@ -806,13 +806,14 @@ type ServiceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Service is the Schema for the Services API. Manages an App Runner Service. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Service struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/apprunner/v1beta1/zz_vpcconnector_terraformed.go b/apis/apprunner/v1beta1/zz_vpcconnector_terraformed.go new file mode 100755 index 0000000000..008daf59d7 --- /dev/null +++ b/apis/apprunner/v1beta1/zz_vpcconnector_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCConnector +func (mg *VPCConnector) GetTerraformResourceType() string { + return "aws_apprunner_vpc_connector" +} + +// GetConnectionDetailsMapping for this VPCConnector +func (tr *VPCConnector) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCConnector +func (tr *VPCConnector) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCConnector +func (tr *VPCConnector) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCConnector +func (tr *VPCConnector) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCConnector +func (tr *VPCConnector) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCConnector +func (tr *VPCConnector) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCConnector +func (tr *VPCConnector) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCConnector +func (tr *VPCConnector) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCConnector using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCConnector) LateInitialize(attrs []byte) (bool, error) { + params := &VPCConnectorParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCConnector) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/apprunner/v1beta1/zz_vpcconnector_types.go b/apis/apprunner/v1beta1/zz_vpcconnector_types.go index 3b95dfdea9..b9ef37a49a 100755 --- a/apis/apprunner/v1beta1/zz_vpcconnector_types.go +++ b/apis/apprunner/v1beta1/zz_vpcconnector_types.go @@ -163,13 +163,14 @@ type VPCConnectorStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCConnector is the Schema for the VPCConnectors API. Manages an App Runner VPC Connector. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCConnector struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appstream/v1beta1/zz_directoryconfig_terraformed.go b/apis/appstream/v1beta1/zz_directoryconfig_terraformed.go new file mode 100755 index 0000000000..fd292ca9c3 --- /dev/null +++ b/apis/appstream/v1beta1/zz_directoryconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DirectoryConfig +func (mg *DirectoryConfig) GetTerraformResourceType() string { + return "aws_appstream_directory_config" +} + +// GetConnectionDetailsMapping for this DirectoryConfig +func (tr *DirectoryConfig) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"service_account_credentials[*].account_password": "spec.forProvider.serviceAccountCredentials[*].accountPasswordSecretRef"} +} + +// GetObservation of this DirectoryConfig +func (tr *DirectoryConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DirectoryConfig +func (tr *DirectoryConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DirectoryConfig +func (tr *DirectoryConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DirectoryConfig +func (tr *DirectoryConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DirectoryConfig +func (tr *DirectoryConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DirectoryConfig +func (tr *DirectoryConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DirectoryConfig +func (tr *DirectoryConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DirectoryConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DirectoryConfig) LateInitialize(attrs []byte) (bool, error) { + params := &DirectoryConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DirectoryConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appstream/v1beta1/zz_directoryconfig_types.go b/apis/appstream/v1beta1/zz_directoryconfig_types.go index 8af97c7558..1fe0ab2c23 100755 --- a/apis/appstream/v1beta1/zz_directoryconfig_types.go +++ b/apis/appstream/v1beta1/zz_directoryconfig_types.go @@ -117,13 +117,14 @@ type DirectoryConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DirectoryConfig is the Schema for the DirectoryConfigs API. Provides an AppStream Directory Config // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DirectoryConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appstream/v1beta1/zz_fleet_terraformed.go b/apis/appstream/v1beta1/zz_fleet_terraformed.go new file mode 100755 index 0000000000..71d5a77e94 --- /dev/null +++ b/apis/appstream/v1beta1/zz_fleet_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Fleet +func (mg *Fleet) GetTerraformResourceType() string { + return "aws_appstream_fleet" +} + +// GetConnectionDetailsMapping for this Fleet +func (tr *Fleet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Fleet +func (tr *Fleet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Fleet +func (tr *Fleet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Fleet +func (tr *Fleet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Fleet +func (tr *Fleet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Fleet +func (tr *Fleet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Fleet +func (tr *Fleet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Fleet +func (tr *Fleet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Fleet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Fleet) LateInitialize(attrs []byte) (bool, error) { + params := &FleetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Fleet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appstream/v1beta1/zz_fleet_types.go b/apis/appstream/v1beta1/zz_fleet_types.go index a6c005cecc..1b56924dea 100755 --- a/apis/appstream/v1beta1/zz_fleet_types.go +++ b/apis/appstream/v1beta1/zz_fleet_types.go @@ -371,13 +371,14 @@ type FleetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Fleet is the Schema for the Fleets API. Provides an AppStream fleet // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws},path=fleet type Fleet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appstream/v1beta1/zz_fleetstackassociation_terraformed.go b/apis/appstream/v1beta1/zz_fleetstackassociation_terraformed.go new file mode 100755 index 0000000000..7780900196 --- /dev/null +++ b/apis/appstream/v1beta1/zz_fleetstackassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FleetStackAssociation +func (mg *FleetStackAssociation) GetTerraformResourceType() string { + return "aws_appstream_fleet_stack_association" +} + +// GetConnectionDetailsMapping for this FleetStackAssociation +func (tr *FleetStackAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FleetStackAssociation +func (tr *FleetStackAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FleetStackAssociation +func (tr *FleetStackAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FleetStackAssociation +func (tr *FleetStackAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FleetStackAssociation +func (tr *FleetStackAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FleetStackAssociation +func (tr *FleetStackAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FleetStackAssociation +func (tr *FleetStackAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FleetStackAssociation +func (tr *FleetStackAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FleetStackAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FleetStackAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &FleetStackAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FleetStackAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appstream/v1beta1/zz_fleetstackassociation_types.go b/apis/appstream/v1beta1/zz_fleetstackassociation_types.go index c24693afb9..fbe781f460 100755 --- a/apis/appstream/v1beta1/zz_fleetstackassociation_types.go +++ b/apis/appstream/v1beta1/zz_fleetstackassociation_types.go @@ -92,13 +92,14 @@ type FleetStackAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FleetStackAssociation is the Schema for the FleetStackAssociations API. Manages an AppStream Fleet Stack association. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FleetStackAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appstream/v1beta1/zz_generated.conversion_hubs.go b/apis/appstream/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..e437bcb122 --- /dev/null +++ b/apis/appstream/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *DirectoryConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Fleet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FleetStackAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ImageBuilder) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Stack) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *User) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserStackAssociation) Hub() {} diff --git a/apis/appstream/v1beta1/zz_generated_terraformed.go b/apis/appstream/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index fb1b914ae1..0000000000 --- a/apis/appstream/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,817 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this DirectoryConfig -func (mg *DirectoryConfig) GetTerraformResourceType() string { - return "aws_appstream_directory_config" -} - -// GetConnectionDetailsMapping for this DirectoryConfig -func (tr *DirectoryConfig) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"service_account_credentials[*].account_password": "spec.forProvider.serviceAccountCredentials[*].accountPasswordSecretRef"} -} - -// GetObservation of this DirectoryConfig -func (tr *DirectoryConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DirectoryConfig -func (tr *DirectoryConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DirectoryConfig -func (tr *DirectoryConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DirectoryConfig -func (tr *DirectoryConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DirectoryConfig -func (tr *DirectoryConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DirectoryConfig -func (tr *DirectoryConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DirectoryConfig -func (tr *DirectoryConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DirectoryConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DirectoryConfig) LateInitialize(attrs []byte) (bool, error) { - params := &DirectoryConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DirectoryConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Fleet -func (mg *Fleet) GetTerraformResourceType() string { - return "aws_appstream_fleet" -} - -// GetConnectionDetailsMapping for this Fleet -func (tr *Fleet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Fleet -func (tr *Fleet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Fleet -func (tr *Fleet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Fleet -func (tr *Fleet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Fleet -func (tr *Fleet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Fleet -func (tr *Fleet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Fleet -func (tr *Fleet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Fleet -func (tr *Fleet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Fleet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Fleet) LateInitialize(attrs []byte) (bool, error) { - params := &FleetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Fleet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FleetStackAssociation -func (mg *FleetStackAssociation) GetTerraformResourceType() string { - return "aws_appstream_fleet_stack_association" -} - -// GetConnectionDetailsMapping for this FleetStackAssociation -func (tr *FleetStackAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FleetStackAssociation -func (tr *FleetStackAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FleetStackAssociation -func (tr *FleetStackAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FleetStackAssociation -func (tr *FleetStackAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FleetStackAssociation -func (tr *FleetStackAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FleetStackAssociation -func (tr *FleetStackAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FleetStackAssociation -func (tr *FleetStackAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FleetStackAssociation -func (tr *FleetStackAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FleetStackAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FleetStackAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &FleetStackAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FleetStackAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ImageBuilder -func (mg *ImageBuilder) GetTerraformResourceType() string { - return "aws_appstream_image_builder" -} - -// GetConnectionDetailsMapping for this ImageBuilder -func (tr *ImageBuilder) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ImageBuilder -func (tr *ImageBuilder) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ImageBuilder -func (tr *ImageBuilder) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ImageBuilder -func (tr *ImageBuilder) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ImageBuilder -func (tr *ImageBuilder) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ImageBuilder -func (tr *ImageBuilder) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ImageBuilder -func (tr *ImageBuilder) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ImageBuilder -func (tr *ImageBuilder) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ImageBuilder using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ImageBuilder) LateInitialize(attrs []byte) (bool, error) { - params := &ImageBuilderParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ImageBuilder) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Stack -func (mg *Stack) GetTerraformResourceType() string { - return "aws_appstream_stack" -} - -// GetConnectionDetailsMapping for this Stack -func (tr *Stack) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Stack -func (tr *Stack) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Stack -func (tr *Stack) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Stack -func (tr *Stack) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Stack -func (tr *Stack) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Stack -func (tr *Stack) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Stack -func (tr *Stack) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Stack -func (tr *Stack) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Stack using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Stack) LateInitialize(attrs []byte) (bool, error) { - params := &StackParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Stack) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this User -func (mg *User) GetTerraformResourceType() string { - return "aws_appstream_user" -} - -// GetConnectionDetailsMapping for this User -func (tr *User) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this User -func (tr *User) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this User -func (tr *User) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this User -func (tr *User) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this User -func (tr *User) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this User -func (tr *User) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this User -func (tr *User) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this User -func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this User using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *User) LateInitialize(attrs []byte) (bool, error) { - params := &UserParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *User) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserStackAssociation -func (mg *UserStackAssociation) GetTerraformResourceType() string { - return "aws_appstream_user_stack_association" -} - -// GetConnectionDetailsMapping for this UserStackAssociation -func (tr *UserStackAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserStackAssociation -func (tr *UserStackAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserStackAssociation -func (tr *UserStackAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserStackAssociation -func (tr *UserStackAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserStackAssociation -func (tr *UserStackAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserStackAssociation -func (tr *UserStackAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserStackAssociation -func (tr *UserStackAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserStackAssociation -func (tr *UserStackAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserStackAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserStackAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &UserStackAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserStackAssociation) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/appstream/v1beta1/zz_imagebuilder_terraformed.go b/apis/appstream/v1beta1/zz_imagebuilder_terraformed.go new file mode 100755 index 0000000000..90f9702677 --- /dev/null +++ b/apis/appstream/v1beta1/zz_imagebuilder_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ImageBuilder +func (mg *ImageBuilder) GetTerraformResourceType() string { + return "aws_appstream_image_builder" +} + +// GetConnectionDetailsMapping for this ImageBuilder +func (tr *ImageBuilder) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ImageBuilder +func (tr *ImageBuilder) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ImageBuilder +func (tr *ImageBuilder) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ImageBuilder +func (tr *ImageBuilder) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ImageBuilder +func (tr *ImageBuilder) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ImageBuilder +func (tr *ImageBuilder) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ImageBuilder +func (tr *ImageBuilder) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ImageBuilder +func (tr *ImageBuilder) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ImageBuilder using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ImageBuilder) LateInitialize(attrs []byte) (bool, error) { + params := &ImageBuilderParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ImageBuilder) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appstream/v1beta1/zz_imagebuilder_types.go b/apis/appstream/v1beta1/zz_imagebuilder_types.go index bf78245043..e7e3561ec8 100755 --- a/apis/appstream/v1beta1/zz_imagebuilder_types.go +++ b/apis/appstream/v1beta1/zz_imagebuilder_types.go @@ -322,13 +322,14 @@ type ImageBuilderStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ImageBuilder is the Schema for the ImageBuilders API. Provides an AppStream image builder // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ImageBuilder struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appstream/v1beta1/zz_stack_terraformed.go b/apis/appstream/v1beta1/zz_stack_terraformed.go new file mode 100755 index 0000000000..1f97bde89b --- /dev/null +++ b/apis/appstream/v1beta1/zz_stack_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Stack +func (mg *Stack) GetTerraformResourceType() string { + return "aws_appstream_stack" +} + +// GetConnectionDetailsMapping for this Stack +func (tr *Stack) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Stack +func (tr *Stack) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Stack +func (tr *Stack) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Stack +func (tr *Stack) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Stack +func (tr *Stack) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Stack +func (tr *Stack) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Stack +func (tr *Stack) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Stack +func (tr *Stack) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Stack using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Stack) LateInitialize(attrs []byte) (bool, error) { + params := &StackParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Stack) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appstream/v1beta1/zz_stack_types.go b/apis/appstream/v1beta1/zz_stack_types.go index 4eee95c063..1114db2b0e 100755 --- a/apis/appstream/v1beta1/zz_stack_types.go +++ b/apis/appstream/v1beta1/zz_stack_types.go @@ -374,13 +374,14 @@ type StackStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Stack is the Schema for the Stacks API. Provides an AppStream stack // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Stack struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appstream/v1beta1/zz_user_terraformed.go b/apis/appstream/v1beta1/zz_user_terraformed.go new file mode 100755 index 0000000000..f245d839c5 --- /dev/null +++ b/apis/appstream/v1beta1/zz_user_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this User +func (mg *User) GetTerraformResourceType() string { + return "aws_appstream_user" +} + +// GetConnectionDetailsMapping for this User +func (tr *User) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this User +func (tr *User) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this User +func (tr *User) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this User +func (tr *User) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this User +func (tr *User) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this User +func (tr *User) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this User +func (tr *User) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this User +func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this User using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *User) LateInitialize(attrs []byte) (bool, error) { + params := &UserParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *User) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appstream/v1beta1/zz_user_types.go b/apis/appstream/v1beta1/zz_user_types.go index d10182cdd5..1b38767839 100755 --- a/apis/appstream/v1beta1/zz_user_types.go +++ b/apis/appstream/v1beta1/zz_user_types.go @@ -111,13 +111,14 @@ type UserStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // User is the Schema for the Users API. Provides an AppStream user // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type User struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appstream/v1beta1/zz_userstackassociation_terraformed.go b/apis/appstream/v1beta1/zz_userstackassociation_terraformed.go new file mode 100755 index 0000000000..b2d681b0d8 --- /dev/null +++ b/apis/appstream/v1beta1/zz_userstackassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserStackAssociation +func (mg *UserStackAssociation) GetTerraformResourceType() string { + return "aws_appstream_user_stack_association" +} + +// GetConnectionDetailsMapping for this UserStackAssociation +func (tr *UserStackAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserStackAssociation +func (tr *UserStackAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserStackAssociation +func (tr *UserStackAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserStackAssociation +func (tr *UserStackAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserStackAssociation +func (tr *UserStackAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserStackAssociation +func (tr *UserStackAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserStackAssociation +func (tr *UserStackAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserStackAssociation +func (tr *UserStackAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserStackAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserStackAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &UserStackAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserStackAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appstream/v1beta1/zz_userstackassociation_types.go b/apis/appstream/v1beta1/zz_userstackassociation_types.go index 91b3c6ee93..b25e9c6e21 100755 --- a/apis/appstream/v1beta1/zz_userstackassociation_types.go +++ b/apis/appstream/v1beta1/zz_userstackassociation_types.go @@ -118,13 +118,14 @@ type UserStackAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserStackAssociation is the Schema for the UserStackAssociations API. Manages an AppStream User Stack association. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserStackAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appsync/v1beta1/zz_apicache_terraformed.go b/apis/appsync/v1beta1/zz_apicache_terraformed.go new file mode 100755 index 0000000000..8c7d9d2b51 --- /dev/null +++ b/apis/appsync/v1beta1/zz_apicache_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this APICache +func (mg *APICache) GetTerraformResourceType() string { + return "aws_appsync_api_cache" +} + +// GetConnectionDetailsMapping for this APICache +func (tr *APICache) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this APICache +func (tr *APICache) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this APICache +func (tr *APICache) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this APICache +func (tr *APICache) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this APICache +func (tr *APICache) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this APICache +func (tr *APICache) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this APICache +func (tr *APICache) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this APICache +func (tr *APICache) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this APICache using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *APICache) LateInitialize(attrs []byte) (bool, error) { + params := &APICacheParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *APICache) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appsync/v1beta1/zz_apicache_types.go b/apis/appsync/v1beta1/zz_apicache_types.go index fe5cbabd71..ee4047d241 100755 --- a/apis/appsync/v1beta1/zz_apicache_types.go +++ b/apis/appsync/v1beta1/zz_apicache_types.go @@ -138,13 +138,14 @@ type APICacheStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // APICache is the Schema for the APICaches API. Provides an AppSync API Cache. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type APICache struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appsync/v1beta1/zz_apikey_terraformed.go b/apis/appsync/v1beta1/zz_apikey_terraformed.go new file mode 100755 index 0000000000..638c90656e --- /dev/null +++ b/apis/appsync/v1beta1/zz_apikey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this APIKey +func (mg *APIKey) GetTerraformResourceType() string { + return "aws_appsync_api_key" +} + +// GetConnectionDetailsMapping for this APIKey +func (tr *APIKey) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"key": "status.atProvider.key"} +} + +// GetObservation of this APIKey +func (tr *APIKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this APIKey +func (tr *APIKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this APIKey +func (tr *APIKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this APIKey +func (tr *APIKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this APIKey +func (tr *APIKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this APIKey +func (tr *APIKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this APIKey +func (tr *APIKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this APIKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *APIKey) LateInitialize(attrs []byte) (bool, error) { + params := &APIKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *APIKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appsync/v1beta1/zz_apikey_types.go b/apis/appsync/v1beta1/zz_apikey_types.go index 2876fb7978..0b02ede2a4 100755 --- a/apis/appsync/v1beta1/zz_apikey_types.go +++ b/apis/appsync/v1beta1/zz_apikey_types.go @@ -95,13 +95,14 @@ type APIKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // APIKey is the Schema for the APIKeys API. Provides an AppSync API Key. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type APIKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appsync/v1beta1/zz_datasource_terraformed.go b/apis/appsync/v1beta1/zz_datasource_terraformed.go new file mode 100755 index 0000000000..c4637d34ac --- /dev/null +++ b/apis/appsync/v1beta1/zz_datasource_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Datasource +func (mg *Datasource) GetTerraformResourceType() string { + return "aws_appsync_datasource" +} + +// GetConnectionDetailsMapping for this Datasource +func (tr *Datasource) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Datasource +func (tr *Datasource) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Datasource +func (tr *Datasource) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Datasource +func (tr *Datasource) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Datasource +func (tr *Datasource) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Datasource +func (tr *Datasource) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Datasource +func (tr *Datasource) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Datasource +func (tr *Datasource) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Datasource using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Datasource) LateInitialize(attrs []byte) (bool, error) { + params := &DatasourceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Datasource) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appsync/v1beta1/zz_datasource_types.go b/apis/appsync/v1beta1/zz_datasource_types.go index 8e05e6f3fe..d057b26460 100755 --- a/apis/appsync/v1beta1/zz_datasource_types.go +++ b/apis/appsync/v1beta1/zz_datasource_types.go @@ -557,13 +557,14 @@ type DatasourceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Datasource is the Schema for the Datasources API. Provides an AppSync Data Source. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Datasource struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appsync/v1beta1/zz_function_terraformed.go b/apis/appsync/v1beta1/zz_function_terraformed.go new file mode 100755 index 0000000000..7f8b5f29b0 --- /dev/null +++ b/apis/appsync/v1beta1/zz_function_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Function +func (mg *Function) GetTerraformResourceType() string { + return "aws_appsync_function" +} + +// GetConnectionDetailsMapping for this Function +func (tr *Function) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Function +func (tr *Function) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Function +func (tr *Function) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Function +func (tr *Function) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Function +func (tr *Function) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Function +func (tr *Function) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Function +func (tr *Function) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Function +func (tr *Function) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Function using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Function) LateInitialize(attrs []byte) (bool, error) { + params := &FunctionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Function) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appsync/v1beta1/zz_function_types.go b/apis/appsync/v1beta1/zz_function_types.go index f6499e9fe2..296a66cd51 100755 --- a/apis/appsync/v1beta1/zz_function_types.go +++ b/apis/appsync/v1beta1/zz_function_types.go @@ -299,13 +299,14 @@ type FunctionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Function is the Schema for the Functions API. Provides an AppSync Function. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Function struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appsync/v1beta1/zz_generated.conversion_hubs.go b/apis/appsync/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..42904d829d --- /dev/null +++ b/apis/appsync/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *APICache) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *APIKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Datasource) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Function) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GraphQLAPI) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Resolver) Hub() {} diff --git a/apis/appsync/v1beta1/zz_generated_terraformed.go b/apis/appsync/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 095a0ce1c6..0000000000 --- a/apis/appsync/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,703 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this APICache -func (mg *APICache) GetTerraformResourceType() string { - return "aws_appsync_api_cache" -} - -// GetConnectionDetailsMapping for this APICache -func (tr *APICache) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this APICache -func (tr *APICache) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this APICache -func (tr *APICache) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this APICache -func (tr *APICache) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this APICache -func (tr *APICache) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this APICache -func (tr *APICache) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this APICache -func (tr *APICache) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this APICache -func (tr *APICache) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this APICache using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *APICache) LateInitialize(attrs []byte) (bool, error) { - params := &APICacheParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *APICache) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this APIKey -func (mg *APIKey) GetTerraformResourceType() string { - return "aws_appsync_api_key" -} - -// GetConnectionDetailsMapping for this APIKey -func (tr *APIKey) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"key": "status.atProvider.key"} -} - -// GetObservation of this APIKey -func (tr *APIKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this APIKey -func (tr *APIKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this APIKey -func (tr *APIKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this APIKey -func (tr *APIKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this APIKey -func (tr *APIKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this APIKey -func (tr *APIKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this APIKey -func (tr *APIKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this APIKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *APIKey) LateInitialize(attrs []byte) (bool, error) { - params := &APIKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *APIKey) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Datasource -func (mg *Datasource) GetTerraformResourceType() string { - return "aws_appsync_datasource" -} - -// GetConnectionDetailsMapping for this Datasource -func (tr *Datasource) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Datasource -func (tr *Datasource) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Datasource -func (tr *Datasource) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Datasource -func (tr *Datasource) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Datasource -func (tr *Datasource) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Datasource -func (tr *Datasource) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Datasource -func (tr *Datasource) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Datasource -func (tr *Datasource) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Datasource using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Datasource) LateInitialize(attrs []byte) (bool, error) { - params := &DatasourceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Datasource) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Function -func (mg *Function) GetTerraformResourceType() string { - return "aws_appsync_function" -} - -// GetConnectionDetailsMapping for this Function -func (tr *Function) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Function -func (tr *Function) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Function -func (tr *Function) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Function -func (tr *Function) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Function -func (tr *Function) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Function -func (tr *Function) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Function -func (tr *Function) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Function -func (tr *Function) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Function using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Function) LateInitialize(attrs []byte) (bool, error) { - params := &FunctionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Function) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GraphQLAPI -func (mg *GraphQLAPI) GetTerraformResourceType() string { - return "aws_appsync_graphql_api" -} - -// GetConnectionDetailsMapping for this GraphQLAPI -func (tr *GraphQLAPI) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GraphQLAPI -func (tr *GraphQLAPI) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GraphQLAPI -func (tr *GraphQLAPI) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GraphQLAPI -func (tr *GraphQLAPI) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GraphQLAPI -func (tr *GraphQLAPI) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GraphQLAPI -func (tr *GraphQLAPI) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GraphQLAPI -func (tr *GraphQLAPI) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GraphQLAPI -func (tr *GraphQLAPI) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GraphQLAPI using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GraphQLAPI) LateInitialize(attrs []byte) (bool, error) { - params := &GraphQLAPIParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GraphQLAPI) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Resolver -func (mg *Resolver) GetTerraformResourceType() string { - return "aws_appsync_resolver" -} - -// GetConnectionDetailsMapping for this Resolver -func (tr *Resolver) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Resolver -func (tr *Resolver) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Resolver -func (tr *Resolver) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Resolver -func (tr *Resolver) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Resolver -func (tr *Resolver) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Resolver -func (tr *Resolver) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Resolver -func (tr *Resolver) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Resolver -func (tr *Resolver) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Resolver using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Resolver) LateInitialize(attrs []byte) (bool, error) { - params := &ResolverParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Resolver) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/appsync/v1beta1/zz_graphqlapi_terraformed.go b/apis/appsync/v1beta1/zz_graphqlapi_terraformed.go new file mode 100755 index 0000000000..298e556374 --- /dev/null +++ b/apis/appsync/v1beta1/zz_graphqlapi_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GraphQLAPI +func (mg *GraphQLAPI) GetTerraformResourceType() string { + return "aws_appsync_graphql_api" +} + +// GetConnectionDetailsMapping for this GraphQLAPI +func (tr *GraphQLAPI) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GraphQLAPI +func (tr *GraphQLAPI) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GraphQLAPI +func (tr *GraphQLAPI) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GraphQLAPI +func (tr *GraphQLAPI) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GraphQLAPI +func (tr *GraphQLAPI) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GraphQLAPI +func (tr *GraphQLAPI) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GraphQLAPI +func (tr *GraphQLAPI) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GraphQLAPI +func (tr *GraphQLAPI) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GraphQLAPI using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GraphQLAPI) LateInitialize(attrs []byte) (bool, error) { + params := &GraphQLAPIParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GraphQLAPI) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appsync/v1beta1/zz_graphqlapi_types.go b/apis/appsync/v1beta1/zz_graphqlapi_types.go index 04dd943aec..26949c5252 100755 --- a/apis/appsync/v1beta1/zz_graphqlapi_types.go +++ b/apis/appsync/v1beta1/zz_graphqlapi_types.go @@ -564,13 +564,14 @@ type GraphQLAPIStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GraphQLAPI is the Schema for the GraphQLAPIs API. Provides an AppSync GraphQL API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GraphQLAPI struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/appsync/v1beta1/zz_resolver_terraformed.go b/apis/appsync/v1beta1/zz_resolver_terraformed.go new file mode 100755 index 0000000000..aaed57b57e --- /dev/null +++ b/apis/appsync/v1beta1/zz_resolver_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Resolver +func (mg *Resolver) GetTerraformResourceType() string { + return "aws_appsync_resolver" +} + +// GetConnectionDetailsMapping for this Resolver +func (tr *Resolver) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Resolver +func (tr *Resolver) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Resolver +func (tr *Resolver) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Resolver +func (tr *Resolver) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Resolver +func (tr *Resolver) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Resolver +func (tr *Resolver) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Resolver +func (tr *Resolver) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Resolver +func (tr *Resolver) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Resolver using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Resolver) LateInitialize(attrs []byte) (bool, error) { + params := &ResolverParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Resolver) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/appsync/v1beta1/zz_resolver_types.go b/apis/appsync/v1beta1/zz_resolver_types.go index d4306aa6d0..95d31c87da 100755 --- a/apis/appsync/v1beta1/zz_resolver_types.go +++ b/apis/appsync/v1beta1/zz_resolver_types.go @@ -347,13 +347,14 @@ type ResolverStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Resolver is the Schema for the Resolvers API. Provides an AppSync Resolver. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Resolver struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/athena/v1beta1/zz_database_terraformed.go b/apis/athena/v1beta1/zz_database_terraformed.go new file mode 100755 index 0000000000..1d2a5a8880 --- /dev/null +++ b/apis/athena/v1beta1/zz_database_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Database +func (mg *Database) GetTerraformResourceType() string { + return "aws_athena_database" +} + +// GetConnectionDetailsMapping for this Database +func (tr *Database) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Database +func (tr *Database) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Database +func (tr *Database) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Database +func (tr *Database) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Database +func (tr *Database) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Database +func (tr *Database) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Database +func (tr *Database) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Database +func (tr *Database) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Database using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Database) LateInitialize(attrs []byte) (bool, error) { + params := &DatabaseParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Database) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/athena/v1beta1/zz_database_types.go b/apis/athena/v1beta1/zz_database_types.go index 163b0d7cc9..f853746b93 100755 --- a/apis/athena/v1beta1/zz_database_types.go +++ b/apis/athena/v1beta1/zz_database_types.go @@ -199,13 +199,14 @@ type DatabaseStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Database is the Schema for the Databases API. Provides an Athena database. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Database struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/athena/v1beta1/zz_datacatalog_terraformed.go b/apis/athena/v1beta1/zz_datacatalog_terraformed.go new file mode 100755 index 0000000000..b06a4656f0 --- /dev/null +++ b/apis/athena/v1beta1/zz_datacatalog_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DataCatalog +func (mg *DataCatalog) GetTerraformResourceType() string { + return "aws_athena_data_catalog" +} + +// GetConnectionDetailsMapping for this DataCatalog +func (tr *DataCatalog) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DataCatalog +func (tr *DataCatalog) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DataCatalog +func (tr *DataCatalog) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DataCatalog +func (tr *DataCatalog) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DataCatalog +func (tr *DataCatalog) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DataCatalog +func (tr *DataCatalog) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DataCatalog +func (tr *DataCatalog) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DataCatalog +func (tr *DataCatalog) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DataCatalog using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DataCatalog) LateInitialize(attrs []byte) (bool, error) { + params := &DataCatalogParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DataCatalog) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/athena/v1beta1/zz_datacatalog_types.go b/apis/athena/v1beta1/zz_datacatalog_types.go index ba643f74a9..9dd7dec068 100755 --- a/apis/athena/v1beta1/zz_datacatalog_types.go +++ b/apis/athena/v1beta1/zz_datacatalog_types.go @@ -111,13 +111,14 @@ type DataCatalogStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DataCatalog is the Schema for the DataCatalogs API. Provides an Athena data catalog. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DataCatalog struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/athena/v1beta1/zz_generated.conversion_hubs.go b/apis/athena/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..65ceaf4b4f --- /dev/null +++ b/apis/athena/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *DataCatalog) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Database) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NamedQuery) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Workgroup) Hub() {} diff --git a/apis/athena/v1beta1/zz_generated_terraformed.go b/apis/athena/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 4bf7ddb4d0..0000000000 --- a/apis/athena/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this DataCatalog -func (mg *DataCatalog) GetTerraformResourceType() string { - return "aws_athena_data_catalog" -} - -// GetConnectionDetailsMapping for this DataCatalog -func (tr *DataCatalog) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DataCatalog -func (tr *DataCatalog) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DataCatalog -func (tr *DataCatalog) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DataCatalog -func (tr *DataCatalog) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DataCatalog -func (tr *DataCatalog) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DataCatalog -func (tr *DataCatalog) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DataCatalog -func (tr *DataCatalog) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DataCatalog -func (tr *DataCatalog) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DataCatalog using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DataCatalog) LateInitialize(attrs []byte) (bool, error) { - params := &DataCatalogParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DataCatalog) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Database -func (mg *Database) GetTerraformResourceType() string { - return "aws_athena_database" -} - -// GetConnectionDetailsMapping for this Database -func (tr *Database) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Database -func (tr *Database) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Database -func (tr *Database) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Database -func (tr *Database) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Database -func (tr *Database) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Database -func (tr *Database) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Database -func (tr *Database) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Database -func (tr *Database) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Database using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Database) LateInitialize(attrs []byte) (bool, error) { - params := &DatabaseParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Database) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NamedQuery -func (mg *NamedQuery) GetTerraformResourceType() string { - return "aws_athena_named_query" -} - -// GetConnectionDetailsMapping for this NamedQuery -func (tr *NamedQuery) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NamedQuery -func (tr *NamedQuery) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NamedQuery -func (tr *NamedQuery) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NamedQuery -func (tr *NamedQuery) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NamedQuery -func (tr *NamedQuery) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NamedQuery -func (tr *NamedQuery) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NamedQuery -func (tr *NamedQuery) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NamedQuery -func (tr *NamedQuery) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NamedQuery using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NamedQuery) LateInitialize(attrs []byte) (bool, error) { - params := &NamedQueryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NamedQuery) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Workgroup -func (mg *Workgroup) GetTerraformResourceType() string { - return "aws_athena_workgroup" -} - -// GetConnectionDetailsMapping for this Workgroup -func (tr *Workgroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Workgroup -func (tr *Workgroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Workgroup -func (tr *Workgroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Workgroup -func (tr *Workgroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Workgroup -func (tr *Workgroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Workgroup -func (tr *Workgroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Workgroup -func (tr *Workgroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Workgroup -func (tr *Workgroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Workgroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Workgroup) LateInitialize(attrs []byte) (bool, error) { - params := &WorkgroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Workgroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/athena/v1beta1/zz_namedquery_terraformed.go b/apis/athena/v1beta1/zz_namedquery_terraformed.go new file mode 100755 index 0000000000..4749785533 --- /dev/null +++ b/apis/athena/v1beta1/zz_namedquery_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NamedQuery +func (mg *NamedQuery) GetTerraformResourceType() string { + return "aws_athena_named_query" +} + +// GetConnectionDetailsMapping for this NamedQuery +func (tr *NamedQuery) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NamedQuery +func (tr *NamedQuery) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NamedQuery +func (tr *NamedQuery) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NamedQuery +func (tr *NamedQuery) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NamedQuery +func (tr *NamedQuery) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NamedQuery +func (tr *NamedQuery) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NamedQuery +func (tr *NamedQuery) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NamedQuery +func (tr *NamedQuery) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NamedQuery using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NamedQuery) LateInitialize(attrs []byte) (bool, error) { + params := &NamedQueryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NamedQuery) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/athena/v1beta1/zz_namedquery_types.go b/apis/athena/v1beta1/zz_namedquery_types.go index 1a149adb6e..6db8787f28 100755 --- a/apis/athena/v1beta1/zz_namedquery_types.go +++ b/apis/athena/v1beta1/zz_namedquery_types.go @@ -146,13 +146,14 @@ type NamedQueryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NamedQuery is the Schema for the NamedQuerys API. Provides an Athena Named Query resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NamedQuery struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/athena/v1beta1/zz_workgroup_terraformed.go b/apis/athena/v1beta1/zz_workgroup_terraformed.go new file mode 100755 index 0000000000..4b066f01a9 --- /dev/null +++ b/apis/athena/v1beta1/zz_workgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Workgroup +func (mg *Workgroup) GetTerraformResourceType() string { + return "aws_athena_workgroup" +} + +// GetConnectionDetailsMapping for this Workgroup +func (tr *Workgroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Workgroup +func (tr *Workgroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Workgroup +func (tr *Workgroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Workgroup +func (tr *Workgroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Workgroup +func (tr *Workgroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Workgroup +func (tr *Workgroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Workgroup +func (tr *Workgroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Workgroup +func (tr *Workgroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Workgroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Workgroup) LateInitialize(attrs []byte) (bool, error) { + params := &WorkgroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Workgroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/athena/v1beta1/zz_workgroup_types.go b/apis/athena/v1beta1/zz_workgroup_types.go index e528f828fe..d382622185 100755 --- a/apis/athena/v1beta1/zz_workgroup_types.go +++ b/apis/athena/v1beta1/zz_workgroup_types.go @@ -336,13 +336,14 @@ type WorkgroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Workgroup is the Schema for the Workgroups API. Manages an Athena Workgroup. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Workgroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/autoscaling/v1beta1/zz_attachment_terraformed.go b/apis/autoscaling/v1beta1/zz_attachment_terraformed.go new file mode 100755 index 0000000000..362f35c8c0 --- /dev/null +++ b/apis/autoscaling/v1beta1/zz_attachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Attachment +func (mg *Attachment) GetTerraformResourceType() string { + return "aws_autoscaling_attachment" +} + +// GetConnectionDetailsMapping for this Attachment +func (tr *Attachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Attachment +func (tr *Attachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Attachment +func (tr *Attachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Attachment +func (tr *Attachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Attachment +func (tr *Attachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Attachment +func (tr *Attachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Attachment +func (tr *Attachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Attachment +func (tr *Attachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Attachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Attachment) LateInitialize(attrs []byte) (bool, error) { + params := &AttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Attachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/autoscaling/v1beta1/zz_attachment_types.go b/apis/autoscaling/v1beta1/zz_attachment_types.go index c1192a4046..fe109f9564 100755 --- a/apis/autoscaling/v1beta1/zz_attachment_types.go +++ b/apis/autoscaling/v1beta1/zz_attachment_types.go @@ -175,13 +175,14 @@ type AttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Attachment is the Schema for the Attachments API. Provides an AutoScaling Group Attachment resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Attachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/autoscaling/v1beta1/zz_autoscalinggroup_terraformed.go b/apis/autoscaling/v1beta1/zz_autoscalinggroup_terraformed.go new file mode 100755 index 0000000000..cfde4d1dd4 --- /dev/null +++ b/apis/autoscaling/v1beta1/zz_autoscalinggroup_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AutoscalingGroup +func (mg *AutoscalingGroup) GetTerraformResourceType() string { + return "aws_autoscaling_group" +} + +// GetConnectionDetailsMapping for this AutoscalingGroup +func (tr *AutoscalingGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AutoscalingGroup +func (tr *AutoscalingGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AutoscalingGroup +func (tr *AutoscalingGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AutoscalingGroup +func (tr *AutoscalingGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AutoscalingGroup +func (tr *AutoscalingGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AutoscalingGroup +func (tr *AutoscalingGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AutoscalingGroup +func (tr *AutoscalingGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AutoscalingGroup +func (tr *AutoscalingGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AutoscalingGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AutoscalingGroup) LateInitialize(attrs []byte) (bool, error) { + params := &AutoscalingGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("AvailabilityZones")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AutoscalingGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/autoscaling/v1beta1/zz_autoscalinggroup_types.go b/apis/autoscaling/v1beta1/zz_autoscalinggroup_types.go index 24cb4073f0..5f36ab4972 100755 --- a/apis/autoscaling/v1beta1/zz_autoscalinggroup_types.go +++ b/apis/autoscaling/v1beta1/zz_autoscalinggroup_types.go @@ -1726,13 +1726,14 @@ type AutoscalingGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AutoscalingGroup is the Schema for the AutoscalingGroups API. Provides an Auto Scaling Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AutoscalingGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/autoscaling/v1beta1/zz_generated.conversion_hubs.go b/apis/autoscaling/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..6cd73cc882 --- /dev/null +++ b/apis/autoscaling/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Attachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *AutoscalingGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GroupTag) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LifecycleHook) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Notification) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Policy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Schedule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LaunchConfiguration) Hub() {} diff --git a/apis/autoscaling/v1beta1/zz_generated_terraformed.go b/apis/autoscaling/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 929c220c40..0000000000 --- a/apis/autoscaling/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,932 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Attachment -func (mg *Attachment) GetTerraformResourceType() string { - return "aws_autoscaling_attachment" -} - -// GetConnectionDetailsMapping for this Attachment -func (tr *Attachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Attachment -func (tr *Attachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Attachment -func (tr *Attachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Attachment -func (tr *Attachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Attachment -func (tr *Attachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Attachment -func (tr *Attachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Attachment -func (tr *Attachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Attachment -func (tr *Attachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Attachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Attachment) LateInitialize(attrs []byte) (bool, error) { - params := &AttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Attachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this AutoscalingGroup -func (mg *AutoscalingGroup) GetTerraformResourceType() string { - return "aws_autoscaling_group" -} - -// GetConnectionDetailsMapping for this AutoscalingGroup -func (tr *AutoscalingGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AutoscalingGroup -func (tr *AutoscalingGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AutoscalingGroup -func (tr *AutoscalingGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AutoscalingGroup -func (tr *AutoscalingGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AutoscalingGroup -func (tr *AutoscalingGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AutoscalingGroup -func (tr *AutoscalingGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AutoscalingGroup -func (tr *AutoscalingGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AutoscalingGroup -func (tr *AutoscalingGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AutoscalingGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AutoscalingGroup) LateInitialize(attrs []byte) (bool, error) { - params := &AutoscalingGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("AvailabilityZones")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AutoscalingGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GroupTag -func (mg *GroupTag) GetTerraformResourceType() string { - return "aws_autoscaling_group_tag" -} - -// GetConnectionDetailsMapping for this GroupTag -func (tr *GroupTag) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GroupTag -func (tr *GroupTag) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GroupTag -func (tr *GroupTag) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GroupTag -func (tr *GroupTag) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GroupTag -func (tr *GroupTag) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GroupTag -func (tr *GroupTag) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GroupTag -func (tr *GroupTag) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GroupTag -func (tr *GroupTag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GroupTag using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GroupTag) LateInitialize(attrs []byte) (bool, error) { - params := &GroupTagParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GroupTag) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LifecycleHook -func (mg *LifecycleHook) GetTerraformResourceType() string { - return "aws_autoscaling_lifecycle_hook" -} - -// GetConnectionDetailsMapping for this LifecycleHook -func (tr *LifecycleHook) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LifecycleHook -func (tr *LifecycleHook) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LifecycleHook -func (tr *LifecycleHook) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LifecycleHook -func (tr *LifecycleHook) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LifecycleHook -func (tr *LifecycleHook) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LifecycleHook -func (tr *LifecycleHook) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LifecycleHook -func (tr *LifecycleHook) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LifecycleHook -func (tr *LifecycleHook) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LifecycleHook using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LifecycleHook) LateInitialize(attrs []byte) (bool, error) { - params := &LifecycleHookParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LifecycleHook) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Notification -func (mg *Notification) GetTerraformResourceType() string { - return "aws_autoscaling_notification" -} - -// GetConnectionDetailsMapping for this Notification -func (tr *Notification) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Notification -func (tr *Notification) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Notification -func (tr *Notification) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Notification -func (tr *Notification) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Notification -func (tr *Notification) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Notification -func (tr *Notification) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Notification -func (tr *Notification) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Notification -func (tr *Notification) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Notification using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Notification) LateInitialize(attrs []byte) (bool, error) { - params := &NotificationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Notification) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Policy -func (mg *Policy) GetTerraformResourceType() string { - return "aws_autoscaling_policy" -} - -// GetConnectionDetailsMapping for this Policy -func (tr *Policy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Policy -func (tr *Policy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Policy -func (tr *Policy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Policy -func (tr *Policy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Policy -func (tr *Policy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Policy -func (tr *Policy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Policy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { - params := &PolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Policy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Schedule -func (mg *Schedule) GetTerraformResourceType() string { - return "aws_autoscaling_schedule" -} - -// GetConnectionDetailsMapping for this Schedule -func (tr *Schedule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Schedule -func (tr *Schedule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Schedule -func (tr *Schedule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Schedule -func (tr *Schedule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Schedule -func (tr *Schedule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Schedule -func (tr *Schedule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Schedule -func (tr *Schedule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Schedule -func (tr *Schedule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Schedule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Schedule) LateInitialize(attrs []byte) (bool, error) { - params := &ScheduleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Schedule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LaunchConfiguration -func (mg *LaunchConfiguration) GetTerraformResourceType() string { - return "aws_launch_configuration" -} - -// GetConnectionDetailsMapping for this LaunchConfiguration -func (tr *LaunchConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LaunchConfiguration -func (tr *LaunchConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LaunchConfiguration -func (tr *LaunchConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LaunchConfiguration -func (tr *LaunchConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LaunchConfiguration -func (tr *LaunchConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LaunchConfiguration -func (tr *LaunchConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LaunchConfiguration -func (tr *LaunchConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LaunchConfiguration -func (tr *LaunchConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LaunchConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LaunchConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &LaunchConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LaunchConfiguration) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/autoscaling/v1beta1/zz_grouptag_terraformed.go b/apis/autoscaling/v1beta1/zz_grouptag_terraformed.go new file mode 100755 index 0000000000..dd1b0a8d68 --- /dev/null +++ b/apis/autoscaling/v1beta1/zz_grouptag_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GroupTag +func (mg *GroupTag) GetTerraformResourceType() string { + return "aws_autoscaling_group_tag" +} + +// GetConnectionDetailsMapping for this GroupTag +func (tr *GroupTag) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GroupTag +func (tr *GroupTag) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GroupTag +func (tr *GroupTag) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GroupTag +func (tr *GroupTag) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GroupTag +func (tr *GroupTag) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GroupTag +func (tr *GroupTag) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GroupTag +func (tr *GroupTag) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GroupTag +func (tr *GroupTag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GroupTag using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GroupTag) LateInitialize(attrs []byte) (bool, error) { + params := &GroupTagParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GroupTag) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/autoscaling/v1beta1/zz_grouptag_types.go b/apis/autoscaling/v1beta1/zz_grouptag_types.go index ea655f02d8..5dea420b1c 100755 --- a/apis/autoscaling/v1beta1/zz_grouptag_types.go +++ b/apis/autoscaling/v1beta1/zz_grouptag_types.go @@ -135,13 +135,14 @@ type GroupTagStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GroupTag is the Schema for the GroupTags API. Manages an individual Autoscaling Group tag // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GroupTag struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/autoscaling/v1beta1/zz_launchconfiguration_terraformed.go b/apis/autoscaling/v1beta1/zz_launchconfiguration_terraformed.go new file mode 100755 index 0000000000..ac1dd1223a --- /dev/null +++ b/apis/autoscaling/v1beta1/zz_launchconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LaunchConfiguration +func (mg *LaunchConfiguration) GetTerraformResourceType() string { + return "aws_launch_configuration" +} + +// GetConnectionDetailsMapping for this LaunchConfiguration +func (tr *LaunchConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LaunchConfiguration +func (tr *LaunchConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LaunchConfiguration +func (tr *LaunchConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LaunchConfiguration +func (tr *LaunchConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LaunchConfiguration +func (tr *LaunchConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LaunchConfiguration +func (tr *LaunchConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LaunchConfiguration +func (tr *LaunchConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LaunchConfiguration +func (tr *LaunchConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LaunchConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LaunchConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &LaunchConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LaunchConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/autoscaling/v1beta1/zz_launchconfiguration_types.go b/apis/autoscaling/v1beta1/zz_launchconfiguration_types.go index 838117b667..f3f418adfd 100755 --- a/apis/autoscaling/v1beta1/zz_launchconfiguration_types.go +++ b/apis/autoscaling/v1beta1/zz_launchconfiguration_types.go @@ -502,13 +502,14 @@ type LaunchConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LaunchConfiguration is the Schema for the LaunchConfigurations API. Provides a resource to create a new launch configuration, used for autoscaling groups. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LaunchConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/autoscaling/v1beta1/zz_lifecyclehook_terraformed.go b/apis/autoscaling/v1beta1/zz_lifecyclehook_terraformed.go new file mode 100755 index 0000000000..cb7cac6848 --- /dev/null +++ b/apis/autoscaling/v1beta1/zz_lifecyclehook_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LifecycleHook +func (mg *LifecycleHook) GetTerraformResourceType() string { + return "aws_autoscaling_lifecycle_hook" +} + +// GetConnectionDetailsMapping for this LifecycleHook +func (tr *LifecycleHook) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LifecycleHook +func (tr *LifecycleHook) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LifecycleHook +func (tr *LifecycleHook) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LifecycleHook +func (tr *LifecycleHook) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LifecycleHook +func (tr *LifecycleHook) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LifecycleHook +func (tr *LifecycleHook) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LifecycleHook +func (tr *LifecycleHook) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LifecycleHook +func (tr *LifecycleHook) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LifecycleHook using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LifecycleHook) LateInitialize(attrs []byte) (bool, error) { + params := &LifecycleHookParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LifecycleHook) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/autoscaling/v1beta1/zz_lifecyclehook_types.go b/apis/autoscaling/v1beta1/zz_lifecyclehook_types.go index 90125e6781..a65663344c 100755 --- a/apis/autoscaling/v1beta1/zz_lifecyclehook_types.go +++ b/apis/autoscaling/v1beta1/zz_lifecyclehook_types.go @@ -153,13 +153,14 @@ type LifecycleHookStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LifecycleHook is the Schema for the LifecycleHooks API. Provides an AutoScaling Lifecycle Hook resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LifecycleHook struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/autoscaling/v1beta1/zz_notification_terraformed.go b/apis/autoscaling/v1beta1/zz_notification_terraformed.go new file mode 100755 index 0000000000..8041c6e052 --- /dev/null +++ b/apis/autoscaling/v1beta1/zz_notification_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Notification +func (mg *Notification) GetTerraformResourceType() string { + return "aws_autoscaling_notification" +} + +// GetConnectionDetailsMapping for this Notification +func (tr *Notification) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Notification +func (tr *Notification) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Notification +func (tr *Notification) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Notification +func (tr *Notification) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Notification +func (tr *Notification) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Notification +func (tr *Notification) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Notification +func (tr *Notification) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Notification +func (tr *Notification) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Notification using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Notification) LateInitialize(attrs []byte) (bool, error) { + params := &NotificationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Notification) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/autoscaling/v1beta1/zz_notification_types.go b/apis/autoscaling/v1beta1/zz_notification_types.go index 1267fc1d1b..e7dee2eec0 100755 --- a/apis/autoscaling/v1beta1/zz_notification_types.go +++ b/apis/autoscaling/v1beta1/zz_notification_types.go @@ -116,13 +116,14 @@ type NotificationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Notification is the Schema for the Notifications API. Provides an AutoScaling Group with Notification support // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Notification struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/autoscaling/v1beta1/zz_policy_terraformed.go b/apis/autoscaling/v1beta1/zz_policy_terraformed.go new file mode 100755 index 0000000000..b4ed0f25cd --- /dev/null +++ b/apis/autoscaling/v1beta1/zz_policy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Policy +func (mg *Policy) GetTerraformResourceType() string { + return "aws_autoscaling_policy" +} + +// GetConnectionDetailsMapping for this Policy +func (tr *Policy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Policy +func (tr *Policy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Policy +func (tr *Policy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Policy +func (tr *Policy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Policy +func (tr *Policy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Policy +func (tr *Policy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Policy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { + params := &PolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Policy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/autoscaling/v1beta1/zz_policy_types.go b/apis/autoscaling/v1beta1/zz_policy_types.go index 19b45e0270..297461ca81 100755 --- a/apis/autoscaling/v1beta1/zz_policy_types.go +++ b/apis/autoscaling/v1beta1/zz_policy_types.go @@ -1366,13 +1366,14 @@ type PolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Policy is the Schema for the Policys API. Provides an AutoScaling Scaling Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Policy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/autoscaling/v1beta1/zz_schedule_terraformed.go b/apis/autoscaling/v1beta1/zz_schedule_terraformed.go new file mode 100755 index 0000000000..b361a22307 --- /dev/null +++ b/apis/autoscaling/v1beta1/zz_schedule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Schedule +func (mg *Schedule) GetTerraformResourceType() string { + return "aws_autoscaling_schedule" +} + +// GetConnectionDetailsMapping for this Schedule +func (tr *Schedule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Schedule +func (tr *Schedule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Schedule +func (tr *Schedule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Schedule +func (tr *Schedule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Schedule +func (tr *Schedule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Schedule +func (tr *Schedule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Schedule +func (tr *Schedule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Schedule +func (tr *Schedule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Schedule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Schedule) LateInitialize(attrs []byte) (bool, error) { + params := &ScheduleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Schedule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/autoscaling/v1beta1/zz_schedule_types.go b/apis/autoscaling/v1beta1/zz_schedule_types.go index 1b71f3fdc9..3aab2cecd6 100755 --- a/apis/autoscaling/v1beta1/zz_schedule_types.go +++ b/apis/autoscaling/v1beta1/zz_schedule_types.go @@ -146,13 +146,14 @@ type ScheduleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Schedule is the Schema for the Schedules API. Provides an AutoScaling Schedule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Schedule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/autoscalingplans/v1beta1/zz_generated.conversion_hubs.go b/apis/autoscalingplans/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..60c46b978d --- /dev/null +++ b/apis/autoscalingplans/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ScalingPlan) Hub() {} diff --git a/apis/autoscalingplans/v1beta1/zz_generated_terraformed.go b/apis/autoscalingplans/v1beta1/zz_scalingplan_terraformed.go similarity index 100% rename from apis/autoscalingplans/v1beta1/zz_generated_terraformed.go rename to apis/autoscalingplans/v1beta1/zz_scalingplan_terraformed.go diff --git a/apis/autoscalingplans/v1beta1/zz_scalingplan_types.go b/apis/autoscalingplans/v1beta1/zz_scalingplan_types.go index 4797c74e6e..11acf66ff9 100755 --- a/apis/autoscalingplans/v1beta1/zz_scalingplan_types.go +++ b/apis/autoscalingplans/v1beta1/zz_scalingplan_types.go @@ -589,13 +589,14 @@ type ScalingPlanStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ScalingPlan is the Schema for the ScalingPlans API. Manages an AWS Auto Scaling scaling plan. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ScalingPlan struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/backup/v1beta1/zz_framework_terraformed.go b/apis/backup/v1beta1/zz_framework_terraformed.go new file mode 100755 index 0000000000..4f0920e40f --- /dev/null +++ b/apis/backup/v1beta1/zz_framework_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Framework +func (mg *Framework) GetTerraformResourceType() string { + return "aws_backup_framework" +} + +// GetConnectionDetailsMapping for this Framework +func (tr *Framework) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Framework +func (tr *Framework) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Framework +func (tr *Framework) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Framework +func (tr *Framework) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Framework +func (tr *Framework) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Framework +func (tr *Framework) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Framework +func (tr *Framework) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Framework +func (tr *Framework) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Framework using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Framework) LateInitialize(attrs []byte) (bool, error) { + params := &FrameworkParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Framework) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/backup/v1beta1/zz_framework_types.go b/apis/backup/v1beta1/zz_framework_types.go index 01bf0e87fd..dc0eeb24a2 100755 --- a/apis/backup/v1beta1/zz_framework_types.go +++ b/apis/backup/v1beta1/zz_framework_types.go @@ -233,13 +233,14 @@ type FrameworkStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Framework is the Schema for the Frameworks API. Provides an AWS Backup Framework resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Framework struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/backup/v1beta1/zz_generated.conversion_hubs.go b/apis/backup/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..eabe47bf70 --- /dev/null +++ b/apis/backup/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,41 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Framework) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GlobalSettings) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Plan) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RegionSettings) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReportPlan) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Selection) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Vault) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VaultLockConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VaultNotifications) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VaultPolicy) Hub() {} diff --git a/apis/backup/v1beta1/zz_generated_terraformed.go b/apis/backup/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 640a765fca..0000000000 --- a/apis/backup/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1159 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Framework -func (mg *Framework) GetTerraformResourceType() string { - return "aws_backup_framework" -} - -// GetConnectionDetailsMapping for this Framework -func (tr *Framework) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Framework -func (tr *Framework) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Framework -func (tr *Framework) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Framework -func (tr *Framework) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Framework -func (tr *Framework) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Framework -func (tr *Framework) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Framework -func (tr *Framework) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Framework -func (tr *Framework) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Framework using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Framework) LateInitialize(attrs []byte) (bool, error) { - params := &FrameworkParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Framework) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GlobalSettings -func (mg *GlobalSettings) GetTerraformResourceType() string { - return "aws_backup_global_settings" -} - -// GetConnectionDetailsMapping for this GlobalSettings -func (tr *GlobalSettings) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GlobalSettings -func (tr *GlobalSettings) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GlobalSettings -func (tr *GlobalSettings) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GlobalSettings -func (tr *GlobalSettings) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GlobalSettings -func (tr *GlobalSettings) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GlobalSettings -func (tr *GlobalSettings) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GlobalSettings -func (tr *GlobalSettings) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GlobalSettings -func (tr *GlobalSettings) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GlobalSettings using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GlobalSettings) LateInitialize(attrs []byte) (bool, error) { - params := &GlobalSettingsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GlobalSettings) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Plan -func (mg *Plan) GetTerraformResourceType() string { - return "aws_backup_plan" -} - -// GetConnectionDetailsMapping for this Plan -func (tr *Plan) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Plan -func (tr *Plan) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Plan -func (tr *Plan) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Plan -func (tr *Plan) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Plan -func (tr *Plan) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Plan -func (tr *Plan) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Plan -func (tr *Plan) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Plan -func (tr *Plan) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Plan using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Plan) LateInitialize(attrs []byte) (bool, error) { - params := &PlanParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Plan) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RegionSettings -func (mg *RegionSettings) GetTerraformResourceType() string { - return "aws_backup_region_settings" -} - -// GetConnectionDetailsMapping for this RegionSettings -func (tr *RegionSettings) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RegionSettings -func (tr *RegionSettings) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RegionSettings -func (tr *RegionSettings) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RegionSettings -func (tr *RegionSettings) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RegionSettings -func (tr *RegionSettings) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RegionSettings -func (tr *RegionSettings) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RegionSettings -func (tr *RegionSettings) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RegionSettings -func (tr *RegionSettings) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RegionSettings using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RegionSettings) LateInitialize(attrs []byte) (bool, error) { - params := &RegionSettingsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RegionSettings) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReportPlan -func (mg *ReportPlan) GetTerraformResourceType() string { - return "aws_backup_report_plan" -} - -// GetConnectionDetailsMapping for this ReportPlan -func (tr *ReportPlan) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ReportPlan -func (tr *ReportPlan) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReportPlan -func (tr *ReportPlan) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReportPlan -func (tr *ReportPlan) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReportPlan -func (tr *ReportPlan) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReportPlan -func (tr *ReportPlan) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReportPlan -func (tr *ReportPlan) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReportPlan -func (tr *ReportPlan) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReportPlan using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReportPlan) LateInitialize(attrs []byte) (bool, error) { - params := &ReportPlanParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReportPlan) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Selection -func (mg *Selection) GetTerraformResourceType() string { - return "aws_backup_selection" -} - -// GetConnectionDetailsMapping for this Selection -func (tr *Selection) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Selection -func (tr *Selection) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Selection -func (tr *Selection) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Selection -func (tr *Selection) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Selection -func (tr *Selection) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Selection -func (tr *Selection) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Selection -func (tr *Selection) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Selection -func (tr *Selection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Selection using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Selection) LateInitialize(attrs []byte) (bool, error) { - params := &SelectionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Selection) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Vault -func (mg *Vault) GetTerraformResourceType() string { - return "aws_backup_vault" -} - -// GetConnectionDetailsMapping for this Vault -func (tr *Vault) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Vault -func (tr *Vault) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Vault -func (tr *Vault) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Vault -func (tr *Vault) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Vault -func (tr *Vault) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Vault -func (tr *Vault) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Vault -func (tr *Vault) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Vault -func (tr *Vault) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Vault using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Vault) LateInitialize(attrs []byte) (bool, error) { - params := &VaultParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Vault) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VaultLockConfiguration -func (mg *VaultLockConfiguration) GetTerraformResourceType() string { - return "aws_backup_vault_lock_configuration" -} - -// GetConnectionDetailsMapping for this VaultLockConfiguration -func (tr *VaultLockConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VaultLockConfiguration -func (tr *VaultLockConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VaultLockConfiguration -func (tr *VaultLockConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VaultLockConfiguration -func (tr *VaultLockConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VaultLockConfiguration -func (tr *VaultLockConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VaultLockConfiguration -func (tr *VaultLockConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VaultLockConfiguration -func (tr *VaultLockConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VaultLockConfiguration -func (tr *VaultLockConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VaultLockConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VaultLockConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &VaultLockConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VaultLockConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VaultNotifications -func (mg *VaultNotifications) GetTerraformResourceType() string { - return "aws_backup_vault_notifications" -} - -// GetConnectionDetailsMapping for this VaultNotifications -func (tr *VaultNotifications) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VaultNotifications -func (tr *VaultNotifications) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VaultNotifications -func (tr *VaultNotifications) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VaultNotifications -func (tr *VaultNotifications) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VaultNotifications -func (tr *VaultNotifications) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VaultNotifications -func (tr *VaultNotifications) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VaultNotifications -func (tr *VaultNotifications) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VaultNotifications -func (tr *VaultNotifications) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VaultNotifications using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VaultNotifications) LateInitialize(attrs []byte) (bool, error) { - params := &VaultNotificationsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VaultNotifications) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VaultPolicy -func (mg *VaultPolicy) GetTerraformResourceType() string { - return "aws_backup_vault_policy" -} - -// GetConnectionDetailsMapping for this VaultPolicy -func (tr *VaultPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VaultPolicy -func (tr *VaultPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VaultPolicy -func (tr *VaultPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VaultPolicy -func (tr *VaultPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VaultPolicy -func (tr *VaultPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VaultPolicy -func (tr *VaultPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VaultPolicy -func (tr *VaultPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VaultPolicy -func (tr *VaultPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VaultPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VaultPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &VaultPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VaultPolicy) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/backup/v1beta1/zz_globalsettings_terraformed.go b/apis/backup/v1beta1/zz_globalsettings_terraformed.go new file mode 100755 index 0000000000..cb89b14fe3 --- /dev/null +++ b/apis/backup/v1beta1/zz_globalsettings_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GlobalSettings +func (mg *GlobalSettings) GetTerraformResourceType() string { + return "aws_backup_global_settings" +} + +// GetConnectionDetailsMapping for this GlobalSettings +func (tr *GlobalSettings) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GlobalSettings +func (tr *GlobalSettings) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GlobalSettings +func (tr *GlobalSettings) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GlobalSettings +func (tr *GlobalSettings) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GlobalSettings +func (tr *GlobalSettings) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GlobalSettings +func (tr *GlobalSettings) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GlobalSettings +func (tr *GlobalSettings) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GlobalSettings +func (tr *GlobalSettings) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GlobalSettings using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GlobalSettings) LateInitialize(attrs []byte) (bool, error) { + params := &GlobalSettingsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GlobalSettings) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/backup/v1beta1/zz_globalsettings_types.go b/apis/backup/v1beta1/zz_globalsettings_types.go index a185422344..6c665e8ed6 100755 --- a/apis/backup/v1beta1/zz_globalsettings_types.go +++ b/apis/backup/v1beta1/zz_globalsettings_types.go @@ -71,13 +71,14 @@ type GlobalSettingsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GlobalSettings is the Schema for the GlobalSettingss API. Provides an AWS Backup Global Settings resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GlobalSettings struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/backup/v1beta1/zz_plan_terraformed.go b/apis/backup/v1beta1/zz_plan_terraformed.go new file mode 100755 index 0000000000..6946fb19ac --- /dev/null +++ b/apis/backup/v1beta1/zz_plan_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Plan +func (mg *Plan) GetTerraformResourceType() string { + return "aws_backup_plan" +} + +// GetConnectionDetailsMapping for this Plan +func (tr *Plan) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Plan +func (tr *Plan) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Plan +func (tr *Plan) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Plan +func (tr *Plan) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Plan +func (tr *Plan) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Plan +func (tr *Plan) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Plan +func (tr *Plan) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Plan +func (tr *Plan) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Plan using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Plan) LateInitialize(attrs []byte) (bool, error) { + params := &PlanParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Plan) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/backup/v1beta1/zz_plan_types.go b/apis/backup/v1beta1/zz_plan_types.go index 106dd836c7..02014119b3 100755 --- a/apis/backup/v1beta1/zz_plan_types.go +++ b/apis/backup/v1beta1/zz_plan_types.go @@ -350,13 +350,14 @@ type PlanStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Plan is the Schema for the Plans API. Provides an AWS Backup plan resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Plan struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/backup/v1beta1/zz_regionsettings_terraformed.go b/apis/backup/v1beta1/zz_regionsettings_terraformed.go new file mode 100755 index 0000000000..cb08a24ef6 --- /dev/null +++ b/apis/backup/v1beta1/zz_regionsettings_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RegionSettings +func (mg *RegionSettings) GetTerraformResourceType() string { + return "aws_backup_region_settings" +} + +// GetConnectionDetailsMapping for this RegionSettings +func (tr *RegionSettings) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RegionSettings +func (tr *RegionSettings) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RegionSettings +func (tr *RegionSettings) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RegionSettings +func (tr *RegionSettings) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RegionSettings +func (tr *RegionSettings) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RegionSettings +func (tr *RegionSettings) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RegionSettings +func (tr *RegionSettings) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RegionSettings +func (tr *RegionSettings) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RegionSettings using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RegionSettings) LateInitialize(attrs []byte) (bool, error) { + params := &RegionSettingsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RegionSettings) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/backup/v1beta1/zz_regionsettings_types.go b/apis/backup/v1beta1/zz_regionsettings_types.go index cccb915b85..7dafdda1b7 100755 --- a/apis/backup/v1beta1/zz_regionsettings_types.go +++ b/apis/backup/v1beta1/zz_regionsettings_types.go @@ -96,13 +96,14 @@ type RegionSettingsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RegionSettings is the Schema for the RegionSettingss API. Provides an AWS Backup Region Settings resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RegionSettings struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/backup/v1beta1/zz_reportplan_terraformed.go b/apis/backup/v1beta1/zz_reportplan_terraformed.go new file mode 100755 index 0000000000..7f5c65abed --- /dev/null +++ b/apis/backup/v1beta1/zz_reportplan_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReportPlan +func (mg *ReportPlan) GetTerraformResourceType() string { + return "aws_backup_report_plan" +} + +// GetConnectionDetailsMapping for this ReportPlan +func (tr *ReportPlan) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReportPlan +func (tr *ReportPlan) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReportPlan +func (tr *ReportPlan) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReportPlan +func (tr *ReportPlan) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReportPlan +func (tr *ReportPlan) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReportPlan +func (tr *ReportPlan) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReportPlan +func (tr *ReportPlan) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReportPlan +func (tr *ReportPlan) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReportPlan using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReportPlan) LateInitialize(attrs []byte) (bool, error) { + params := &ReportPlanParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReportPlan) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/backup/v1beta1/zz_reportplan_types.go b/apis/backup/v1beta1/zz_reportplan_types.go index 6c5932fb37..751fd954c2 100755 --- a/apis/backup/v1beta1/zz_reportplan_types.go +++ b/apis/backup/v1beta1/zz_reportplan_types.go @@ -247,13 +247,14 @@ type ReportPlanStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReportPlan is the Schema for the ReportPlans API. Provides an AWS Backup Report Plan resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReportPlan struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/backup/v1beta1/zz_selection_terraformed.go b/apis/backup/v1beta1/zz_selection_terraformed.go new file mode 100755 index 0000000000..1646701733 --- /dev/null +++ b/apis/backup/v1beta1/zz_selection_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Selection +func (mg *Selection) GetTerraformResourceType() string { + return "aws_backup_selection" +} + +// GetConnectionDetailsMapping for this Selection +func (tr *Selection) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Selection +func (tr *Selection) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Selection +func (tr *Selection) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Selection +func (tr *Selection) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Selection +func (tr *Selection) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Selection +func (tr *Selection) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Selection +func (tr *Selection) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Selection +func (tr *Selection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Selection using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Selection) LateInitialize(attrs []byte) (bool, error) { + params := &SelectionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Selection) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/backup/v1beta1/zz_selection_types.go b/apis/backup/v1beta1/zz_selection_types.go index f0600d6480..406a5f5c1e 100755 --- a/apis/backup/v1beta1/zz_selection_types.go +++ b/apis/backup/v1beta1/zz_selection_types.go @@ -362,13 +362,14 @@ type SelectionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Selection is the Schema for the Selections API. Manages selection conditions for AWS Backup plan resources. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Selection struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/backup/v1beta1/zz_vault_terraformed.go b/apis/backup/v1beta1/zz_vault_terraformed.go new file mode 100755 index 0000000000..9e4f68f6fd --- /dev/null +++ b/apis/backup/v1beta1/zz_vault_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Vault +func (mg *Vault) GetTerraformResourceType() string { + return "aws_backup_vault" +} + +// GetConnectionDetailsMapping for this Vault +func (tr *Vault) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Vault +func (tr *Vault) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Vault +func (tr *Vault) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Vault +func (tr *Vault) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Vault +func (tr *Vault) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Vault +func (tr *Vault) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Vault +func (tr *Vault) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Vault +func (tr *Vault) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Vault using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Vault) LateInitialize(attrs []byte) (bool, error) { + params := &VaultParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Vault) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/backup/v1beta1/zz_vault_types.go b/apis/backup/v1beta1/zz_vault_types.go index 9b98e5c008..fa785cbf47 100755 --- a/apis/backup/v1beta1/zz_vault_types.go +++ b/apis/backup/v1beta1/zz_vault_types.go @@ -121,13 +121,14 @@ type VaultStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Vault is the Schema for the Vaults API. Provides an AWS Backup vault resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Vault struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/backup/v1beta1/zz_vaultlockconfiguration_terraformed.go b/apis/backup/v1beta1/zz_vaultlockconfiguration_terraformed.go new file mode 100755 index 0000000000..a5893f6f2a --- /dev/null +++ b/apis/backup/v1beta1/zz_vaultlockconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VaultLockConfiguration +func (mg *VaultLockConfiguration) GetTerraformResourceType() string { + return "aws_backup_vault_lock_configuration" +} + +// GetConnectionDetailsMapping for this VaultLockConfiguration +func (tr *VaultLockConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VaultLockConfiguration +func (tr *VaultLockConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VaultLockConfiguration +func (tr *VaultLockConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VaultLockConfiguration +func (tr *VaultLockConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VaultLockConfiguration +func (tr *VaultLockConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VaultLockConfiguration +func (tr *VaultLockConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VaultLockConfiguration +func (tr *VaultLockConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VaultLockConfiguration +func (tr *VaultLockConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VaultLockConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VaultLockConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &VaultLockConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VaultLockConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/backup/v1beta1/zz_vaultlockconfiguration_types.go b/apis/backup/v1beta1/zz_vaultlockconfiguration_types.go index 7e6c3448ac..5e67943959 100755 --- a/apis/backup/v1beta1/zz_vaultlockconfiguration_types.go +++ b/apis/backup/v1beta1/zz_vaultlockconfiguration_types.go @@ -118,13 +118,14 @@ type VaultLockConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VaultLockConfiguration is the Schema for the VaultLockConfigurations API. Provides an AWS Backup vault lock configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VaultLockConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/backup/v1beta1/zz_vaultnotifications_terraformed.go b/apis/backup/v1beta1/zz_vaultnotifications_terraformed.go new file mode 100755 index 0000000000..6a4ff59203 --- /dev/null +++ b/apis/backup/v1beta1/zz_vaultnotifications_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VaultNotifications +func (mg *VaultNotifications) GetTerraformResourceType() string { + return "aws_backup_vault_notifications" +} + +// GetConnectionDetailsMapping for this VaultNotifications +func (tr *VaultNotifications) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VaultNotifications +func (tr *VaultNotifications) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VaultNotifications +func (tr *VaultNotifications) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VaultNotifications +func (tr *VaultNotifications) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VaultNotifications +func (tr *VaultNotifications) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VaultNotifications +func (tr *VaultNotifications) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VaultNotifications +func (tr *VaultNotifications) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VaultNotifications +func (tr *VaultNotifications) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VaultNotifications using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VaultNotifications) LateInitialize(attrs []byte) (bool, error) { + params := &VaultNotificationsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VaultNotifications) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/backup/v1beta1/zz_vaultnotifications_types.go b/apis/backup/v1beta1/zz_vaultnotifications_types.go index dae7a4c628..a65c92bdfa 100755 --- a/apis/backup/v1beta1/zz_vaultnotifications_types.go +++ b/apis/backup/v1beta1/zz_vaultnotifications_types.go @@ -132,13 +132,14 @@ type VaultNotificationsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VaultNotifications is the Schema for the VaultNotificationss API. Provides an AWS Backup vault notifications resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VaultNotifications struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/backup/v1beta1/zz_vaultpolicy_terraformed.go b/apis/backup/v1beta1/zz_vaultpolicy_terraformed.go new file mode 100755 index 0000000000..7b13f30607 --- /dev/null +++ b/apis/backup/v1beta1/zz_vaultpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VaultPolicy +func (mg *VaultPolicy) GetTerraformResourceType() string { + return "aws_backup_vault_policy" +} + +// GetConnectionDetailsMapping for this VaultPolicy +func (tr *VaultPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VaultPolicy +func (tr *VaultPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VaultPolicy +func (tr *VaultPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VaultPolicy +func (tr *VaultPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VaultPolicy +func (tr *VaultPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VaultPolicy +func (tr *VaultPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VaultPolicy +func (tr *VaultPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VaultPolicy +func (tr *VaultPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VaultPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VaultPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &VaultPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VaultPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/backup/v1beta1/zz_vaultpolicy_types.go b/apis/backup/v1beta1/zz_vaultpolicy_types.go index e22406c416..3e78e0f1fe 100755 --- a/apis/backup/v1beta1/zz_vaultpolicy_types.go +++ b/apis/backup/v1beta1/zz_vaultpolicy_types.go @@ -99,13 +99,14 @@ type VaultPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VaultPolicy is the Schema for the VaultPolicys API. Provides an AWS Backup vault policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VaultPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/batch/v1beta1/zz_generated.conversion_hubs.go b/apis/batch/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..66967cda02 --- /dev/null +++ b/apis/batch/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *JobDefinition) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SchedulingPolicy) Hub() {} diff --git a/apis/batch/v1beta1/zz_jobdefinition_terraformed.go b/apis/batch/v1beta1/zz_jobdefinition_terraformed.go new file mode 100755 index 0000000000..ae95bb0cb7 --- /dev/null +++ b/apis/batch/v1beta1/zz_jobdefinition_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this JobDefinition +func (mg *JobDefinition) GetTerraformResourceType() string { + return "aws_batch_job_definition" +} + +// GetConnectionDetailsMapping for this JobDefinition +func (tr *JobDefinition) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this JobDefinition +func (tr *JobDefinition) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this JobDefinition +func (tr *JobDefinition) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this JobDefinition +func (tr *JobDefinition) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this JobDefinition +func (tr *JobDefinition) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this JobDefinition +func (tr *JobDefinition) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this JobDefinition +func (tr *JobDefinition) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this JobDefinition +func (tr *JobDefinition) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this JobDefinition using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *JobDefinition) LateInitialize(attrs []byte) (bool, error) { + params := &JobDefinitionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *JobDefinition) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/batch/v1beta1/zz_jobdefinition_types.go b/apis/batch/v1beta1/zz_jobdefinition_types.go index cf4e450cc9..e1892b3b13 100755 --- a/apis/batch/v1beta1/zz_jobdefinition_types.go +++ b/apis/batch/v1beta1/zz_jobdefinition_types.go @@ -269,13 +269,14 @@ type JobDefinitionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // JobDefinition is the Schema for the JobDefinitions API. Provides a Batch Job Definition resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type JobDefinition struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/batch/v1beta1/zz_generated_terraformed.go b/apis/batch/v1beta1/zz_schedulingpolicy_terraformed.go similarity index 52% rename from apis/batch/v1beta1/zz_generated_terraformed.go rename to apis/batch/v1beta1/zz_schedulingpolicy_terraformed.go index 4e0388bd8b..09bd882121 100755 --- a/apis/batch/v1beta1/zz_generated_terraformed.go +++ b/apis/batch/v1beta1/zz_schedulingpolicy_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this JobDefinition -func (mg *JobDefinition) GetTerraformResourceType() string { - return "aws_batch_job_definition" -} - -// GetConnectionDetailsMapping for this JobDefinition -func (tr *JobDefinition) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this JobDefinition -func (tr *JobDefinition) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this JobDefinition -func (tr *JobDefinition) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this JobDefinition -func (tr *JobDefinition) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this JobDefinition -func (tr *JobDefinition) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this JobDefinition -func (tr *JobDefinition) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this JobDefinition -func (tr *JobDefinition) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this JobDefinition -func (tr *JobDefinition) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this JobDefinition using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *JobDefinition) LateInitialize(attrs []byte) (bool, error) { - params := &JobDefinitionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *JobDefinition) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this SchedulingPolicy func (mg *SchedulingPolicy) GetTerraformResourceType() string { return "aws_batch_scheduling_policy" diff --git a/apis/batch/v1beta1/zz_schedulingpolicy_types.go b/apis/batch/v1beta1/zz_schedulingpolicy_types.go index 2b25c2b92f..bb73b80cfc 100755 --- a/apis/batch/v1beta1/zz_schedulingpolicy_types.go +++ b/apis/batch/v1beta1/zz_schedulingpolicy_types.go @@ -148,13 +148,14 @@ type SchedulingPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SchedulingPolicy is the Schema for the SchedulingPolicys API. Provides a Batch Scheduling Policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SchedulingPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/budgets/v1beta1/zz_budget_terraformed.go b/apis/budgets/v1beta1/zz_budget_terraformed.go new file mode 100755 index 0000000000..7cf1243c2e --- /dev/null +++ b/apis/budgets/v1beta1/zz_budget_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Budget +func (mg *Budget) GetTerraformResourceType() string { + return "aws_budgets_budget" +} + +// GetConnectionDetailsMapping for this Budget +func (tr *Budget) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Budget +func (tr *Budget) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Budget +func (tr *Budget) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Budget +func (tr *Budget) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Budget +func (tr *Budget) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Budget +func (tr *Budget) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Budget +func (tr *Budget) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Budget +func (tr *Budget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Budget using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Budget) LateInitialize(attrs []byte) (bool, error) { + params := &BudgetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Budget) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/budgets/v1beta1/zz_budget_types.go b/apis/budgets/v1beta1/zz_budget_types.go index 0f6b3cd198..c395e1de28 100755 --- a/apis/budgets/v1beta1/zz_budget_types.go +++ b/apis/budgets/v1beta1/zz_budget_types.go @@ -492,13 +492,14 @@ type BudgetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Budget is the Schema for the Budgets API. Provides a budgets budget resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Budget struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/budgets/v1beta1/zz_generated_terraformed.go b/apis/budgets/v1beta1/zz_budgetaction_terraformed.go similarity index 53% rename from apis/budgets/v1beta1/zz_generated_terraformed.go rename to apis/budgets/v1beta1/zz_budgetaction_terraformed.go index dec8ba1e9f..18ee553992 100755 --- a/apis/budgets/v1beta1/zz_generated_terraformed.go +++ b/apis/budgets/v1beta1/zz_budgetaction_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Budget -func (mg *Budget) GetTerraformResourceType() string { - return "aws_budgets_budget" -} - -// GetConnectionDetailsMapping for this Budget -func (tr *Budget) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Budget -func (tr *Budget) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Budget -func (tr *Budget) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Budget -func (tr *Budget) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Budget -func (tr *Budget) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Budget -func (tr *Budget) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Budget -func (tr *Budget) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Budget -func (tr *Budget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Budget using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Budget) LateInitialize(attrs []byte) (bool, error) { - params := &BudgetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Budget) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this BudgetAction func (mg *BudgetAction) GetTerraformResourceType() string { return "aws_budgets_budget_action" diff --git a/apis/budgets/v1beta1/zz_budgetaction_types.go b/apis/budgets/v1beta1/zz_budgetaction_types.go index 39085ff437..d4c3f70878 100755 --- a/apis/budgets/v1beta1/zz_budgetaction_types.go +++ b/apis/budgets/v1beta1/zz_budgetaction_types.go @@ -442,13 +442,14 @@ type BudgetActionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BudgetAction is the Schema for the BudgetActions API. Provides a budget action resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BudgetAction struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/budgets/v1beta1/zz_generated.conversion_hubs.go b/apis/budgets/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..d3cbb687dd --- /dev/null +++ b/apis/budgets/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Budget) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BudgetAction) Hub() {} diff --git a/apis/ce/v1beta1/zz_generated_terraformed.go b/apis/ce/v1beta1/zz_anomalymonitor_terraformed.go similarity index 100% rename from apis/ce/v1beta1/zz_generated_terraformed.go rename to apis/ce/v1beta1/zz_anomalymonitor_terraformed.go diff --git a/apis/ce/v1beta1/zz_anomalymonitor_types.go b/apis/ce/v1beta1/zz_anomalymonitor_types.go index 101695e2c2..4f327afed8 100755 --- a/apis/ce/v1beta1/zz_anomalymonitor_types.go +++ b/apis/ce/v1beta1/zz_anomalymonitor_types.go @@ -118,13 +118,14 @@ type AnomalyMonitorStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AnomalyMonitor is the Schema for the AnomalyMonitors API. Provides a CE Cost Anomaly Monitor // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AnomalyMonitor struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ce/v1beta1/zz_generated.conversion_hubs.go b/apis/ce/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..a9afc9f3cb --- /dev/null +++ b/apis/ce/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AnomalyMonitor) Hub() {} diff --git a/apis/chime/v1beta1/zz_generated.conversion_hubs.go b/apis/chime/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..17569c340a --- /dev/null +++ b/apis/chime/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *VoiceConnector) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VoiceConnectorGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VoiceConnectorLogging) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VoiceConnectorOrigination) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VoiceConnectorStreaming) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VoiceConnectorTermination) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VoiceConnectorTerminationCredentials) Hub() {} diff --git a/apis/chime/v1beta1/zz_generated_terraformed.go b/apis/chime/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 2d9d26f4c0..0000000000 --- a/apis/chime/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,817 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this VoiceConnector -func (mg *VoiceConnector) GetTerraformResourceType() string { - return "aws_chime_voice_connector" -} - -// GetConnectionDetailsMapping for this VoiceConnector -func (tr *VoiceConnector) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VoiceConnector -func (tr *VoiceConnector) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VoiceConnector -func (tr *VoiceConnector) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VoiceConnector -func (tr *VoiceConnector) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VoiceConnector -func (tr *VoiceConnector) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VoiceConnector -func (tr *VoiceConnector) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VoiceConnector -func (tr *VoiceConnector) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VoiceConnector -func (tr *VoiceConnector) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VoiceConnector using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VoiceConnector) LateInitialize(attrs []byte) (bool, error) { - params := &VoiceConnectorParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VoiceConnector) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorGroup -func (mg *VoiceConnectorGroup) GetTerraformResourceType() string { - return "aws_chime_voice_connector_group" -} - -// GetConnectionDetailsMapping for this VoiceConnectorGroup -func (tr *VoiceConnectorGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VoiceConnectorGroup -func (tr *VoiceConnectorGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VoiceConnectorGroup -func (tr *VoiceConnectorGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VoiceConnectorGroup -func (tr *VoiceConnectorGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VoiceConnectorGroup -func (tr *VoiceConnectorGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VoiceConnectorGroup -func (tr *VoiceConnectorGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VoiceConnectorGroup -func (tr *VoiceConnectorGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VoiceConnectorGroup -func (tr *VoiceConnectorGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VoiceConnectorGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VoiceConnectorGroup) LateInitialize(attrs []byte) (bool, error) { - params := &VoiceConnectorGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VoiceConnectorGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorLogging -func (mg *VoiceConnectorLogging) GetTerraformResourceType() string { - return "aws_chime_voice_connector_logging" -} - -// GetConnectionDetailsMapping for this VoiceConnectorLogging -func (tr *VoiceConnectorLogging) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VoiceConnectorLogging -func (tr *VoiceConnectorLogging) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VoiceConnectorLogging -func (tr *VoiceConnectorLogging) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VoiceConnectorLogging -func (tr *VoiceConnectorLogging) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VoiceConnectorLogging -func (tr *VoiceConnectorLogging) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VoiceConnectorLogging -func (tr *VoiceConnectorLogging) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VoiceConnectorLogging -func (tr *VoiceConnectorLogging) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VoiceConnectorLogging -func (tr *VoiceConnectorLogging) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VoiceConnectorLogging using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VoiceConnectorLogging) LateInitialize(attrs []byte) (bool, error) { - params := &VoiceConnectorLoggingParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VoiceConnectorLogging) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorOrigination -func (mg *VoiceConnectorOrigination) GetTerraformResourceType() string { - return "aws_chime_voice_connector_origination" -} - -// GetConnectionDetailsMapping for this VoiceConnectorOrigination -func (tr *VoiceConnectorOrigination) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VoiceConnectorOrigination -func (tr *VoiceConnectorOrigination) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VoiceConnectorOrigination -func (tr *VoiceConnectorOrigination) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VoiceConnectorOrigination -func (tr *VoiceConnectorOrigination) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VoiceConnectorOrigination -func (tr *VoiceConnectorOrigination) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VoiceConnectorOrigination -func (tr *VoiceConnectorOrigination) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VoiceConnectorOrigination -func (tr *VoiceConnectorOrigination) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VoiceConnectorOrigination -func (tr *VoiceConnectorOrigination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VoiceConnectorOrigination using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VoiceConnectorOrigination) LateInitialize(attrs []byte) (bool, error) { - params := &VoiceConnectorOriginationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VoiceConnectorOrigination) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorStreaming -func (mg *VoiceConnectorStreaming) GetTerraformResourceType() string { - return "aws_chime_voice_connector_streaming" -} - -// GetConnectionDetailsMapping for this VoiceConnectorStreaming -func (tr *VoiceConnectorStreaming) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VoiceConnectorStreaming -func (tr *VoiceConnectorStreaming) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VoiceConnectorStreaming -func (tr *VoiceConnectorStreaming) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VoiceConnectorStreaming -func (tr *VoiceConnectorStreaming) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VoiceConnectorStreaming -func (tr *VoiceConnectorStreaming) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VoiceConnectorStreaming -func (tr *VoiceConnectorStreaming) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VoiceConnectorStreaming -func (tr *VoiceConnectorStreaming) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VoiceConnectorStreaming -func (tr *VoiceConnectorStreaming) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VoiceConnectorStreaming using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VoiceConnectorStreaming) LateInitialize(attrs []byte) (bool, error) { - params := &VoiceConnectorStreamingParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VoiceConnectorStreaming) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorTermination -func (mg *VoiceConnectorTermination) GetTerraformResourceType() string { - return "aws_chime_voice_connector_termination" -} - -// GetConnectionDetailsMapping for this VoiceConnectorTermination -func (tr *VoiceConnectorTermination) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VoiceConnectorTermination -func (tr *VoiceConnectorTermination) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VoiceConnectorTermination -func (tr *VoiceConnectorTermination) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VoiceConnectorTermination -func (tr *VoiceConnectorTermination) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VoiceConnectorTermination -func (tr *VoiceConnectorTermination) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VoiceConnectorTermination -func (tr *VoiceConnectorTermination) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VoiceConnectorTermination -func (tr *VoiceConnectorTermination) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VoiceConnectorTermination -func (tr *VoiceConnectorTermination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VoiceConnectorTermination using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VoiceConnectorTermination) LateInitialize(attrs []byte) (bool, error) { - params := &VoiceConnectorTerminationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VoiceConnectorTermination) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorTerminationCredentials -func (mg *VoiceConnectorTerminationCredentials) GetTerraformResourceType() string { - return "aws_chime_voice_connector_termination_credentials" -} - -// GetConnectionDetailsMapping for this VoiceConnectorTerminationCredentials -func (tr *VoiceConnectorTerminationCredentials) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"credentials[*].password": "spec.forProvider.credentials[*].passwordSecretRef"} -} - -// GetObservation of this VoiceConnectorTerminationCredentials -func (tr *VoiceConnectorTerminationCredentials) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VoiceConnectorTerminationCredentials -func (tr *VoiceConnectorTerminationCredentials) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VoiceConnectorTerminationCredentials -func (tr *VoiceConnectorTerminationCredentials) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VoiceConnectorTerminationCredentials -func (tr *VoiceConnectorTerminationCredentials) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VoiceConnectorTerminationCredentials -func (tr *VoiceConnectorTerminationCredentials) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VoiceConnectorTerminationCredentials -func (tr *VoiceConnectorTerminationCredentials) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VoiceConnectorTerminationCredentials -func (tr *VoiceConnectorTerminationCredentials) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VoiceConnectorTerminationCredentials using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VoiceConnectorTerminationCredentials) LateInitialize(attrs []byte) (bool, error) { - params := &VoiceConnectorTerminationCredentialsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VoiceConnectorTerminationCredentials) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/chime/v1beta1/zz_voiceconnector_terraformed.go b/apis/chime/v1beta1/zz_voiceconnector_terraformed.go new file mode 100755 index 0000000000..3e12d77766 --- /dev/null +++ b/apis/chime/v1beta1/zz_voiceconnector_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VoiceConnector +func (mg *VoiceConnector) GetTerraformResourceType() string { + return "aws_chime_voice_connector" +} + +// GetConnectionDetailsMapping for this VoiceConnector +func (tr *VoiceConnector) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VoiceConnector +func (tr *VoiceConnector) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VoiceConnector +func (tr *VoiceConnector) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VoiceConnector +func (tr *VoiceConnector) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VoiceConnector +func (tr *VoiceConnector) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VoiceConnector +func (tr *VoiceConnector) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VoiceConnector +func (tr *VoiceConnector) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VoiceConnector +func (tr *VoiceConnector) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VoiceConnector using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VoiceConnector) LateInitialize(attrs []byte) (bool, error) { + params := &VoiceConnectorParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VoiceConnector) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/chime/v1beta1/zz_voiceconnector_types.go b/apis/chime/v1beta1/zz_voiceconnector_types.go index 6b7e3fb0dc..7de64a98e5 100755 --- a/apis/chime/v1beta1/zz_voiceconnector_types.go +++ b/apis/chime/v1beta1/zz_voiceconnector_types.go @@ -80,13 +80,14 @@ type VoiceConnectorStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VoiceConnector is the Schema for the VoiceConnectors API. Enables you to connect your phone system to the telephone network at a substantial cost savings by using SIP trunking. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VoiceConnector struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/chime/v1beta1/zz_voiceconnectorgroup_terraformed.go b/apis/chime/v1beta1/zz_voiceconnectorgroup_terraformed.go new file mode 100755 index 0000000000..7b9a64d5ba --- /dev/null +++ b/apis/chime/v1beta1/zz_voiceconnectorgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorGroup +func (mg *VoiceConnectorGroup) GetTerraformResourceType() string { + return "aws_chime_voice_connector_group" +} + +// GetConnectionDetailsMapping for this VoiceConnectorGroup +func (tr *VoiceConnectorGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VoiceConnectorGroup +func (tr *VoiceConnectorGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VoiceConnectorGroup +func (tr *VoiceConnectorGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VoiceConnectorGroup +func (tr *VoiceConnectorGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VoiceConnectorGroup +func (tr *VoiceConnectorGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VoiceConnectorGroup +func (tr *VoiceConnectorGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VoiceConnectorGroup +func (tr *VoiceConnectorGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VoiceConnectorGroup +func (tr *VoiceConnectorGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VoiceConnectorGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VoiceConnectorGroup) LateInitialize(attrs []byte) (bool, error) { + params := &VoiceConnectorGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VoiceConnectorGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/chime/v1beta1/zz_voiceconnectorgroup_types.go b/apis/chime/v1beta1/zz_voiceconnectorgroup_types.go index f4134f58c8..1c00af3d88 100755 --- a/apis/chime/v1beta1/zz_voiceconnectorgroup_types.go +++ b/apis/chime/v1beta1/zz_voiceconnectorgroup_types.go @@ -117,13 +117,14 @@ type VoiceConnectorGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VoiceConnectorGroup is the Schema for the VoiceConnectorGroups API. Creates an Amazon Chime Voice Connector group under the administrator's AWS account. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VoiceConnectorGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/chime/v1beta1/zz_voiceconnectorlogging_terraformed.go b/apis/chime/v1beta1/zz_voiceconnectorlogging_terraformed.go new file mode 100755 index 0000000000..9b230f32dd --- /dev/null +++ b/apis/chime/v1beta1/zz_voiceconnectorlogging_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorLogging +func (mg *VoiceConnectorLogging) GetTerraformResourceType() string { + return "aws_chime_voice_connector_logging" +} + +// GetConnectionDetailsMapping for this VoiceConnectorLogging +func (tr *VoiceConnectorLogging) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VoiceConnectorLogging +func (tr *VoiceConnectorLogging) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VoiceConnectorLogging +func (tr *VoiceConnectorLogging) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VoiceConnectorLogging +func (tr *VoiceConnectorLogging) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VoiceConnectorLogging +func (tr *VoiceConnectorLogging) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VoiceConnectorLogging +func (tr *VoiceConnectorLogging) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VoiceConnectorLogging +func (tr *VoiceConnectorLogging) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VoiceConnectorLogging +func (tr *VoiceConnectorLogging) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VoiceConnectorLogging using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VoiceConnectorLogging) LateInitialize(attrs []byte) (bool, error) { + params := &VoiceConnectorLoggingParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VoiceConnectorLogging) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/chime/v1beta1/zz_voiceconnectorlogging_types.go b/apis/chime/v1beta1/zz_voiceconnectorlogging_types.go index 999d638b9d..c91cd79a6b 100755 --- a/apis/chime/v1beta1/zz_voiceconnectorlogging_types.go +++ b/apis/chime/v1beta1/zz_voiceconnectorlogging_types.go @@ -108,13 +108,14 @@ type VoiceConnectorLoggingStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VoiceConnectorLogging is the Schema for the VoiceConnectorLoggings API. Adds a logging configuration for the specified Amazon Chime Voice Connector. The logging configuration specifies whether SIP message logs are enabled for sending to Amazon CloudWatch Logs. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VoiceConnectorLogging struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/chime/v1beta1/zz_voiceconnectororigination_terraformed.go b/apis/chime/v1beta1/zz_voiceconnectororigination_terraformed.go new file mode 100755 index 0000000000..2550e42a5f --- /dev/null +++ b/apis/chime/v1beta1/zz_voiceconnectororigination_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorOrigination +func (mg *VoiceConnectorOrigination) GetTerraformResourceType() string { + return "aws_chime_voice_connector_origination" +} + +// GetConnectionDetailsMapping for this VoiceConnectorOrigination +func (tr *VoiceConnectorOrigination) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VoiceConnectorOrigination +func (tr *VoiceConnectorOrigination) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VoiceConnectorOrigination +func (tr *VoiceConnectorOrigination) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VoiceConnectorOrigination +func (tr *VoiceConnectorOrigination) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VoiceConnectorOrigination +func (tr *VoiceConnectorOrigination) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VoiceConnectorOrigination +func (tr *VoiceConnectorOrigination) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VoiceConnectorOrigination +func (tr *VoiceConnectorOrigination) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VoiceConnectorOrigination +func (tr *VoiceConnectorOrigination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VoiceConnectorOrigination using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VoiceConnectorOrigination) LateInitialize(attrs []byte) (bool, error) { + params := &VoiceConnectorOriginationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VoiceConnectorOrigination) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/chime/v1beta1/zz_voiceconnectororigination_types.go b/apis/chime/v1beta1/zz_voiceconnectororigination_types.go index 9ecaae9b78..4dc98327c5 100755 --- a/apis/chime/v1beta1/zz_voiceconnectororigination_types.go +++ b/apis/chime/v1beta1/zz_voiceconnectororigination_types.go @@ -167,13 +167,14 @@ type VoiceConnectorOriginationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VoiceConnectorOrigination is the Schema for the VoiceConnectorOriginations API. Enable origination settings to control inbound calling to your SIP infrastructure. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VoiceConnectorOrigination struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/chime/v1beta1/zz_voiceconnectorstreaming_terraformed.go b/apis/chime/v1beta1/zz_voiceconnectorstreaming_terraformed.go new file mode 100755 index 0000000000..a6a01cf0fd --- /dev/null +++ b/apis/chime/v1beta1/zz_voiceconnectorstreaming_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorStreaming +func (mg *VoiceConnectorStreaming) GetTerraformResourceType() string { + return "aws_chime_voice_connector_streaming" +} + +// GetConnectionDetailsMapping for this VoiceConnectorStreaming +func (tr *VoiceConnectorStreaming) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VoiceConnectorStreaming +func (tr *VoiceConnectorStreaming) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VoiceConnectorStreaming +func (tr *VoiceConnectorStreaming) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VoiceConnectorStreaming +func (tr *VoiceConnectorStreaming) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VoiceConnectorStreaming +func (tr *VoiceConnectorStreaming) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VoiceConnectorStreaming +func (tr *VoiceConnectorStreaming) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VoiceConnectorStreaming +func (tr *VoiceConnectorStreaming) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VoiceConnectorStreaming +func (tr *VoiceConnectorStreaming) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VoiceConnectorStreaming using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VoiceConnectorStreaming) LateInitialize(attrs []byte) (bool, error) { + params := &VoiceConnectorStreamingParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VoiceConnectorStreaming) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/chime/v1beta1/zz_voiceconnectorstreaming_types.go b/apis/chime/v1beta1/zz_voiceconnectorstreaming_types.go index 9d4c76b424..c296d7b551 100755 --- a/apis/chime/v1beta1/zz_voiceconnectorstreaming_types.go +++ b/apis/chime/v1beta1/zz_voiceconnectorstreaming_types.go @@ -160,13 +160,14 @@ type VoiceConnectorStreamingStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VoiceConnectorStreaming is the Schema for the VoiceConnectorStreamings API. The streaming configuration associated with an Amazon Chime Voice Connector. Specifies whether media streaming is enabled for sending to Amazon Kinesis, and shows the retention period for the Amazon Kinesis data, in hours. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VoiceConnectorStreaming struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/chime/v1beta1/zz_voiceconnectortermination_terraformed.go b/apis/chime/v1beta1/zz_voiceconnectortermination_terraformed.go new file mode 100755 index 0000000000..928153885d --- /dev/null +++ b/apis/chime/v1beta1/zz_voiceconnectortermination_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorTermination +func (mg *VoiceConnectorTermination) GetTerraformResourceType() string { + return "aws_chime_voice_connector_termination" +} + +// GetConnectionDetailsMapping for this VoiceConnectorTermination +func (tr *VoiceConnectorTermination) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VoiceConnectorTermination +func (tr *VoiceConnectorTermination) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VoiceConnectorTermination +func (tr *VoiceConnectorTermination) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VoiceConnectorTermination +func (tr *VoiceConnectorTermination) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VoiceConnectorTermination +func (tr *VoiceConnectorTermination) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VoiceConnectorTermination +func (tr *VoiceConnectorTermination) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VoiceConnectorTermination +func (tr *VoiceConnectorTermination) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VoiceConnectorTermination +func (tr *VoiceConnectorTermination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VoiceConnectorTermination using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VoiceConnectorTermination) LateInitialize(attrs []byte) (bool, error) { + params := &VoiceConnectorTerminationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VoiceConnectorTermination) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/chime/v1beta1/zz_voiceconnectortermination_types.go b/apis/chime/v1beta1/zz_voiceconnectortermination_types.go index d1e59f80f5..aec19d798c 100755 --- a/apis/chime/v1beta1/zz_voiceconnectortermination_types.go +++ b/apis/chime/v1beta1/zz_voiceconnectortermination_types.go @@ -144,13 +144,14 @@ type VoiceConnectorTerminationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VoiceConnectorTermination is the Schema for the VoiceConnectorTerminations API. Enable Termination settings to control outbound calling from your SIP infrastructure. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VoiceConnectorTermination struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/chime/v1beta1/zz_voiceconnectorterminationcredentials_terraformed.go b/apis/chime/v1beta1/zz_voiceconnectorterminationcredentials_terraformed.go new file mode 100755 index 0000000000..cb4b3cc19f --- /dev/null +++ b/apis/chime/v1beta1/zz_voiceconnectorterminationcredentials_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VoiceConnectorTerminationCredentials +func (mg *VoiceConnectorTerminationCredentials) GetTerraformResourceType() string { + return "aws_chime_voice_connector_termination_credentials" +} + +// GetConnectionDetailsMapping for this VoiceConnectorTerminationCredentials +func (tr *VoiceConnectorTerminationCredentials) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"credentials[*].password": "spec.forProvider.credentials[*].passwordSecretRef"} +} + +// GetObservation of this VoiceConnectorTerminationCredentials +func (tr *VoiceConnectorTerminationCredentials) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VoiceConnectorTerminationCredentials +func (tr *VoiceConnectorTerminationCredentials) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VoiceConnectorTerminationCredentials +func (tr *VoiceConnectorTerminationCredentials) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VoiceConnectorTerminationCredentials +func (tr *VoiceConnectorTerminationCredentials) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VoiceConnectorTerminationCredentials +func (tr *VoiceConnectorTerminationCredentials) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VoiceConnectorTerminationCredentials +func (tr *VoiceConnectorTerminationCredentials) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VoiceConnectorTerminationCredentials +func (tr *VoiceConnectorTerminationCredentials) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VoiceConnectorTerminationCredentials using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VoiceConnectorTerminationCredentials) LateInitialize(attrs []byte) (bool, error) { + params := &VoiceConnectorTerminationCredentialsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VoiceConnectorTerminationCredentials) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/chime/v1beta1/zz_voiceconnectorterminationcredentials_types.go b/apis/chime/v1beta1/zz_voiceconnectorterminationcredentials_types.go index b8bce4e694..92db7d1de5 100755 --- a/apis/chime/v1beta1/zz_voiceconnectorterminationcredentials_types.go +++ b/apis/chime/v1beta1/zz_voiceconnectorterminationcredentials_types.go @@ -121,13 +121,14 @@ type VoiceConnectorTerminationCredentialsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VoiceConnectorTerminationCredentials is the Schema for the VoiceConnectorTerminationCredentialss API. Adds termination SIP credentials for the specified Amazon Chime Voice Connector. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VoiceConnectorTerminationCredentials struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloud9/v1beta1/zz_environmentec2_terraformed.go b/apis/cloud9/v1beta1/zz_environmentec2_terraformed.go new file mode 100755 index 0000000000..ef1b42a44c --- /dev/null +++ b/apis/cloud9/v1beta1/zz_environmentec2_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EnvironmentEC2 +func (mg *EnvironmentEC2) GetTerraformResourceType() string { + return "aws_cloud9_environment_ec2" +} + +// GetConnectionDetailsMapping for this EnvironmentEC2 +func (tr *EnvironmentEC2) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EnvironmentEC2 +func (tr *EnvironmentEC2) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EnvironmentEC2 +func (tr *EnvironmentEC2) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EnvironmentEC2 +func (tr *EnvironmentEC2) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EnvironmentEC2 +func (tr *EnvironmentEC2) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EnvironmentEC2 +func (tr *EnvironmentEC2) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EnvironmentEC2 +func (tr *EnvironmentEC2) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EnvironmentEC2 +func (tr *EnvironmentEC2) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EnvironmentEC2 using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EnvironmentEC2) LateInitialize(attrs []byte) (bool, error) { + params := &EnvironmentEC2Parameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EnvironmentEC2) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloud9/v1beta1/zz_environmentec2_types.go b/apis/cloud9/v1beta1/zz_environmentec2_types.go index 8262b086b6..70bb840a16 100755 --- a/apis/cloud9/v1beta1/zz_environmentec2_types.go +++ b/apis/cloud9/v1beta1/zz_environmentec2_types.go @@ -179,13 +179,14 @@ type EnvironmentEC2Status struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EnvironmentEC2 is the Schema for the EnvironmentEC2s API. Provides a Cloud9 EC2 Development Environment. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EnvironmentEC2 struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloud9/v1beta1/zz_generated_terraformed.go b/apis/cloud9/v1beta1/zz_environmentmembership_terraformed.go similarity index 53% rename from apis/cloud9/v1beta1/zz_generated_terraformed.go rename to apis/cloud9/v1beta1/zz_environmentmembership_terraformed.go index 75668cedb1..8201eecbbe 100755 --- a/apis/cloud9/v1beta1/zz_generated_terraformed.go +++ b/apis/cloud9/v1beta1/zz_environmentmembership_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this EnvironmentEC2 -func (mg *EnvironmentEC2) GetTerraformResourceType() string { - return "aws_cloud9_environment_ec2" -} - -// GetConnectionDetailsMapping for this EnvironmentEC2 -func (tr *EnvironmentEC2) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EnvironmentEC2 -func (tr *EnvironmentEC2) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EnvironmentEC2 -func (tr *EnvironmentEC2) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EnvironmentEC2 -func (tr *EnvironmentEC2) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EnvironmentEC2 -func (tr *EnvironmentEC2) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EnvironmentEC2 -func (tr *EnvironmentEC2) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EnvironmentEC2 -func (tr *EnvironmentEC2) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EnvironmentEC2 -func (tr *EnvironmentEC2) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EnvironmentEC2 using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EnvironmentEC2) LateInitialize(attrs []byte) (bool, error) { - params := &EnvironmentEC2Parameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EnvironmentEC2) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this EnvironmentMembership func (mg *EnvironmentMembership) GetTerraformResourceType() string { return "aws_cloud9_environment_membership" diff --git a/apis/cloud9/v1beta1/zz_environmentmembership_types.go b/apis/cloud9/v1beta1/zz_environmentmembership_types.go index a9b6d27560..0bf119a667 100755 --- a/apis/cloud9/v1beta1/zz_environmentmembership_types.go +++ b/apis/cloud9/v1beta1/zz_environmentmembership_types.go @@ -105,13 +105,14 @@ type EnvironmentMembershipStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EnvironmentMembership is the Schema for the EnvironmentMemberships API. Provides an environment member to an AWS Cloud9 development environment. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EnvironmentMembership struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloud9/v1beta1/zz_generated.conversion_hubs.go b/apis/cloud9/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b6d365b610 --- /dev/null +++ b/apis/cloud9/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *EnvironmentEC2) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EnvironmentMembership) Hub() {} diff --git a/apis/cloudcontrol/v1beta1/zz_generated.conversion_hubs.go b/apis/cloudcontrol/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..538190face --- /dev/null +++ b/apis/cloudcontrol/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Resource) Hub() {} diff --git a/apis/cloudcontrol/v1beta1/zz_generated_terraformed.go b/apis/cloudcontrol/v1beta1/zz_resource_terraformed.go similarity index 100% rename from apis/cloudcontrol/v1beta1/zz_generated_terraformed.go rename to apis/cloudcontrol/v1beta1/zz_resource_terraformed.go diff --git a/apis/cloudcontrol/v1beta1/zz_resource_types.go b/apis/cloudcontrol/v1beta1/zz_resource_types.go index c7f64d1d3a..5cf9b60795 100755 --- a/apis/cloudcontrol/v1beta1/zz_resource_types.go +++ b/apis/cloudcontrol/v1beta1/zz_resource_types.go @@ -124,13 +124,14 @@ type ResourceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Resource is the Schema for the Resources API. Manages a Cloud Control API Resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Resource struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudformation/v1beta1/zz_generated.conversion_hubs.go b/apis/cloudformation/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..d67ee52783 --- /dev/null +++ b/apis/cloudformation/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Stack) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *StackSet) Hub() {} diff --git a/apis/cloudformation/v1beta1/zz_stack_terraformed.go b/apis/cloudformation/v1beta1/zz_stack_terraformed.go new file mode 100755 index 0000000000..39dfce9f62 --- /dev/null +++ b/apis/cloudformation/v1beta1/zz_stack_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Stack +func (mg *Stack) GetTerraformResourceType() string { + return "aws_cloudformation_stack" +} + +// GetConnectionDetailsMapping for this Stack +func (tr *Stack) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Stack +func (tr *Stack) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Stack +func (tr *Stack) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Stack +func (tr *Stack) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Stack +func (tr *Stack) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Stack +func (tr *Stack) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Stack +func (tr *Stack) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Stack +func (tr *Stack) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Stack using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Stack) LateInitialize(attrs []byte) (bool, error) { + params := &StackParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Stack) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudformation/v1beta1/zz_stack_types.go b/apis/cloudformation/v1beta1/zz_stack_types.go index aa40749bcf..1864312bd5 100755 --- a/apis/cloudformation/v1beta1/zz_stack_types.go +++ b/apis/cloudformation/v1beta1/zz_stack_types.go @@ -240,13 +240,14 @@ type StackStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Stack is the Schema for the Stacks API. Provides a CloudFormation Stack resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Stack struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudformation/v1beta1/zz_generated_terraformed.go b/apis/cloudformation/v1beta1/zz_stackset_terraformed.go similarity index 52% rename from apis/cloudformation/v1beta1/zz_generated_terraformed.go rename to apis/cloudformation/v1beta1/zz_stackset_terraformed.go index f89ca2f9ad..03b475e709 100755 --- a/apis/cloudformation/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudformation/v1beta1/zz_stackset_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Stack -func (mg *Stack) GetTerraformResourceType() string { - return "aws_cloudformation_stack" -} - -// GetConnectionDetailsMapping for this Stack -func (tr *Stack) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Stack -func (tr *Stack) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Stack -func (tr *Stack) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Stack -func (tr *Stack) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Stack -func (tr *Stack) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Stack -func (tr *Stack) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Stack -func (tr *Stack) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Stack -func (tr *Stack) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Stack using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Stack) LateInitialize(attrs []byte) (bool, error) { - params := &StackParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Stack) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this StackSet func (mg *StackSet) GetTerraformResourceType() string { return "aws_cloudformation_stack_set" diff --git a/apis/cloudformation/v1beta1/zz_stackset_types.go b/apis/cloudformation/v1beta1/zz_stackset_types.go index d3876d729f..1cf33d3f06 100755 --- a/apis/cloudformation/v1beta1/zz_stackset_types.go +++ b/apis/cloudformation/v1beta1/zz_stackset_types.go @@ -315,13 +315,14 @@ type StackSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // StackSet is the Schema for the StackSets API. Manages a CloudFormation StackSet. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type StackSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_cachepolicy_terraformed.go b/apis/cloudfront/v1beta1/zz_cachepolicy_terraformed.go new file mode 100755 index 0000000000..a8a0b2730e --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_cachepolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CachePolicy +func (mg *CachePolicy) GetTerraformResourceType() string { + return "aws_cloudfront_cache_policy" +} + +// GetConnectionDetailsMapping for this CachePolicy +func (tr *CachePolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CachePolicy +func (tr *CachePolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CachePolicy +func (tr *CachePolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CachePolicy +func (tr *CachePolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CachePolicy +func (tr *CachePolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CachePolicy +func (tr *CachePolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CachePolicy +func (tr *CachePolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CachePolicy +func (tr *CachePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CachePolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CachePolicy) LateInitialize(attrs []byte) (bool, error) { + params := &CachePolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CachePolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_cachepolicy_types.go b/apis/cloudfront/v1beta1/zz_cachepolicy_types.go index 4215b8e6d1..b2e2a5a279 100755 --- a/apis/cloudfront/v1beta1/zz_cachepolicy_types.go +++ b/apis/cloudfront/v1beta1/zz_cachepolicy_types.go @@ -333,13 +333,14 @@ type CachePolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CachePolicy is the Schema for the CachePolicys API. Provides a cache policy for a CloudFront ditribution. When it’s attached to a cache behavior, the cache policy determines the values that CloudFront includes in the cache key. These values can include HTTP headers, cookies, and URL query strings. CloudFront uses the cache key to find an object in its cache that it can return to the viewer. It also determines the default, minimum, and maximum time to live (TTL) values that you want objects to stay in the CloudFront cache. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CachePolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_distribution_terraformed.go b/apis/cloudfront/v1beta1/zz_distribution_terraformed.go new file mode 100755 index 0000000000..886d88c7d2 --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_distribution_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Distribution +func (mg *Distribution) GetTerraformResourceType() string { + return "aws_cloudfront_distribution" +} + +// GetConnectionDetailsMapping for this Distribution +func (tr *Distribution) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Distribution +func (tr *Distribution) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Distribution +func (tr *Distribution) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Distribution +func (tr *Distribution) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Distribution +func (tr *Distribution) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Distribution +func (tr *Distribution) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Distribution +func (tr *Distribution) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Distribution +func (tr *Distribution) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Distribution using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Distribution) LateInitialize(attrs []byte) (bool, error) { + params := &DistributionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Distribution) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/cloudfront/v1beta1/zz_distribution_types.go b/apis/cloudfront/v1beta1/zz_distribution_types.go index 96f5e460f7..c565e43940 100755 --- a/apis/cloudfront/v1beta1/zz_distribution_types.go +++ b/apis/cloudfront/v1beta1/zz_distribution_types.go @@ -1677,13 +1677,14 @@ type DistributionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Distribution is the Schema for the Distributions API. Provides a CloudFront web distribution resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Distribution struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_fieldlevelencryptionconfig_terraformed.go b/apis/cloudfront/v1beta1/zz_fieldlevelencryptionconfig_terraformed.go new file mode 100755 index 0000000000..080cc6d5df --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_fieldlevelencryptionconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FieldLevelEncryptionConfig +func (mg *FieldLevelEncryptionConfig) GetTerraformResourceType() string { + return "aws_cloudfront_field_level_encryption_config" +} + +// GetConnectionDetailsMapping for this FieldLevelEncryptionConfig +func (tr *FieldLevelEncryptionConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FieldLevelEncryptionConfig +func (tr *FieldLevelEncryptionConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FieldLevelEncryptionConfig +func (tr *FieldLevelEncryptionConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FieldLevelEncryptionConfig +func (tr *FieldLevelEncryptionConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FieldLevelEncryptionConfig +func (tr *FieldLevelEncryptionConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FieldLevelEncryptionConfig +func (tr *FieldLevelEncryptionConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FieldLevelEncryptionConfig +func (tr *FieldLevelEncryptionConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FieldLevelEncryptionConfig +func (tr *FieldLevelEncryptionConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FieldLevelEncryptionConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FieldLevelEncryptionConfig) LateInitialize(attrs []byte) (bool, error) { + params := &FieldLevelEncryptionConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FieldLevelEncryptionConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_fieldlevelencryptionconfig_types.go b/apis/cloudfront/v1beta1/zz_fieldlevelencryptionconfig_types.go index b5f235ce9a..eb359b7391 100755 --- a/apis/cloudfront/v1beta1/zz_fieldlevelencryptionconfig_types.go +++ b/apis/cloudfront/v1beta1/zz_fieldlevelencryptionconfig_types.go @@ -268,13 +268,14 @@ type FieldLevelEncryptionConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FieldLevelEncryptionConfig is the Schema for the FieldLevelEncryptionConfigs API. Provides a CloudFront Field-level Encryption Config resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FieldLevelEncryptionConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_fieldlevelencryptionprofile_terraformed.go b/apis/cloudfront/v1beta1/zz_fieldlevelencryptionprofile_terraformed.go new file mode 100755 index 0000000000..f285791572 --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_fieldlevelencryptionprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FieldLevelEncryptionProfile +func (mg *FieldLevelEncryptionProfile) GetTerraformResourceType() string { + return "aws_cloudfront_field_level_encryption_profile" +} + +// GetConnectionDetailsMapping for this FieldLevelEncryptionProfile +func (tr *FieldLevelEncryptionProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FieldLevelEncryptionProfile +func (tr *FieldLevelEncryptionProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FieldLevelEncryptionProfile +func (tr *FieldLevelEncryptionProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FieldLevelEncryptionProfile +func (tr *FieldLevelEncryptionProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FieldLevelEncryptionProfile +func (tr *FieldLevelEncryptionProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FieldLevelEncryptionProfile +func (tr *FieldLevelEncryptionProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FieldLevelEncryptionProfile +func (tr *FieldLevelEncryptionProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FieldLevelEncryptionProfile +func (tr *FieldLevelEncryptionProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FieldLevelEncryptionProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FieldLevelEncryptionProfile) LateInitialize(attrs []byte) (bool, error) { + params := &FieldLevelEncryptionProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FieldLevelEncryptionProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_fieldlevelencryptionprofile_types.go b/apis/cloudfront/v1beta1/zz_fieldlevelencryptionprofile_types.go index 42a27feed5..d6ecb6ddfe 100755 --- a/apis/cloudfront/v1beta1/zz_fieldlevelencryptionprofile_types.go +++ b/apis/cloudfront/v1beta1/zz_fieldlevelencryptionprofile_types.go @@ -186,13 +186,14 @@ type FieldLevelEncryptionProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FieldLevelEncryptionProfile is the Schema for the FieldLevelEncryptionProfiles API. Provides a CloudFront Field-level Encryption Profile resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FieldLevelEncryptionProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_function_terraformed.go b/apis/cloudfront/v1beta1/zz_function_terraformed.go new file mode 100755 index 0000000000..0b17670ced --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_function_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Function +func (mg *Function) GetTerraformResourceType() string { + return "aws_cloudfront_function" +} + +// GetConnectionDetailsMapping for this Function +func (tr *Function) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"code": "spec.forProvider.codeSecretRef"} +} + +// GetObservation of this Function +func (tr *Function) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Function +func (tr *Function) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Function +func (tr *Function) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Function +func (tr *Function) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Function +func (tr *Function) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Function +func (tr *Function) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Function +func (tr *Function) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Function using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Function) LateInitialize(attrs []byte) (bool, error) { + params := &FunctionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Function) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_function_types.go b/apis/cloudfront/v1beta1/zz_function_types.go index bd5b22f5dc..0cf6abc35d 100755 --- a/apis/cloudfront/v1beta1/zz_function_types.go +++ b/apis/cloudfront/v1beta1/zz_function_types.go @@ -103,13 +103,14 @@ type FunctionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Function is the Schema for the Functions API. Provides a CloudFront Function resource. With CloudFront Functions in Amazon CloudFront, you can write lightweight functions in JavaScript for high-scale, latency-sensitive CDN customizations. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Function struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_generated.conversion_hubs.go b/apis/cloudfront/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..0a10d51181 --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *CachePolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Distribution) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FieldLevelEncryptionConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FieldLevelEncryptionProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Function) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *KeyGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MonitoringSubscription) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *OriginAccessControl) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *OriginAccessIdentity) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *OriginRequestPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PublicKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RealtimeLogConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResponseHeadersPolicy) Hub() {} diff --git a/apis/cloudfront/v1beta1/zz_generated_terraformed.go b/apis/cloudfront/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 44cf8e35ff..0000000000 --- a/apis/cloudfront/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1501 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this CachePolicy -func (mg *CachePolicy) GetTerraformResourceType() string { - return "aws_cloudfront_cache_policy" -} - -// GetConnectionDetailsMapping for this CachePolicy -func (tr *CachePolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CachePolicy -func (tr *CachePolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CachePolicy -func (tr *CachePolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CachePolicy -func (tr *CachePolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CachePolicy -func (tr *CachePolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CachePolicy -func (tr *CachePolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CachePolicy -func (tr *CachePolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CachePolicy -func (tr *CachePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CachePolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CachePolicy) LateInitialize(attrs []byte) (bool, error) { - params := &CachePolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CachePolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Distribution -func (mg *Distribution) GetTerraformResourceType() string { - return "aws_cloudfront_distribution" -} - -// GetConnectionDetailsMapping for this Distribution -func (tr *Distribution) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Distribution -func (tr *Distribution) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Distribution -func (tr *Distribution) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Distribution -func (tr *Distribution) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Distribution -func (tr *Distribution) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Distribution -func (tr *Distribution) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Distribution -func (tr *Distribution) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Distribution -func (tr *Distribution) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Distribution using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Distribution) LateInitialize(attrs []byte) (bool, error) { - params := &DistributionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Distribution) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this FieldLevelEncryptionConfig -func (mg *FieldLevelEncryptionConfig) GetTerraformResourceType() string { - return "aws_cloudfront_field_level_encryption_config" -} - -// GetConnectionDetailsMapping for this FieldLevelEncryptionConfig -func (tr *FieldLevelEncryptionConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FieldLevelEncryptionConfig -func (tr *FieldLevelEncryptionConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FieldLevelEncryptionConfig -func (tr *FieldLevelEncryptionConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FieldLevelEncryptionConfig -func (tr *FieldLevelEncryptionConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FieldLevelEncryptionConfig -func (tr *FieldLevelEncryptionConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FieldLevelEncryptionConfig -func (tr *FieldLevelEncryptionConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FieldLevelEncryptionConfig -func (tr *FieldLevelEncryptionConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FieldLevelEncryptionConfig -func (tr *FieldLevelEncryptionConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FieldLevelEncryptionConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FieldLevelEncryptionConfig) LateInitialize(attrs []byte) (bool, error) { - params := &FieldLevelEncryptionConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FieldLevelEncryptionConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FieldLevelEncryptionProfile -func (mg *FieldLevelEncryptionProfile) GetTerraformResourceType() string { - return "aws_cloudfront_field_level_encryption_profile" -} - -// GetConnectionDetailsMapping for this FieldLevelEncryptionProfile -func (tr *FieldLevelEncryptionProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FieldLevelEncryptionProfile -func (tr *FieldLevelEncryptionProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FieldLevelEncryptionProfile -func (tr *FieldLevelEncryptionProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FieldLevelEncryptionProfile -func (tr *FieldLevelEncryptionProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FieldLevelEncryptionProfile -func (tr *FieldLevelEncryptionProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FieldLevelEncryptionProfile -func (tr *FieldLevelEncryptionProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FieldLevelEncryptionProfile -func (tr *FieldLevelEncryptionProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FieldLevelEncryptionProfile -func (tr *FieldLevelEncryptionProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FieldLevelEncryptionProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FieldLevelEncryptionProfile) LateInitialize(attrs []byte) (bool, error) { - params := &FieldLevelEncryptionProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FieldLevelEncryptionProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Function -func (mg *Function) GetTerraformResourceType() string { - return "aws_cloudfront_function" -} - -// GetConnectionDetailsMapping for this Function -func (tr *Function) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"code": "spec.forProvider.codeSecretRef"} -} - -// GetObservation of this Function -func (tr *Function) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Function -func (tr *Function) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Function -func (tr *Function) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Function -func (tr *Function) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Function -func (tr *Function) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Function -func (tr *Function) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Function -func (tr *Function) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Function using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Function) LateInitialize(attrs []byte) (bool, error) { - params := &FunctionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Function) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this KeyGroup -func (mg *KeyGroup) GetTerraformResourceType() string { - return "aws_cloudfront_key_group" -} - -// GetConnectionDetailsMapping for this KeyGroup -func (tr *KeyGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this KeyGroup -func (tr *KeyGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this KeyGroup -func (tr *KeyGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this KeyGroup -func (tr *KeyGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this KeyGroup -func (tr *KeyGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this KeyGroup -func (tr *KeyGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this KeyGroup -func (tr *KeyGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this KeyGroup -func (tr *KeyGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this KeyGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *KeyGroup) LateInitialize(attrs []byte) (bool, error) { - params := &KeyGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *KeyGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MonitoringSubscription -func (mg *MonitoringSubscription) GetTerraformResourceType() string { - return "aws_cloudfront_monitoring_subscription" -} - -// GetConnectionDetailsMapping for this MonitoringSubscription -func (tr *MonitoringSubscription) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MonitoringSubscription -func (tr *MonitoringSubscription) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MonitoringSubscription -func (tr *MonitoringSubscription) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MonitoringSubscription -func (tr *MonitoringSubscription) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MonitoringSubscription -func (tr *MonitoringSubscription) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MonitoringSubscription -func (tr *MonitoringSubscription) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MonitoringSubscription -func (tr *MonitoringSubscription) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MonitoringSubscription -func (tr *MonitoringSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MonitoringSubscription using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MonitoringSubscription) LateInitialize(attrs []byte) (bool, error) { - params := &MonitoringSubscriptionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MonitoringSubscription) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this OriginAccessControl -func (mg *OriginAccessControl) GetTerraformResourceType() string { - return "aws_cloudfront_origin_access_control" -} - -// GetConnectionDetailsMapping for this OriginAccessControl -func (tr *OriginAccessControl) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this OriginAccessControl -func (tr *OriginAccessControl) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this OriginAccessControl -func (tr *OriginAccessControl) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this OriginAccessControl -func (tr *OriginAccessControl) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this OriginAccessControl -func (tr *OriginAccessControl) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this OriginAccessControl -func (tr *OriginAccessControl) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this OriginAccessControl -func (tr *OriginAccessControl) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this OriginAccessControl -func (tr *OriginAccessControl) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this OriginAccessControl using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *OriginAccessControl) LateInitialize(attrs []byte) (bool, error) { - params := &OriginAccessControlParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *OriginAccessControl) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this OriginAccessIdentity -func (mg *OriginAccessIdentity) GetTerraformResourceType() string { - return "aws_cloudfront_origin_access_identity" -} - -// GetConnectionDetailsMapping for this OriginAccessIdentity -func (tr *OriginAccessIdentity) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this OriginAccessIdentity -func (tr *OriginAccessIdentity) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this OriginAccessIdentity -func (tr *OriginAccessIdentity) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this OriginAccessIdentity -func (tr *OriginAccessIdentity) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this OriginAccessIdentity -func (tr *OriginAccessIdentity) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this OriginAccessIdentity -func (tr *OriginAccessIdentity) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this OriginAccessIdentity -func (tr *OriginAccessIdentity) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this OriginAccessIdentity -func (tr *OriginAccessIdentity) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this OriginAccessIdentity using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *OriginAccessIdentity) LateInitialize(attrs []byte) (bool, error) { - params := &OriginAccessIdentityParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *OriginAccessIdentity) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this OriginRequestPolicy -func (mg *OriginRequestPolicy) GetTerraformResourceType() string { - return "aws_cloudfront_origin_request_policy" -} - -// GetConnectionDetailsMapping for this OriginRequestPolicy -func (tr *OriginRequestPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this OriginRequestPolicy -func (tr *OriginRequestPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this OriginRequestPolicy -func (tr *OriginRequestPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this OriginRequestPolicy -func (tr *OriginRequestPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this OriginRequestPolicy -func (tr *OriginRequestPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this OriginRequestPolicy -func (tr *OriginRequestPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this OriginRequestPolicy -func (tr *OriginRequestPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this OriginRequestPolicy -func (tr *OriginRequestPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this OriginRequestPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *OriginRequestPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &OriginRequestPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *OriginRequestPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PublicKey -func (mg *PublicKey) GetTerraformResourceType() string { - return "aws_cloudfront_public_key" -} - -// GetConnectionDetailsMapping for this PublicKey -func (tr *PublicKey) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"encoded_key": "spec.forProvider.encodedKeySecretRef"} -} - -// GetObservation of this PublicKey -func (tr *PublicKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PublicKey -func (tr *PublicKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PublicKey -func (tr *PublicKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PublicKey -func (tr *PublicKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PublicKey -func (tr *PublicKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PublicKey -func (tr *PublicKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PublicKey -func (tr *PublicKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PublicKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PublicKey) LateInitialize(attrs []byte) (bool, error) { - params := &PublicKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PublicKey) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RealtimeLogConfig -func (mg *RealtimeLogConfig) GetTerraformResourceType() string { - return "aws_cloudfront_realtime_log_config" -} - -// GetConnectionDetailsMapping for this RealtimeLogConfig -func (tr *RealtimeLogConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RealtimeLogConfig -func (tr *RealtimeLogConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RealtimeLogConfig -func (tr *RealtimeLogConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RealtimeLogConfig -func (tr *RealtimeLogConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RealtimeLogConfig -func (tr *RealtimeLogConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RealtimeLogConfig -func (tr *RealtimeLogConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RealtimeLogConfig -func (tr *RealtimeLogConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RealtimeLogConfig -func (tr *RealtimeLogConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RealtimeLogConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RealtimeLogConfig) LateInitialize(attrs []byte) (bool, error) { - params := &RealtimeLogConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RealtimeLogConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ResponseHeadersPolicy -func (mg *ResponseHeadersPolicy) GetTerraformResourceType() string { - return "aws_cloudfront_response_headers_policy" -} - -// GetConnectionDetailsMapping for this ResponseHeadersPolicy -func (tr *ResponseHeadersPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResponseHeadersPolicy -func (tr *ResponseHeadersPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResponseHeadersPolicy -func (tr *ResponseHeadersPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResponseHeadersPolicy -func (tr *ResponseHeadersPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResponseHeadersPolicy -func (tr *ResponseHeadersPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResponseHeadersPolicy -func (tr *ResponseHeadersPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResponseHeadersPolicy -func (tr *ResponseHeadersPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResponseHeadersPolicy -func (tr *ResponseHeadersPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResponseHeadersPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResponseHeadersPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &ResponseHeadersPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResponseHeadersPolicy) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/cloudfront/v1beta1/zz_keygroup_terraformed.go b/apis/cloudfront/v1beta1/zz_keygroup_terraformed.go new file mode 100755 index 0000000000..0446761ff5 --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_keygroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this KeyGroup +func (mg *KeyGroup) GetTerraformResourceType() string { + return "aws_cloudfront_key_group" +} + +// GetConnectionDetailsMapping for this KeyGroup +func (tr *KeyGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this KeyGroup +func (tr *KeyGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this KeyGroup +func (tr *KeyGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this KeyGroup +func (tr *KeyGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this KeyGroup +func (tr *KeyGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this KeyGroup +func (tr *KeyGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this KeyGroup +func (tr *KeyGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this KeyGroup +func (tr *KeyGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this KeyGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *KeyGroup) LateInitialize(attrs []byte) (bool, error) { + params := &KeyGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *KeyGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_keygroup_types.go b/apis/cloudfront/v1beta1/zz_keygroup_types.go index 173ada9a12..0eeecfd864 100755 --- a/apis/cloudfront/v1beta1/zz_keygroup_types.go +++ b/apis/cloudfront/v1beta1/zz_keygroup_types.go @@ -116,13 +116,14 @@ type KeyGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // KeyGroup is the Schema for the KeyGroups API. Provides a CloudFront key group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type KeyGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_monitoringsubscription_terraformed.go b/apis/cloudfront/v1beta1/zz_monitoringsubscription_terraformed.go new file mode 100755 index 0000000000..09b86d58ea --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_monitoringsubscription_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MonitoringSubscription +func (mg *MonitoringSubscription) GetTerraformResourceType() string { + return "aws_cloudfront_monitoring_subscription" +} + +// GetConnectionDetailsMapping for this MonitoringSubscription +func (tr *MonitoringSubscription) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MonitoringSubscription +func (tr *MonitoringSubscription) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MonitoringSubscription +func (tr *MonitoringSubscription) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MonitoringSubscription +func (tr *MonitoringSubscription) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MonitoringSubscription +func (tr *MonitoringSubscription) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MonitoringSubscription +func (tr *MonitoringSubscription) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MonitoringSubscription +func (tr *MonitoringSubscription) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MonitoringSubscription +func (tr *MonitoringSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MonitoringSubscription using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MonitoringSubscription) LateInitialize(attrs []byte) (bool, error) { + params := &MonitoringSubscriptionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MonitoringSubscription) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_monitoringsubscription_types.go b/apis/cloudfront/v1beta1/zz_monitoringsubscription_types.go index 0273b4190f..f27c6d6638 100755 --- a/apis/cloudfront/v1beta1/zz_monitoringsubscription_types.go +++ b/apis/cloudfront/v1beta1/zz_monitoringsubscription_types.go @@ -136,13 +136,14 @@ type MonitoringSubscriptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MonitoringSubscription is the Schema for the MonitoringSubscriptions API. Provides a CloudFront monitoring subscription resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MonitoringSubscription struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_originaccesscontrol_terraformed.go b/apis/cloudfront/v1beta1/zz_originaccesscontrol_terraformed.go new file mode 100755 index 0000000000..aad30ebda9 --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_originaccesscontrol_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this OriginAccessControl +func (mg *OriginAccessControl) GetTerraformResourceType() string { + return "aws_cloudfront_origin_access_control" +} + +// GetConnectionDetailsMapping for this OriginAccessControl +func (tr *OriginAccessControl) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this OriginAccessControl +func (tr *OriginAccessControl) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this OriginAccessControl +func (tr *OriginAccessControl) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this OriginAccessControl +func (tr *OriginAccessControl) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this OriginAccessControl +func (tr *OriginAccessControl) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this OriginAccessControl +func (tr *OriginAccessControl) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this OriginAccessControl +func (tr *OriginAccessControl) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this OriginAccessControl +func (tr *OriginAccessControl) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this OriginAccessControl using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *OriginAccessControl) LateInitialize(attrs []byte) (bool, error) { + params := &OriginAccessControlParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *OriginAccessControl) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_originaccesscontrol_types.go b/apis/cloudfront/v1beta1/zz_originaccesscontrol_types.go index 34c6036fc9..786ccd29e6 100755 --- a/apis/cloudfront/v1beta1/zz_originaccesscontrol_types.go +++ b/apis/cloudfront/v1beta1/zz_originaccesscontrol_types.go @@ -111,13 +111,14 @@ type OriginAccessControlStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // OriginAccessControl is the Schema for the OriginAccessControls API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type OriginAccessControl struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_originaccessidentity_terraformed.go b/apis/cloudfront/v1beta1/zz_originaccessidentity_terraformed.go new file mode 100755 index 0000000000..631ac5c89c --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_originaccessidentity_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this OriginAccessIdentity +func (mg *OriginAccessIdentity) GetTerraformResourceType() string { + return "aws_cloudfront_origin_access_identity" +} + +// GetConnectionDetailsMapping for this OriginAccessIdentity +func (tr *OriginAccessIdentity) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this OriginAccessIdentity +func (tr *OriginAccessIdentity) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this OriginAccessIdentity +func (tr *OriginAccessIdentity) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this OriginAccessIdentity +func (tr *OriginAccessIdentity) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this OriginAccessIdentity +func (tr *OriginAccessIdentity) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this OriginAccessIdentity +func (tr *OriginAccessIdentity) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this OriginAccessIdentity +func (tr *OriginAccessIdentity) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this OriginAccessIdentity +func (tr *OriginAccessIdentity) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this OriginAccessIdentity using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *OriginAccessIdentity) LateInitialize(attrs []byte) (bool, error) { + params := &OriginAccessIdentityParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *OriginAccessIdentity) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_originaccessidentity_types.go b/apis/cloudfront/v1beta1/zz_originaccessidentity_types.go index 83c2050fa3..d7c631d506 100755 --- a/apis/cloudfront/v1beta1/zz_originaccessidentity_types.go +++ b/apis/cloudfront/v1beta1/zz_originaccessidentity_types.go @@ -89,13 +89,14 @@ type OriginAccessIdentityStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // OriginAccessIdentity is the Schema for the OriginAccessIdentitys API. Provides a CloudFront origin access identity. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type OriginAccessIdentity struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_originrequestpolicy_terraformed.go b/apis/cloudfront/v1beta1/zz_originrequestpolicy_terraformed.go new file mode 100755 index 0000000000..f94beebb80 --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_originrequestpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this OriginRequestPolicy +func (mg *OriginRequestPolicy) GetTerraformResourceType() string { + return "aws_cloudfront_origin_request_policy" +} + +// GetConnectionDetailsMapping for this OriginRequestPolicy +func (tr *OriginRequestPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this OriginRequestPolicy +func (tr *OriginRequestPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this OriginRequestPolicy +func (tr *OriginRequestPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this OriginRequestPolicy +func (tr *OriginRequestPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this OriginRequestPolicy +func (tr *OriginRequestPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this OriginRequestPolicy +func (tr *OriginRequestPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this OriginRequestPolicy +func (tr *OriginRequestPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this OriginRequestPolicy +func (tr *OriginRequestPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this OriginRequestPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *OriginRequestPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &OriginRequestPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *OriginRequestPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_originrequestpolicy_types.go b/apis/cloudfront/v1beta1/zz_originrequestpolicy_types.go index b3ed5f612c..d4e7e9588f 100755 --- a/apis/cloudfront/v1beta1/zz_originrequestpolicy_types.go +++ b/apis/cloudfront/v1beta1/zz_originrequestpolicy_types.go @@ -221,13 +221,14 @@ type OriginRequestPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // OriginRequestPolicy is the Schema for the OriginRequestPolicys API. Determines the values that CloudFront includes in requests that it sends to the origin. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type OriginRequestPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_publickey_terraformed.go b/apis/cloudfront/v1beta1/zz_publickey_terraformed.go new file mode 100755 index 0000000000..60a74a1aec --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_publickey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PublicKey +func (mg *PublicKey) GetTerraformResourceType() string { + return "aws_cloudfront_public_key" +} + +// GetConnectionDetailsMapping for this PublicKey +func (tr *PublicKey) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"encoded_key": "spec.forProvider.encodedKeySecretRef"} +} + +// GetObservation of this PublicKey +func (tr *PublicKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PublicKey +func (tr *PublicKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PublicKey +func (tr *PublicKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PublicKey +func (tr *PublicKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PublicKey +func (tr *PublicKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PublicKey +func (tr *PublicKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PublicKey +func (tr *PublicKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PublicKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PublicKey) LateInitialize(attrs []byte) (bool, error) { + params := &PublicKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PublicKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_publickey_types.go b/apis/cloudfront/v1beta1/zz_publickey_types.go index 2280c63b4b..c1b18b2500 100755 --- a/apis/cloudfront/v1beta1/zz_publickey_types.go +++ b/apis/cloudfront/v1beta1/zz_publickey_types.go @@ -88,13 +88,14 @@ type PublicKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PublicKey is the Schema for the PublicKeys API. Provides a CloudFront Public Key which you add to CloudFront to use with features like field-level encryption. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PublicKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_realtimelogconfig_terraformed.go b/apis/cloudfront/v1beta1/zz_realtimelogconfig_terraformed.go new file mode 100755 index 0000000000..c70cc03369 --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_realtimelogconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RealtimeLogConfig +func (mg *RealtimeLogConfig) GetTerraformResourceType() string { + return "aws_cloudfront_realtime_log_config" +} + +// GetConnectionDetailsMapping for this RealtimeLogConfig +func (tr *RealtimeLogConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RealtimeLogConfig +func (tr *RealtimeLogConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RealtimeLogConfig +func (tr *RealtimeLogConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RealtimeLogConfig +func (tr *RealtimeLogConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RealtimeLogConfig +func (tr *RealtimeLogConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RealtimeLogConfig +func (tr *RealtimeLogConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RealtimeLogConfig +func (tr *RealtimeLogConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RealtimeLogConfig +func (tr *RealtimeLogConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RealtimeLogConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RealtimeLogConfig) LateInitialize(attrs []byte) (bool, error) { + params := &RealtimeLogConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RealtimeLogConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_realtimelogconfig_types.go b/apis/cloudfront/v1beta1/zz_realtimelogconfig_types.go index 2d6138dd11..431b7e638b 100755 --- a/apis/cloudfront/v1beta1/zz_realtimelogconfig_types.go +++ b/apis/cloudfront/v1beta1/zz_realtimelogconfig_types.go @@ -205,13 +205,14 @@ type RealtimeLogConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RealtimeLogConfig is the Schema for the RealtimeLogConfigs API. Provides a CloudFront real-time log configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RealtimeLogConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudfront/v1beta1/zz_responseheaderspolicy_terraformed.go b/apis/cloudfront/v1beta1/zz_responseheaderspolicy_terraformed.go new file mode 100755 index 0000000000..bbb80f67f9 --- /dev/null +++ b/apis/cloudfront/v1beta1/zz_responseheaderspolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResponseHeadersPolicy +func (mg *ResponseHeadersPolicy) GetTerraformResourceType() string { + return "aws_cloudfront_response_headers_policy" +} + +// GetConnectionDetailsMapping for this ResponseHeadersPolicy +func (tr *ResponseHeadersPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResponseHeadersPolicy +func (tr *ResponseHeadersPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResponseHeadersPolicy +func (tr *ResponseHeadersPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResponseHeadersPolicy +func (tr *ResponseHeadersPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResponseHeadersPolicy +func (tr *ResponseHeadersPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResponseHeadersPolicy +func (tr *ResponseHeadersPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResponseHeadersPolicy +func (tr *ResponseHeadersPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResponseHeadersPolicy +func (tr *ResponseHeadersPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResponseHeadersPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResponseHeadersPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &ResponseHeadersPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResponseHeadersPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudfront/v1beta1/zz_responseheaderspolicy_types.go b/apis/cloudfront/v1beta1/zz_responseheaderspolicy_types.go index 4c82e52910..de69518d9e 100755 --- a/apis/cloudfront/v1beta1/zz_responseheaderspolicy_types.go +++ b/apis/cloudfront/v1beta1/zz_responseheaderspolicy_types.go @@ -681,13 +681,14 @@ type ResponseHeadersPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResponseHeadersPolicy is the Schema for the ResponseHeadersPolicys API. Provides a CloudFront response headers policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResponseHeadersPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudsearch/v1beta1/zz_domain_terraformed.go b/apis/cloudsearch/v1beta1/zz_domain_terraformed.go new file mode 100755 index 0000000000..2002d78f33 --- /dev/null +++ b/apis/cloudsearch/v1beta1/zz_domain_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Domain +func (mg *Domain) GetTerraformResourceType() string { + return "aws_cloudsearch_domain" +} + +// GetConnectionDetailsMapping for this Domain +func (tr *Domain) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Domain +func (tr *Domain) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Domain +func (tr *Domain) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Domain +func (tr *Domain) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Domain +func (tr *Domain) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Domain +func (tr *Domain) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Domain +func (tr *Domain) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Domain +func (tr *Domain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Domain using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Domain) LateInitialize(attrs []byte) (bool, error) { + params := &DomainParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Domain) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudsearch/v1beta1/zz_domain_types.go b/apis/cloudsearch/v1beta1/zz_domain_types.go index 942243eb33..5aee5c4ea2 100755 --- a/apis/cloudsearch/v1beta1/zz_domain_types.go +++ b/apis/cloudsearch/v1beta1/zz_domain_types.go @@ -286,13 +286,14 @@ type DomainStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Domain is the Schema for the Domains API. Provides an CloudSearch domain resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Domain struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudsearch/v1beta1/zz_generated_terraformed.go b/apis/cloudsearch/v1beta1/zz_domainserviceaccesspolicy_terraformed.go similarity index 55% rename from apis/cloudsearch/v1beta1/zz_generated_terraformed.go rename to apis/cloudsearch/v1beta1/zz_domainserviceaccesspolicy_terraformed.go index eaacf85a1a..624a06b77a 100755 --- a/apis/cloudsearch/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudsearch/v1beta1/zz_domainserviceaccesspolicy_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Domain -func (mg *Domain) GetTerraformResourceType() string { - return "aws_cloudsearch_domain" -} - -// GetConnectionDetailsMapping for this Domain -func (tr *Domain) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Domain -func (tr *Domain) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Domain -func (tr *Domain) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Domain -func (tr *Domain) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Domain -func (tr *Domain) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Domain -func (tr *Domain) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Domain -func (tr *Domain) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Domain -func (tr *Domain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Domain using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Domain) LateInitialize(attrs []byte) (bool, error) { - params := &DomainParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Domain) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this DomainServiceAccessPolicy func (mg *DomainServiceAccessPolicy) GetTerraformResourceType() string { return "aws_cloudsearch_domain_service_access_policy" diff --git a/apis/cloudsearch/v1beta1/zz_domainserviceaccesspolicy_types.go b/apis/cloudsearch/v1beta1/zz_domainserviceaccesspolicy_types.go index c3ac0848d5..6c7cd9bfa4 100755 --- a/apis/cloudsearch/v1beta1/zz_domainserviceaccesspolicy_types.go +++ b/apis/cloudsearch/v1beta1/zz_domainserviceaccesspolicy_types.go @@ -97,13 +97,14 @@ type DomainServiceAccessPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DomainServiceAccessPolicy is the Schema for the DomainServiceAccessPolicys API. Provides an CloudSearch domain service access policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DomainServiceAccessPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudsearch/v1beta1/zz_generated.conversion_hubs.go b/apis/cloudsearch/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..464bd40c8e --- /dev/null +++ b/apis/cloudsearch/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Domain) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DomainServiceAccessPolicy) Hub() {} diff --git a/apis/cloudtrail/v1beta1/zz_generated_terraformed.go b/apis/cloudtrail/v1beta1/zz_eventdatastore_terraformed.go similarity index 53% rename from apis/cloudtrail/v1beta1/zz_generated_terraformed.go rename to apis/cloudtrail/v1beta1/zz_eventdatastore_terraformed.go index 37c8feb0b6..36b7f1135e 100755 --- a/apis/cloudtrail/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudtrail/v1beta1/zz_eventdatastore_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Trail -func (mg *Trail) GetTerraformResourceType() string { - return "aws_cloudtrail" -} - -// GetConnectionDetailsMapping for this Trail -func (tr *Trail) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Trail -func (tr *Trail) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Trail -func (tr *Trail) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Trail -func (tr *Trail) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Trail -func (tr *Trail) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Trail -func (tr *Trail) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Trail -func (tr *Trail) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Trail -func (tr *Trail) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Trail using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Trail) LateInitialize(attrs []byte) (bool, error) { - params := &TrailParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Trail) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this EventDataStore func (mg *EventDataStore) GetTerraformResourceType() string { return "aws_cloudtrail_event_data_store" diff --git a/apis/cloudtrail/v1beta1/zz_eventdatastore_types.go b/apis/cloudtrail/v1beta1/zz_eventdatastore_types.go index 4aaa65f45c..b8be1be3b6 100755 --- a/apis/cloudtrail/v1beta1/zz_eventdatastore_types.go +++ b/apis/cloudtrail/v1beta1/zz_eventdatastore_types.go @@ -274,13 +274,14 @@ type EventDataStoreStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EventDataStore is the Schema for the EventDataStores API. Provides a CloudTrail Event Data Store resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EventDataStore struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudtrail/v1beta1/zz_generated.conversion_hubs.go b/apis/cloudtrail/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b0030956f7 --- /dev/null +++ b/apis/cloudtrail/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Trail) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EventDataStore) Hub() {} diff --git a/apis/cloudtrail/v1beta1/zz_trail_terraformed.go b/apis/cloudtrail/v1beta1/zz_trail_terraformed.go new file mode 100755 index 0000000000..8ade648ca7 --- /dev/null +++ b/apis/cloudtrail/v1beta1/zz_trail_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Trail +func (mg *Trail) GetTerraformResourceType() string { + return "aws_cloudtrail" +} + +// GetConnectionDetailsMapping for this Trail +func (tr *Trail) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Trail +func (tr *Trail) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Trail +func (tr *Trail) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Trail +func (tr *Trail) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Trail +func (tr *Trail) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Trail +func (tr *Trail) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Trail +func (tr *Trail) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Trail +func (tr *Trail) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Trail using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Trail) LateInitialize(attrs []byte) (bool, error) { + params := &TrailParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Trail) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudtrail/v1beta1/zz_trail_types.go b/apis/cloudtrail/v1beta1/zz_trail_types.go index aa8fb3fb73..1127812a5d 100755 --- a/apis/cloudtrail/v1beta1/zz_trail_types.go +++ b/apis/cloudtrail/v1beta1/zz_trail_types.go @@ -487,13 +487,14 @@ type TrailStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Trail is the Schema for the Trails API. Provides a CloudTrail resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Trail struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatch/v1beta1/zz_compositealarm_terraformed.go b/apis/cloudwatch/v1beta1/zz_compositealarm_terraformed.go new file mode 100755 index 0000000000..5b3631e4a5 --- /dev/null +++ b/apis/cloudwatch/v1beta1/zz_compositealarm_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CompositeAlarm +func (mg *CompositeAlarm) GetTerraformResourceType() string { + return "aws_cloudwatch_composite_alarm" +} + +// GetConnectionDetailsMapping for this CompositeAlarm +func (tr *CompositeAlarm) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CompositeAlarm +func (tr *CompositeAlarm) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CompositeAlarm +func (tr *CompositeAlarm) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CompositeAlarm +func (tr *CompositeAlarm) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CompositeAlarm +func (tr *CompositeAlarm) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CompositeAlarm +func (tr *CompositeAlarm) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CompositeAlarm +func (tr *CompositeAlarm) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CompositeAlarm +func (tr *CompositeAlarm) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CompositeAlarm using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CompositeAlarm) LateInitialize(attrs []byte) (bool, error) { + params := &CompositeAlarmParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CompositeAlarm) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatch/v1beta1/zz_compositealarm_types.go b/apis/cloudwatch/v1beta1/zz_compositealarm_types.go index d656c046fb..3168f5e9ed 100755 --- a/apis/cloudwatch/v1beta1/zz_compositealarm_types.go +++ b/apis/cloudwatch/v1beta1/zz_compositealarm_types.go @@ -187,13 +187,14 @@ type CompositeAlarmStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CompositeAlarm is the Schema for the CompositeAlarms API. Provides a CloudWatch Composite Alarm resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CompositeAlarm struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatch/v1beta1/zz_dashboard_terraformed.go b/apis/cloudwatch/v1beta1/zz_dashboard_terraformed.go new file mode 100755 index 0000000000..8dfc064805 --- /dev/null +++ b/apis/cloudwatch/v1beta1/zz_dashboard_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Dashboard +func (mg *Dashboard) GetTerraformResourceType() string { + return "aws_cloudwatch_dashboard" +} + +// GetConnectionDetailsMapping for this Dashboard +func (tr *Dashboard) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Dashboard +func (tr *Dashboard) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Dashboard +func (tr *Dashboard) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Dashboard +func (tr *Dashboard) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Dashboard +func (tr *Dashboard) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Dashboard +func (tr *Dashboard) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Dashboard +func (tr *Dashboard) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Dashboard +func (tr *Dashboard) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Dashboard using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Dashboard) LateInitialize(attrs []byte) (bool, error) { + params := &DashboardParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Dashboard) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatch/v1beta1/zz_dashboard_types.go b/apis/cloudwatch/v1beta1/zz_dashboard_types.go index b6eeabbdd0..0de01f289a 100755 --- a/apis/cloudwatch/v1beta1/zz_dashboard_types.go +++ b/apis/cloudwatch/v1beta1/zz_dashboard_types.go @@ -70,13 +70,14 @@ type DashboardStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Dashboard is the Schema for the Dashboards API. Provides a CloudWatch Dashboard resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Dashboard struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatch/v1beta1/zz_generated.conversion_hubs.go b/apis/cloudwatch/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..78e0040085 --- /dev/null +++ b/apis/cloudwatch/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *CompositeAlarm) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Dashboard) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MetricAlarm) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MetricStream) Hub() {} diff --git a/apis/cloudwatch/v1beta1/zz_generated_terraformed.go b/apis/cloudwatch/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index f04328ac7a..0000000000 --- a/apis/cloudwatch/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this CompositeAlarm -func (mg *CompositeAlarm) GetTerraformResourceType() string { - return "aws_cloudwatch_composite_alarm" -} - -// GetConnectionDetailsMapping for this CompositeAlarm -func (tr *CompositeAlarm) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CompositeAlarm -func (tr *CompositeAlarm) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CompositeAlarm -func (tr *CompositeAlarm) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CompositeAlarm -func (tr *CompositeAlarm) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CompositeAlarm -func (tr *CompositeAlarm) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CompositeAlarm -func (tr *CompositeAlarm) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CompositeAlarm -func (tr *CompositeAlarm) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CompositeAlarm -func (tr *CompositeAlarm) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CompositeAlarm using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CompositeAlarm) LateInitialize(attrs []byte) (bool, error) { - params := &CompositeAlarmParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CompositeAlarm) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Dashboard -func (mg *Dashboard) GetTerraformResourceType() string { - return "aws_cloudwatch_dashboard" -} - -// GetConnectionDetailsMapping for this Dashboard -func (tr *Dashboard) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Dashboard -func (tr *Dashboard) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Dashboard -func (tr *Dashboard) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Dashboard -func (tr *Dashboard) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Dashboard -func (tr *Dashboard) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Dashboard -func (tr *Dashboard) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Dashboard -func (tr *Dashboard) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Dashboard -func (tr *Dashboard) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Dashboard using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Dashboard) LateInitialize(attrs []byte) (bool, error) { - params := &DashboardParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Dashboard) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MetricAlarm -func (mg *MetricAlarm) GetTerraformResourceType() string { - return "aws_cloudwatch_metric_alarm" -} - -// GetConnectionDetailsMapping for this MetricAlarm -func (tr *MetricAlarm) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MetricAlarm -func (tr *MetricAlarm) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MetricAlarm -func (tr *MetricAlarm) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MetricAlarm -func (tr *MetricAlarm) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MetricAlarm -func (tr *MetricAlarm) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MetricAlarm -func (tr *MetricAlarm) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MetricAlarm -func (tr *MetricAlarm) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MetricAlarm -func (tr *MetricAlarm) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MetricAlarm using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MetricAlarm) LateInitialize(attrs []byte) (bool, error) { - params := &MetricAlarmParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MetricAlarm) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this MetricStream -func (mg *MetricStream) GetTerraformResourceType() string { - return "aws_cloudwatch_metric_stream" -} - -// GetConnectionDetailsMapping for this MetricStream -func (tr *MetricStream) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MetricStream -func (tr *MetricStream) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MetricStream -func (tr *MetricStream) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MetricStream -func (tr *MetricStream) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MetricStream -func (tr *MetricStream) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MetricStream -func (tr *MetricStream) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MetricStream -func (tr *MetricStream) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MetricStream -func (tr *MetricStream) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MetricStream using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MetricStream) LateInitialize(attrs []byte) (bool, error) { - params := &MetricStreamParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MetricStream) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/cloudwatch/v1beta1/zz_metricalarm_terraformed.go b/apis/cloudwatch/v1beta1/zz_metricalarm_terraformed.go new file mode 100755 index 0000000000..8703c8e5aa --- /dev/null +++ b/apis/cloudwatch/v1beta1/zz_metricalarm_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MetricAlarm +func (mg *MetricAlarm) GetTerraformResourceType() string { + return "aws_cloudwatch_metric_alarm" +} + +// GetConnectionDetailsMapping for this MetricAlarm +func (tr *MetricAlarm) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MetricAlarm +func (tr *MetricAlarm) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MetricAlarm +func (tr *MetricAlarm) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MetricAlarm +func (tr *MetricAlarm) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MetricAlarm +func (tr *MetricAlarm) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MetricAlarm +func (tr *MetricAlarm) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MetricAlarm +func (tr *MetricAlarm) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MetricAlarm +func (tr *MetricAlarm) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MetricAlarm using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MetricAlarm) LateInitialize(attrs []byte) (bool, error) { + params := &MetricAlarmParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MetricAlarm) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/cloudwatch/v1beta1/zz_metricalarm_types.go b/apis/cloudwatch/v1beta1/zz_metricalarm_types.go index dc709fed3e..a5f77d9bbd 100755 --- a/apis/cloudwatch/v1beta1/zz_metricalarm_types.go +++ b/apis/cloudwatch/v1beta1/zz_metricalarm_types.go @@ -483,13 +483,14 @@ type MetricAlarmStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MetricAlarm is the Schema for the MetricAlarms API. Provides a CloudWatch Metric Alarm resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MetricAlarm struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatch/v1beta1/zz_metricstream_terraformed.go b/apis/cloudwatch/v1beta1/zz_metricstream_terraformed.go new file mode 100755 index 0000000000..53cf9a417d --- /dev/null +++ b/apis/cloudwatch/v1beta1/zz_metricstream_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MetricStream +func (mg *MetricStream) GetTerraformResourceType() string { + return "aws_cloudwatch_metric_stream" +} + +// GetConnectionDetailsMapping for this MetricStream +func (tr *MetricStream) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MetricStream +func (tr *MetricStream) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MetricStream +func (tr *MetricStream) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MetricStream +func (tr *MetricStream) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MetricStream +func (tr *MetricStream) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MetricStream +func (tr *MetricStream) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MetricStream +func (tr *MetricStream) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MetricStream +func (tr *MetricStream) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MetricStream using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MetricStream) LateInitialize(attrs []byte) (bool, error) { + params := &MetricStreamParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MetricStream) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatch/v1beta1/zz_metricstream_types.go b/apis/cloudwatch/v1beta1/zz_metricstream_types.go index 1732fa4023..4f81ba1afb 100755 --- a/apis/cloudwatch/v1beta1/zz_metricstream_types.go +++ b/apis/cloudwatch/v1beta1/zz_metricstream_types.go @@ -331,13 +331,14 @@ type MetricStreamStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MetricStream is the Schema for the MetricStreams API. Provides a CloudWatch Metric Stream resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MetricStream struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchevents/v1beta1/zz_apidestination_terraformed.go b/apis/cloudwatchevents/v1beta1/zz_apidestination_terraformed.go new file mode 100755 index 0000000000..055748c063 --- /dev/null +++ b/apis/cloudwatchevents/v1beta1/zz_apidestination_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this APIDestination +func (mg *APIDestination) GetTerraformResourceType() string { + return "aws_cloudwatch_event_api_destination" +} + +// GetConnectionDetailsMapping for this APIDestination +func (tr *APIDestination) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this APIDestination +func (tr *APIDestination) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this APIDestination +func (tr *APIDestination) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this APIDestination +func (tr *APIDestination) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this APIDestination +func (tr *APIDestination) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this APIDestination +func (tr *APIDestination) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this APIDestination +func (tr *APIDestination) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this APIDestination +func (tr *APIDestination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this APIDestination using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *APIDestination) LateInitialize(attrs []byte) (bool, error) { + params := &APIDestinationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *APIDestination) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchevents/v1beta1/zz_apidestination_types.go b/apis/cloudwatchevents/v1beta1/zz_apidestination_types.go index 25c539aef9..f0f5adefdd 100755 --- a/apis/cloudwatchevents/v1beta1/zz_apidestination_types.go +++ b/apis/cloudwatchevents/v1beta1/zz_apidestination_types.go @@ -130,13 +130,14 @@ type APIDestinationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // APIDestination is the Schema for the APIDestinations API. Provides an EventBridge event API Destination resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type APIDestination struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchevents/v1beta1/zz_archive_terraformed.go b/apis/cloudwatchevents/v1beta1/zz_archive_terraformed.go new file mode 100755 index 0000000000..af47094d6c --- /dev/null +++ b/apis/cloudwatchevents/v1beta1/zz_archive_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Archive +func (mg *Archive) GetTerraformResourceType() string { + return "aws_cloudwatch_event_archive" +} + +// GetConnectionDetailsMapping for this Archive +func (tr *Archive) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Archive +func (tr *Archive) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Archive +func (tr *Archive) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Archive +func (tr *Archive) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Archive +func (tr *Archive) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Archive +func (tr *Archive) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Archive +func (tr *Archive) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Archive +func (tr *Archive) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Archive using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Archive) LateInitialize(attrs []byte) (bool, error) { + params := &ArchiveParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Archive) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchevents/v1beta1/zz_archive_types.go b/apis/cloudwatchevents/v1beta1/zz_archive_types.go index e00fe94875..d5a790b2fb 100755 --- a/apis/cloudwatchevents/v1beta1/zz_archive_types.go +++ b/apis/cloudwatchevents/v1beta1/zz_archive_types.go @@ -120,13 +120,14 @@ type ArchiveStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Archive is the Schema for the Archives API. Provides an EventBridge event archive resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Archive struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchevents/v1beta1/zz_bus_terraformed.go b/apis/cloudwatchevents/v1beta1/zz_bus_terraformed.go new file mode 100755 index 0000000000..e913b1634d --- /dev/null +++ b/apis/cloudwatchevents/v1beta1/zz_bus_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Bus +func (mg *Bus) GetTerraformResourceType() string { + return "aws_cloudwatch_event_bus" +} + +// GetConnectionDetailsMapping for this Bus +func (tr *Bus) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Bus +func (tr *Bus) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Bus +func (tr *Bus) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Bus +func (tr *Bus) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Bus +func (tr *Bus) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Bus +func (tr *Bus) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Bus +func (tr *Bus) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Bus +func (tr *Bus) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Bus using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Bus) LateInitialize(attrs []byte) (bool, error) { + params := &BusParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Bus) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchevents/v1beta1/zz_bus_types.go b/apis/cloudwatchevents/v1beta1/zz_bus_types.go index dec2bcf359..498f4ba5cf 100755 --- a/apis/cloudwatchevents/v1beta1/zz_bus_types.go +++ b/apis/cloudwatchevents/v1beta1/zz_bus_types.go @@ -87,13 +87,14 @@ type BusStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Bus is the Schema for the Buss API. Provides an EventBridge event bus resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Bus struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchevents/v1beta1/zz_buspolicy_terraformed.go b/apis/cloudwatchevents/v1beta1/zz_buspolicy_terraformed.go new file mode 100755 index 0000000000..eeffaca095 --- /dev/null +++ b/apis/cloudwatchevents/v1beta1/zz_buspolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BusPolicy +func (mg *BusPolicy) GetTerraformResourceType() string { + return "aws_cloudwatch_event_bus_policy" +} + +// GetConnectionDetailsMapping for this BusPolicy +func (tr *BusPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BusPolicy +func (tr *BusPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BusPolicy +func (tr *BusPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BusPolicy +func (tr *BusPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BusPolicy +func (tr *BusPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BusPolicy +func (tr *BusPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BusPolicy +func (tr *BusPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BusPolicy +func (tr *BusPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BusPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BusPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &BusPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BusPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchevents/v1beta1/zz_buspolicy_types.go b/apis/cloudwatchevents/v1beta1/zz_buspolicy_types.go index 5b6952459f..418d273920 100755 --- a/apis/cloudwatchevents/v1beta1/zz_buspolicy_types.go +++ b/apis/cloudwatchevents/v1beta1/zz_buspolicy_types.go @@ -99,13 +99,14 @@ type BusPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BusPolicy is the Schema for the BusPolicys API. Provides a resource to create an EventBridge policy to support cross-account events. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BusPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchevents/v1beta1/zz_connection_terraformed.go b/apis/cloudwatchevents/v1beta1/zz_connection_terraformed.go new file mode 100755 index 0000000000..2a6e2d9f60 --- /dev/null +++ b/apis/cloudwatchevents/v1beta1/zz_connection_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Connection +func (mg *Connection) GetTerraformResourceType() string { + return "aws_cloudwatch_event_connection" +} + +// GetConnectionDetailsMapping for this Connection +func (tr *Connection) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"auth_parameters[*].api_key[*].value": "spec.forProvider.authParameters[*].apiKey[*].valueSecretRef", "auth_parameters[*].basic[*].password": "spec.forProvider.authParameters[*].basic[*].passwordSecretRef", "auth_parameters[*].invocation_http_parameters[*].body[*].value": "spec.forProvider.authParameters[*].invocationHttpParameters[*].body[*].valueSecretRef", "auth_parameters[*].invocation_http_parameters[*].header[*].value": "spec.forProvider.authParameters[*].invocationHttpParameters[*].header[*].valueSecretRef", "auth_parameters[*].invocation_http_parameters[*].query_string[*].value": "spec.forProvider.authParameters[*].invocationHttpParameters[*].queryString[*].valueSecretRef", "auth_parameters[*].oauth[*].client_parameters[*].client_secret": "spec.forProvider.authParameters[*].oauth[*].clientParameters[*].clientSecretSecretRef", "auth_parameters[*].oauth[*].oauth_http_parameters[*].body[*].value": "spec.forProvider.authParameters[*].oauth[*].oauthHttpParameters[*].body[*].valueSecretRef", "auth_parameters[*].oauth[*].oauth_http_parameters[*].header[*].value": "spec.forProvider.authParameters[*].oauth[*].oauthHttpParameters[*].header[*].valueSecretRef", "auth_parameters[*].oauth[*].oauth_http_parameters[*].query_string[*].value": "spec.forProvider.authParameters[*].oauth[*].oauthHttpParameters[*].queryString[*].valueSecretRef"} +} + +// GetObservation of this Connection +func (tr *Connection) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Connection +func (tr *Connection) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Connection +func (tr *Connection) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Connection +func (tr *Connection) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Connection +func (tr *Connection) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Connection +func (tr *Connection) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Connection +func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Connection using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { + params := &ConnectionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Connection) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchevents/v1beta1/zz_connection_types.go b/apis/cloudwatchevents/v1beta1/zz_connection_types.go index aeca942ae5..9c6e2ae50d 100755 --- a/apis/cloudwatchevents/v1beta1/zz_connection_types.go +++ b/apis/cloudwatchevents/v1beta1/zz_connection_types.go @@ -536,13 +536,14 @@ type ConnectionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Connection is the Schema for the Connections API. Provides an EventBridge connection resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Connection struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchevents/v1beta1/zz_generated.conversion_hubs.go b/apis/cloudwatchevents/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..036c156353 --- /dev/null +++ b/apis/cloudwatchevents/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *APIDestination) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Archive) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Bus) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BusPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Connection) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Permission) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Rule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Target) Hub() {} diff --git a/apis/cloudwatchevents/v1beta1/zz_generated_terraformed.go b/apis/cloudwatchevents/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 42eb56179a..0000000000 --- a/apis/cloudwatchevents/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,931 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this APIDestination -func (mg *APIDestination) GetTerraformResourceType() string { - return "aws_cloudwatch_event_api_destination" -} - -// GetConnectionDetailsMapping for this APIDestination -func (tr *APIDestination) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this APIDestination -func (tr *APIDestination) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this APIDestination -func (tr *APIDestination) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this APIDestination -func (tr *APIDestination) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this APIDestination -func (tr *APIDestination) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this APIDestination -func (tr *APIDestination) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this APIDestination -func (tr *APIDestination) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this APIDestination -func (tr *APIDestination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this APIDestination using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *APIDestination) LateInitialize(attrs []byte) (bool, error) { - params := &APIDestinationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *APIDestination) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Archive -func (mg *Archive) GetTerraformResourceType() string { - return "aws_cloudwatch_event_archive" -} - -// GetConnectionDetailsMapping for this Archive -func (tr *Archive) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Archive -func (tr *Archive) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Archive -func (tr *Archive) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Archive -func (tr *Archive) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Archive -func (tr *Archive) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Archive -func (tr *Archive) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Archive -func (tr *Archive) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Archive -func (tr *Archive) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Archive using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Archive) LateInitialize(attrs []byte) (bool, error) { - params := &ArchiveParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Archive) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Bus -func (mg *Bus) GetTerraformResourceType() string { - return "aws_cloudwatch_event_bus" -} - -// GetConnectionDetailsMapping for this Bus -func (tr *Bus) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Bus -func (tr *Bus) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Bus -func (tr *Bus) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Bus -func (tr *Bus) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Bus -func (tr *Bus) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Bus -func (tr *Bus) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Bus -func (tr *Bus) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Bus -func (tr *Bus) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Bus using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Bus) LateInitialize(attrs []byte) (bool, error) { - params := &BusParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Bus) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BusPolicy -func (mg *BusPolicy) GetTerraformResourceType() string { - return "aws_cloudwatch_event_bus_policy" -} - -// GetConnectionDetailsMapping for this BusPolicy -func (tr *BusPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BusPolicy -func (tr *BusPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BusPolicy -func (tr *BusPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BusPolicy -func (tr *BusPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BusPolicy -func (tr *BusPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BusPolicy -func (tr *BusPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BusPolicy -func (tr *BusPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BusPolicy -func (tr *BusPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BusPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BusPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &BusPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BusPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Connection -func (mg *Connection) GetTerraformResourceType() string { - return "aws_cloudwatch_event_connection" -} - -// GetConnectionDetailsMapping for this Connection -func (tr *Connection) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"auth_parameters[*].api_key[*].value": "spec.forProvider.authParameters[*].apiKey[*].valueSecretRef", "auth_parameters[*].basic[*].password": "spec.forProvider.authParameters[*].basic[*].passwordSecretRef", "auth_parameters[*].invocation_http_parameters[*].body[*].value": "spec.forProvider.authParameters[*].invocationHttpParameters[*].body[*].valueSecretRef", "auth_parameters[*].invocation_http_parameters[*].header[*].value": "spec.forProvider.authParameters[*].invocationHttpParameters[*].header[*].valueSecretRef", "auth_parameters[*].invocation_http_parameters[*].query_string[*].value": "spec.forProvider.authParameters[*].invocationHttpParameters[*].queryString[*].valueSecretRef", "auth_parameters[*].oauth[*].client_parameters[*].client_secret": "spec.forProvider.authParameters[*].oauth[*].clientParameters[*].clientSecretSecretRef", "auth_parameters[*].oauth[*].oauth_http_parameters[*].body[*].value": "spec.forProvider.authParameters[*].oauth[*].oauthHttpParameters[*].body[*].valueSecretRef", "auth_parameters[*].oauth[*].oauth_http_parameters[*].header[*].value": "spec.forProvider.authParameters[*].oauth[*].oauthHttpParameters[*].header[*].valueSecretRef", "auth_parameters[*].oauth[*].oauth_http_parameters[*].query_string[*].value": "spec.forProvider.authParameters[*].oauth[*].oauthHttpParameters[*].queryString[*].valueSecretRef"} -} - -// GetObservation of this Connection -func (tr *Connection) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Connection -func (tr *Connection) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Connection -func (tr *Connection) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Connection -func (tr *Connection) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Connection -func (tr *Connection) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Connection -func (tr *Connection) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Connection -func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Connection using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { - params := &ConnectionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Connection) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Permission -func (mg *Permission) GetTerraformResourceType() string { - return "aws_cloudwatch_event_permission" -} - -// GetConnectionDetailsMapping for this Permission -func (tr *Permission) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Permission -func (tr *Permission) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Permission -func (tr *Permission) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Permission -func (tr *Permission) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Permission -func (tr *Permission) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Permission -func (tr *Permission) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Permission -func (tr *Permission) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Permission -func (tr *Permission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Permission using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Permission) LateInitialize(attrs []byte) (bool, error) { - params := &PermissionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Permission) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Rule -func (mg *Rule) GetTerraformResourceType() string { - return "aws_cloudwatch_event_rule" -} - -// GetConnectionDetailsMapping for this Rule -func (tr *Rule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Rule -func (tr *Rule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Rule -func (tr *Rule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Rule -func (tr *Rule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Rule -func (tr *Rule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Rule -func (tr *Rule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Rule -func (tr *Rule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Rule -func (tr *Rule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Rule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Rule) LateInitialize(attrs []byte) (bool, error) { - params := &RuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Rule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Target -func (mg *Target) GetTerraformResourceType() string { - return "aws_cloudwatch_event_target" -} - -// GetConnectionDetailsMapping for this Target -func (tr *Target) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Target -func (tr *Target) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Target -func (tr *Target) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Target -func (tr *Target) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Target -func (tr *Target) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Target -func (tr *Target) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Target -func (tr *Target) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Target -func (tr *Target) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Target using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Target) LateInitialize(attrs []byte) (bool, error) { - params := &TargetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Target) GetTerraformSchemaVersion() int { - return 1 -} diff --git a/apis/cloudwatchevents/v1beta1/zz_permission_terraformed.go b/apis/cloudwatchevents/v1beta1/zz_permission_terraformed.go new file mode 100755 index 0000000000..ea1a3f48a9 --- /dev/null +++ b/apis/cloudwatchevents/v1beta1/zz_permission_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Permission +func (mg *Permission) GetTerraformResourceType() string { + return "aws_cloudwatch_event_permission" +} + +// GetConnectionDetailsMapping for this Permission +func (tr *Permission) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Permission +func (tr *Permission) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Permission +func (tr *Permission) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Permission +func (tr *Permission) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Permission +func (tr *Permission) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Permission +func (tr *Permission) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Permission +func (tr *Permission) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Permission +func (tr *Permission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Permission using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Permission) LateInitialize(attrs []byte) (bool, error) { + params := &PermissionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Permission) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchevents/v1beta1/zz_permission_types.go b/apis/cloudwatchevents/v1beta1/zz_permission_types.go index e936dd8253..d987a36703 100755 --- a/apis/cloudwatchevents/v1beta1/zz_permission_types.go +++ b/apis/cloudwatchevents/v1beta1/zz_permission_types.go @@ -188,13 +188,14 @@ type PermissionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Permission is the Schema for the Permissions API. Provides a resource to create an EventBridge permission to support cross-account events in the current account default event bus. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Permission struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchevents/v1beta1/zz_rule_terraformed.go b/apis/cloudwatchevents/v1beta1/zz_rule_terraformed.go new file mode 100755 index 0000000000..e60918bdf4 --- /dev/null +++ b/apis/cloudwatchevents/v1beta1/zz_rule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Rule +func (mg *Rule) GetTerraformResourceType() string { + return "aws_cloudwatch_event_rule" +} + +// GetConnectionDetailsMapping for this Rule +func (tr *Rule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Rule +func (tr *Rule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Rule +func (tr *Rule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Rule +func (tr *Rule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Rule +func (tr *Rule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Rule +func (tr *Rule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Rule +func (tr *Rule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Rule +func (tr *Rule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Rule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Rule) LateInitialize(attrs []byte) (bool, error) { + params := &RuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Rule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchevents/v1beta1/zz_rule_types.go b/apis/cloudwatchevents/v1beta1/zz_rule_types.go index dfc28bc55d..ddb58bcc15 100755 --- a/apis/cloudwatchevents/v1beta1/zz_rule_types.go +++ b/apis/cloudwatchevents/v1beta1/zz_rule_types.go @@ -179,13 +179,14 @@ type RuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Rule is the Schema for the Rules API. Provides an EventBridge Rule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Rule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchevents/v1beta1/zz_target_terraformed.go b/apis/cloudwatchevents/v1beta1/zz_target_terraformed.go new file mode 100755 index 0000000000..0f7e86f83f --- /dev/null +++ b/apis/cloudwatchevents/v1beta1/zz_target_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Target +func (mg *Target) GetTerraformResourceType() string { + return "aws_cloudwatch_event_target" +} + +// GetConnectionDetailsMapping for this Target +func (tr *Target) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Target +func (tr *Target) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Target +func (tr *Target) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Target +func (tr *Target) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Target +func (tr *Target) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Target +func (tr *Target) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Target +func (tr *Target) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Target +func (tr *Target) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Target using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Target) LateInitialize(attrs []byte) (bool, error) { + params := &TargetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Target) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/cloudwatchevents/v1beta1/zz_target_types.go b/apis/cloudwatchevents/v1beta1/zz_target_types.go index 36d1866c7b..2afbaf738e 100755 --- a/apis/cloudwatchevents/v1beta1/zz_target_types.go +++ b/apis/cloudwatchevents/v1beta1/zz_target_types.go @@ -900,13 +900,14 @@ type TargetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Target is the Schema for the Targets API. Provides an EventBridge Target resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Target struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchlogs/v1beta1/zz_definition_terraformed.go b/apis/cloudwatchlogs/v1beta1/zz_definition_terraformed.go new file mode 100755 index 0000000000..636e7f41b1 --- /dev/null +++ b/apis/cloudwatchlogs/v1beta1/zz_definition_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Definition +func (mg *Definition) GetTerraformResourceType() string { + return "aws_cloudwatch_query_definition" +} + +// GetConnectionDetailsMapping for this Definition +func (tr *Definition) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Definition +func (tr *Definition) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Definition +func (tr *Definition) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Definition +func (tr *Definition) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Definition +func (tr *Definition) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Definition +func (tr *Definition) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Definition +func (tr *Definition) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Definition +func (tr *Definition) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Definition using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Definition) LateInitialize(attrs []byte) (bool, error) { + params := &DefinitionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Definition) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchlogs/v1beta1/zz_definition_types.go b/apis/cloudwatchlogs/v1beta1/zz_definition_types.go index e61f3f9245..de8cb5b8be 100755 --- a/apis/cloudwatchlogs/v1beta1/zz_definition_types.go +++ b/apis/cloudwatchlogs/v1beta1/zz_definition_types.go @@ -89,13 +89,14 @@ type DefinitionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Definition is the Schema for the Definitions API. Provides a CloudWatch Logs query definition resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Definition struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchlogs/v1beta1/zz_destination_terraformed.go b/apis/cloudwatchlogs/v1beta1/zz_destination_terraformed.go new file mode 100755 index 0000000000..78fe898d43 --- /dev/null +++ b/apis/cloudwatchlogs/v1beta1/zz_destination_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Destination +func (mg *Destination) GetTerraformResourceType() string { + return "aws_cloudwatch_log_destination" +} + +// GetConnectionDetailsMapping for this Destination +func (tr *Destination) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Destination +func (tr *Destination) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Destination +func (tr *Destination) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Destination +func (tr *Destination) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Destination +func (tr *Destination) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Destination +func (tr *Destination) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Destination +func (tr *Destination) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Destination +func (tr *Destination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Destination using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Destination) LateInitialize(attrs []byte) (bool, error) { + params := &DestinationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Destination) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchlogs/v1beta1/zz_destination_types.go b/apis/cloudwatchlogs/v1beta1/zz_destination_types.go index d05f94d2a1..d75a42f577 100755 --- a/apis/cloudwatchlogs/v1beta1/zz_destination_types.go +++ b/apis/cloudwatchlogs/v1beta1/zz_destination_types.go @@ -137,13 +137,14 @@ type DestinationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Destination is the Schema for the Destinations API. Provides a CloudWatch Logs destination. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Destination struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchlogs/v1beta1/zz_destinationpolicy_terraformed.go b/apis/cloudwatchlogs/v1beta1/zz_destinationpolicy_terraformed.go new file mode 100755 index 0000000000..01777e7f7f --- /dev/null +++ b/apis/cloudwatchlogs/v1beta1/zz_destinationpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DestinationPolicy +func (mg *DestinationPolicy) GetTerraformResourceType() string { + return "aws_cloudwatch_log_destination_policy" +} + +// GetConnectionDetailsMapping for this DestinationPolicy +func (tr *DestinationPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DestinationPolicy +func (tr *DestinationPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DestinationPolicy +func (tr *DestinationPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DestinationPolicy +func (tr *DestinationPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DestinationPolicy +func (tr *DestinationPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DestinationPolicy +func (tr *DestinationPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DestinationPolicy +func (tr *DestinationPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DestinationPolicy +func (tr *DestinationPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DestinationPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DestinationPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &DestinationPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DestinationPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchlogs/v1beta1/zz_destinationpolicy_types.go b/apis/cloudwatchlogs/v1beta1/zz_destinationpolicy_types.go index 1ccad4ea8a..55cc1ab5b2 100755 --- a/apis/cloudwatchlogs/v1beta1/zz_destinationpolicy_types.go +++ b/apis/cloudwatchlogs/v1beta1/zz_destinationpolicy_types.go @@ -77,13 +77,14 @@ type DestinationPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DestinationPolicy is the Schema for the DestinationPolicys API. Provides a CloudWatch Logs destination policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DestinationPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchlogs/v1beta1/zz_generated.conversion_hubs.go b/apis/cloudwatchlogs/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b3b8c3c463 --- /dev/null +++ b/apis/cloudwatchlogs/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Destination) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DestinationPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Group) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MetricFilter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResourcePolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Stream) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SubscriptionFilter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Definition) Hub() {} diff --git a/apis/cloudwatchlogs/v1beta1/zz_generated_terraformed.go b/apis/cloudwatchlogs/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 60e39c5a59..0000000000 --- a/apis/cloudwatchlogs/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,931 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Destination -func (mg *Destination) GetTerraformResourceType() string { - return "aws_cloudwatch_log_destination" -} - -// GetConnectionDetailsMapping for this Destination -func (tr *Destination) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Destination -func (tr *Destination) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Destination -func (tr *Destination) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Destination -func (tr *Destination) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Destination -func (tr *Destination) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Destination -func (tr *Destination) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Destination -func (tr *Destination) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Destination -func (tr *Destination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Destination using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Destination) LateInitialize(attrs []byte) (bool, error) { - params := &DestinationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Destination) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DestinationPolicy -func (mg *DestinationPolicy) GetTerraformResourceType() string { - return "aws_cloudwatch_log_destination_policy" -} - -// GetConnectionDetailsMapping for this DestinationPolicy -func (tr *DestinationPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DestinationPolicy -func (tr *DestinationPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DestinationPolicy -func (tr *DestinationPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DestinationPolicy -func (tr *DestinationPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DestinationPolicy -func (tr *DestinationPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DestinationPolicy -func (tr *DestinationPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DestinationPolicy -func (tr *DestinationPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DestinationPolicy -func (tr *DestinationPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DestinationPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DestinationPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &DestinationPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DestinationPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Group -func (mg *Group) GetTerraformResourceType() string { - return "aws_cloudwatch_log_group" -} - -// GetConnectionDetailsMapping for this Group -func (tr *Group) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Group -func (tr *Group) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Group -func (tr *Group) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Group -func (tr *Group) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Group -func (tr *Group) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Group -func (tr *Group) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Group -func (tr *Group) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Group -func (tr *Group) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Group using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Group) LateInitialize(attrs []byte) (bool, error) { - params := &GroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Group) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MetricFilter -func (mg *MetricFilter) GetTerraformResourceType() string { - return "aws_cloudwatch_log_metric_filter" -} - -// GetConnectionDetailsMapping for this MetricFilter -func (tr *MetricFilter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MetricFilter -func (tr *MetricFilter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MetricFilter -func (tr *MetricFilter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MetricFilter -func (tr *MetricFilter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MetricFilter -func (tr *MetricFilter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MetricFilter -func (tr *MetricFilter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MetricFilter -func (tr *MetricFilter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MetricFilter -func (tr *MetricFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MetricFilter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MetricFilter) LateInitialize(attrs []byte) (bool, error) { - params := &MetricFilterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MetricFilter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ResourcePolicy -func (mg *ResourcePolicy) GetTerraformResourceType() string { - return "aws_cloudwatch_log_resource_policy" -} - -// GetConnectionDetailsMapping for this ResourcePolicy -func (tr *ResourcePolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResourcePolicy -func (tr *ResourcePolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResourcePolicy -func (tr *ResourcePolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResourcePolicy -func (tr *ResourcePolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResourcePolicy -func (tr *ResourcePolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResourcePolicy -func (tr *ResourcePolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResourcePolicy -func (tr *ResourcePolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResourcePolicy -func (tr *ResourcePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResourcePolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResourcePolicy) LateInitialize(attrs []byte) (bool, error) { - params := &ResourcePolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResourcePolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Stream -func (mg *Stream) GetTerraformResourceType() string { - return "aws_cloudwatch_log_stream" -} - -// GetConnectionDetailsMapping for this Stream -func (tr *Stream) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Stream -func (tr *Stream) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Stream -func (tr *Stream) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Stream -func (tr *Stream) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Stream -func (tr *Stream) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Stream -func (tr *Stream) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Stream -func (tr *Stream) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Stream -func (tr *Stream) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Stream using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Stream) LateInitialize(attrs []byte) (bool, error) { - params := &StreamParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Stream) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SubscriptionFilter -func (mg *SubscriptionFilter) GetTerraformResourceType() string { - return "aws_cloudwatch_log_subscription_filter" -} - -// GetConnectionDetailsMapping for this SubscriptionFilter -func (tr *SubscriptionFilter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SubscriptionFilter -func (tr *SubscriptionFilter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SubscriptionFilter -func (tr *SubscriptionFilter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SubscriptionFilter -func (tr *SubscriptionFilter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SubscriptionFilter -func (tr *SubscriptionFilter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SubscriptionFilter -func (tr *SubscriptionFilter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SubscriptionFilter -func (tr *SubscriptionFilter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SubscriptionFilter -func (tr *SubscriptionFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SubscriptionFilter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SubscriptionFilter) LateInitialize(attrs []byte) (bool, error) { - params := &SubscriptionFilterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SubscriptionFilter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Definition -func (mg *Definition) GetTerraformResourceType() string { - return "aws_cloudwatch_query_definition" -} - -// GetConnectionDetailsMapping for this Definition -func (tr *Definition) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Definition -func (tr *Definition) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Definition -func (tr *Definition) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Definition -func (tr *Definition) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Definition -func (tr *Definition) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Definition -func (tr *Definition) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Definition -func (tr *Definition) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Definition -func (tr *Definition) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Definition using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Definition) LateInitialize(attrs []byte) (bool, error) { - params := &DefinitionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Definition) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/cloudwatchlogs/v1beta1/zz_group_terraformed.go b/apis/cloudwatchlogs/v1beta1/zz_group_terraformed.go new file mode 100755 index 0000000000..21d6229624 --- /dev/null +++ b/apis/cloudwatchlogs/v1beta1/zz_group_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Group +func (mg *Group) GetTerraformResourceType() string { + return "aws_cloudwatch_log_group" +} + +// GetConnectionDetailsMapping for this Group +func (tr *Group) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Group +func (tr *Group) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Group +func (tr *Group) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Group +func (tr *Group) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Group +func (tr *Group) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Group +func (tr *Group) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Group +func (tr *Group) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Group +func (tr *Group) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Group using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Group) LateInitialize(attrs []byte) (bool, error) { + params := &GroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Group) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchlogs/v1beta1/zz_group_types.go b/apis/cloudwatchlogs/v1beta1/zz_group_types.go index abf9ff8224..7e5adc1771 100755 --- a/apis/cloudwatchlogs/v1beta1/zz_group_types.go +++ b/apis/cloudwatchlogs/v1beta1/zz_group_types.go @@ -134,13 +134,14 @@ type GroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Group is the Schema for the Groups API. Provides a CloudWatch Log Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Group struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchlogs/v1beta1/zz_metricfilter_terraformed.go b/apis/cloudwatchlogs/v1beta1/zz_metricfilter_terraformed.go new file mode 100755 index 0000000000..11ab5f2a8d --- /dev/null +++ b/apis/cloudwatchlogs/v1beta1/zz_metricfilter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MetricFilter +func (mg *MetricFilter) GetTerraformResourceType() string { + return "aws_cloudwatch_log_metric_filter" +} + +// GetConnectionDetailsMapping for this MetricFilter +func (tr *MetricFilter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MetricFilter +func (tr *MetricFilter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MetricFilter +func (tr *MetricFilter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MetricFilter +func (tr *MetricFilter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MetricFilter +func (tr *MetricFilter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MetricFilter +func (tr *MetricFilter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MetricFilter +func (tr *MetricFilter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MetricFilter +func (tr *MetricFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MetricFilter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MetricFilter) LateInitialize(attrs []byte) (bool, error) { + params := &MetricFilterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MetricFilter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchlogs/v1beta1/zz_metricfilter_types.go b/apis/cloudwatchlogs/v1beta1/zz_metricfilter_types.go index 7d4ab0041f..1aef817fac 100755 --- a/apis/cloudwatchlogs/v1beta1/zz_metricfilter_types.go +++ b/apis/cloudwatchlogs/v1beta1/zz_metricfilter_types.go @@ -181,13 +181,14 @@ type MetricFilterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MetricFilter is the Schema for the MetricFilters API. Provides a CloudWatch Log Metric Filter resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MetricFilter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchlogs/v1beta1/zz_resourcepolicy_terraformed.go b/apis/cloudwatchlogs/v1beta1/zz_resourcepolicy_terraformed.go new file mode 100755 index 0000000000..0423c4a0e9 --- /dev/null +++ b/apis/cloudwatchlogs/v1beta1/zz_resourcepolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResourcePolicy +func (mg *ResourcePolicy) GetTerraformResourceType() string { + return "aws_cloudwatch_log_resource_policy" +} + +// GetConnectionDetailsMapping for this ResourcePolicy +func (tr *ResourcePolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResourcePolicy +func (tr *ResourcePolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResourcePolicy +func (tr *ResourcePolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResourcePolicy +func (tr *ResourcePolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResourcePolicy +func (tr *ResourcePolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResourcePolicy +func (tr *ResourcePolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResourcePolicy +func (tr *ResourcePolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResourcePolicy +func (tr *ResourcePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResourcePolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResourcePolicy) LateInitialize(attrs []byte) (bool, error) { + params := &ResourcePolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResourcePolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchlogs/v1beta1/zz_resourcepolicy_types.go b/apis/cloudwatchlogs/v1beta1/zz_resourcepolicy_types.go index 04793143bd..f0c02c0f5f 100755 --- a/apis/cloudwatchlogs/v1beta1/zz_resourcepolicy_types.go +++ b/apis/cloudwatchlogs/v1beta1/zz_resourcepolicy_types.go @@ -68,13 +68,14 @@ type ResourcePolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResourcePolicy is the Schema for the ResourcePolicys API. Provides a resource to manage a CloudWatch log resource policy // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResourcePolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchlogs/v1beta1/zz_stream_terraformed.go b/apis/cloudwatchlogs/v1beta1/zz_stream_terraformed.go new file mode 100755 index 0000000000..5bbdc245fe --- /dev/null +++ b/apis/cloudwatchlogs/v1beta1/zz_stream_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Stream +func (mg *Stream) GetTerraformResourceType() string { + return "aws_cloudwatch_log_stream" +} + +// GetConnectionDetailsMapping for this Stream +func (tr *Stream) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Stream +func (tr *Stream) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Stream +func (tr *Stream) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Stream +func (tr *Stream) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Stream +func (tr *Stream) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Stream +func (tr *Stream) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Stream +func (tr *Stream) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Stream +func (tr *Stream) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Stream using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Stream) LateInitialize(attrs []byte) (bool, error) { + params := &StreamParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Stream) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchlogs/v1beta1/zz_stream_types.go b/apis/cloudwatchlogs/v1beta1/zz_stream_types.go index ec155d4cb8..521b06ab11 100755 --- a/apis/cloudwatchlogs/v1beta1/zz_stream_types.go +++ b/apis/cloudwatchlogs/v1beta1/zz_stream_types.go @@ -98,13 +98,14 @@ type StreamStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Stream is the Schema for the Streams API. Provides a CloudWatch Log Stream resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Stream struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cloudwatchlogs/v1beta1/zz_subscriptionfilter_terraformed.go b/apis/cloudwatchlogs/v1beta1/zz_subscriptionfilter_terraformed.go new file mode 100755 index 0000000000..7ffb3fd7c4 --- /dev/null +++ b/apis/cloudwatchlogs/v1beta1/zz_subscriptionfilter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SubscriptionFilter +func (mg *SubscriptionFilter) GetTerraformResourceType() string { + return "aws_cloudwatch_log_subscription_filter" +} + +// GetConnectionDetailsMapping for this SubscriptionFilter +func (tr *SubscriptionFilter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SubscriptionFilter +func (tr *SubscriptionFilter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SubscriptionFilter +func (tr *SubscriptionFilter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SubscriptionFilter +func (tr *SubscriptionFilter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SubscriptionFilter +func (tr *SubscriptionFilter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SubscriptionFilter +func (tr *SubscriptionFilter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SubscriptionFilter +func (tr *SubscriptionFilter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SubscriptionFilter +func (tr *SubscriptionFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SubscriptionFilter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SubscriptionFilter) LateInitialize(attrs []byte) (bool, error) { + params := &SubscriptionFilterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SubscriptionFilter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cloudwatchlogs/v1beta1/zz_subscriptionfilter_types.go b/apis/cloudwatchlogs/v1beta1/zz_subscriptionfilter_types.go index 30300c91b8..f5435def92 100755 --- a/apis/cloudwatchlogs/v1beta1/zz_subscriptionfilter_types.go +++ b/apis/cloudwatchlogs/v1beta1/zz_subscriptionfilter_types.go @@ -157,13 +157,14 @@ type SubscriptionFilterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SubscriptionFilter is the Schema for the SubscriptionFilters API. Provides a CloudWatch Logs subscription filter. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SubscriptionFilter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/codecommit/v1beta1/zz_approvalruletemplate_terraformed.go b/apis/codecommit/v1beta1/zz_approvalruletemplate_terraformed.go new file mode 100755 index 0000000000..a41dca0493 --- /dev/null +++ b/apis/codecommit/v1beta1/zz_approvalruletemplate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ApprovalRuleTemplate +func (mg *ApprovalRuleTemplate) GetTerraformResourceType() string { + return "aws_codecommit_approval_rule_template" +} + +// GetConnectionDetailsMapping for this ApprovalRuleTemplate +func (tr *ApprovalRuleTemplate) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ApprovalRuleTemplate +func (tr *ApprovalRuleTemplate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ApprovalRuleTemplate +func (tr *ApprovalRuleTemplate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ApprovalRuleTemplate +func (tr *ApprovalRuleTemplate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ApprovalRuleTemplate +func (tr *ApprovalRuleTemplate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ApprovalRuleTemplate +func (tr *ApprovalRuleTemplate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ApprovalRuleTemplate +func (tr *ApprovalRuleTemplate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ApprovalRuleTemplate +func (tr *ApprovalRuleTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ApprovalRuleTemplate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ApprovalRuleTemplate) LateInitialize(attrs []byte) (bool, error) { + params := &ApprovalRuleTemplateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ApprovalRuleTemplate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/codecommit/v1beta1/zz_approvalruletemplate_types.go b/apis/codecommit/v1beta1/zz_approvalruletemplate_types.go index 2f0eebcdff..da58cb32c4 100755 --- a/apis/codecommit/v1beta1/zz_approvalruletemplate_types.go +++ b/apis/codecommit/v1beta1/zz_approvalruletemplate_types.go @@ -92,13 +92,14 @@ type ApprovalRuleTemplateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ApprovalRuleTemplate is the Schema for the ApprovalRuleTemplates API. Provides a CodeCommit Approval Rule Template Resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ApprovalRuleTemplate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/codecommit/v1beta1/zz_approvalruletemplateassociation_terraformed.go b/apis/codecommit/v1beta1/zz_approvalruletemplateassociation_terraformed.go new file mode 100755 index 0000000000..ca97ede624 --- /dev/null +++ b/apis/codecommit/v1beta1/zz_approvalruletemplateassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ApprovalRuleTemplateAssociation +func (mg *ApprovalRuleTemplateAssociation) GetTerraformResourceType() string { + return "aws_codecommit_approval_rule_template_association" +} + +// GetConnectionDetailsMapping for this ApprovalRuleTemplateAssociation +func (tr *ApprovalRuleTemplateAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ApprovalRuleTemplateAssociation +func (tr *ApprovalRuleTemplateAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ApprovalRuleTemplateAssociation +func (tr *ApprovalRuleTemplateAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ApprovalRuleTemplateAssociation +func (tr *ApprovalRuleTemplateAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ApprovalRuleTemplateAssociation +func (tr *ApprovalRuleTemplateAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ApprovalRuleTemplateAssociation +func (tr *ApprovalRuleTemplateAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ApprovalRuleTemplateAssociation +func (tr *ApprovalRuleTemplateAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ApprovalRuleTemplateAssociation +func (tr *ApprovalRuleTemplateAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ApprovalRuleTemplateAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ApprovalRuleTemplateAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &ApprovalRuleTemplateAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ApprovalRuleTemplateAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/codecommit/v1beta1/zz_approvalruletemplateassociation_types.go b/apis/codecommit/v1beta1/zz_approvalruletemplateassociation_types.go index be14569419..128e970055 100755 --- a/apis/codecommit/v1beta1/zz_approvalruletemplateassociation_types.go +++ b/apis/codecommit/v1beta1/zz_approvalruletemplateassociation_types.go @@ -90,13 +90,14 @@ type ApprovalRuleTemplateAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ApprovalRuleTemplateAssociation is the Schema for the ApprovalRuleTemplateAssociations API. Associates a CodeCommit Approval Rule Template with a Repository. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ApprovalRuleTemplateAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/codecommit/v1beta1/zz_generated.conversion_hubs.go b/apis/codecommit/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..25c1d92f2e --- /dev/null +++ b/apis/codecommit/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ApprovalRuleTemplate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ApprovalRuleTemplateAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Repository) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Trigger) Hub() {} diff --git a/apis/codecommit/v1beta1/zz_generated_terraformed.go b/apis/codecommit/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 11f1ebbced..0000000000 --- a/apis/codecommit/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this ApprovalRuleTemplate -func (mg *ApprovalRuleTemplate) GetTerraformResourceType() string { - return "aws_codecommit_approval_rule_template" -} - -// GetConnectionDetailsMapping for this ApprovalRuleTemplate -func (tr *ApprovalRuleTemplate) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ApprovalRuleTemplate -func (tr *ApprovalRuleTemplate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ApprovalRuleTemplate -func (tr *ApprovalRuleTemplate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ApprovalRuleTemplate -func (tr *ApprovalRuleTemplate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ApprovalRuleTemplate -func (tr *ApprovalRuleTemplate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ApprovalRuleTemplate -func (tr *ApprovalRuleTemplate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ApprovalRuleTemplate -func (tr *ApprovalRuleTemplate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ApprovalRuleTemplate -func (tr *ApprovalRuleTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ApprovalRuleTemplate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ApprovalRuleTemplate) LateInitialize(attrs []byte) (bool, error) { - params := &ApprovalRuleTemplateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ApprovalRuleTemplate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ApprovalRuleTemplateAssociation -func (mg *ApprovalRuleTemplateAssociation) GetTerraformResourceType() string { - return "aws_codecommit_approval_rule_template_association" -} - -// GetConnectionDetailsMapping for this ApprovalRuleTemplateAssociation -func (tr *ApprovalRuleTemplateAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ApprovalRuleTemplateAssociation -func (tr *ApprovalRuleTemplateAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ApprovalRuleTemplateAssociation -func (tr *ApprovalRuleTemplateAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ApprovalRuleTemplateAssociation -func (tr *ApprovalRuleTemplateAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ApprovalRuleTemplateAssociation -func (tr *ApprovalRuleTemplateAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ApprovalRuleTemplateAssociation -func (tr *ApprovalRuleTemplateAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ApprovalRuleTemplateAssociation -func (tr *ApprovalRuleTemplateAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ApprovalRuleTemplateAssociation -func (tr *ApprovalRuleTemplateAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ApprovalRuleTemplateAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ApprovalRuleTemplateAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &ApprovalRuleTemplateAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ApprovalRuleTemplateAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Repository -func (mg *Repository) GetTerraformResourceType() string { - return "aws_codecommit_repository" -} - -// GetConnectionDetailsMapping for this Repository -func (tr *Repository) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Repository -func (tr *Repository) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Repository -func (tr *Repository) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Repository -func (tr *Repository) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Repository -func (tr *Repository) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Repository -func (tr *Repository) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Repository -func (tr *Repository) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Repository -func (tr *Repository) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Repository using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Repository) LateInitialize(attrs []byte) (bool, error) { - params := &RepositoryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Repository) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Trigger -func (mg *Trigger) GetTerraformResourceType() string { - return "aws_codecommit_trigger" -} - -// GetConnectionDetailsMapping for this Trigger -func (tr *Trigger) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Trigger -func (tr *Trigger) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Trigger -func (tr *Trigger) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Trigger -func (tr *Trigger) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Trigger -func (tr *Trigger) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Trigger -func (tr *Trigger) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Trigger -func (tr *Trigger) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Trigger -func (tr *Trigger) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Trigger using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Trigger) LateInitialize(attrs []byte) (bool, error) { - params := &TriggerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Trigger) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/codecommit/v1beta1/zz_repository_terraformed.go b/apis/codecommit/v1beta1/zz_repository_terraformed.go new file mode 100755 index 0000000000..eb978a0f7d --- /dev/null +++ b/apis/codecommit/v1beta1/zz_repository_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Repository +func (mg *Repository) GetTerraformResourceType() string { + return "aws_codecommit_repository" +} + +// GetConnectionDetailsMapping for this Repository +func (tr *Repository) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Repository +func (tr *Repository) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Repository +func (tr *Repository) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Repository +func (tr *Repository) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Repository +func (tr *Repository) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Repository +func (tr *Repository) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Repository +func (tr *Repository) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Repository +func (tr *Repository) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Repository using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Repository) LateInitialize(attrs []byte) (bool, error) { + params := &RepositoryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Repository) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/codecommit/v1beta1/zz_repository_types.go b/apis/codecommit/v1beta1/zz_repository_types.go index 09bd5c1fea..d981ea5cc2 100755 --- a/apis/codecommit/v1beta1/zz_repository_types.go +++ b/apis/codecommit/v1beta1/zz_repository_types.go @@ -106,13 +106,14 @@ type RepositoryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Repository is the Schema for the Repositorys API. Provides a CodeCommit Repository Resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Repository struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/codecommit/v1beta1/zz_trigger_terraformed.go b/apis/codecommit/v1beta1/zz_trigger_terraformed.go new file mode 100755 index 0000000000..398d38b537 --- /dev/null +++ b/apis/codecommit/v1beta1/zz_trigger_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Trigger +func (mg *Trigger) GetTerraformResourceType() string { + return "aws_codecommit_trigger" +} + +// GetConnectionDetailsMapping for this Trigger +func (tr *Trigger) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Trigger +func (tr *Trigger) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Trigger +func (tr *Trigger) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Trigger +func (tr *Trigger) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Trigger +func (tr *Trigger) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Trigger +func (tr *Trigger) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Trigger +func (tr *Trigger) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Trigger +func (tr *Trigger) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Trigger using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Trigger) LateInitialize(attrs []byte) (bool, error) { + params := &TriggerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Trigger) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/codecommit/v1beta1/zz_trigger_types.go b/apis/codecommit/v1beta1/zz_trigger_types.go index c60b9463e1..cd9c0908d6 100755 --- a/apis/codecommit/v1beta1/zz_trigger_types.go +++ b/apis/codecommit/v1beta1/zz_trigger_types.go @@ -174,13 +174,14 @@ type TriggerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Trigger is the Schema for the Triggers API. Provides a CodeCommit Trigger Resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Trigger struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/codepipeline/v1beta1/zz_codepipeline_terraformed.go b/apis/codepipeline/v1beta1/zz_codepipeline_terraformed.go new file mode 100755 index 0000000000..12f5ecb37f --- /dev/null +++ b/apis/codepipeline/v1beta1/zz_codepipeline_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Codepipeline +func (mg *Codepipeline) GetTerraformResourceType() string { + return "aws_codepipeline" +} + +// GetConnectionDetailsMapping for this Codepipeline +func (tr *Codepipeline) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Codepipeline +func (tr *Codepipeline) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Codepipeline +func (tr *Codepipeline) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Codepipeline +func (tr *Codepipeline) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Codepipeline +func (tr *Codepipeline) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Codepipeline +func (tr *Codepipeline) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Codepipeline +func (tr *Codepipeline) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Codepipeline +func (tr *Codepipeline) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Codepipeline using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Codepipeline) LateInitialize(attrs []byte) (bool, error) { + params := &CodepipelineParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Codepipeline) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/codepipeline/v1beta1/zz_codepipeline_types.go b/apis/codepipeline/v1beta1/zz_codepipeline_types.go index 4cf0994d2f..2c493aca81 100755 --- a/apis/codepipeline/v1beta1/zz_codepipeline_types.go +++ b/apis/codepipeline/v1beta1/zz_codepipeline_types.go @@ -380,13 +380,14 @@ type CodepipelineStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Codepipeline is the Schema for the Codepipelines API. Provides a CodePipeline // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Codepipeline struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/codepipeline/v1beta1/zz_customactiontype_terraformed.go b/apis/codepipeline/v1beta1/zz_customactiontype_terraformed.go new file mode 100755 index 0000000000..02a54bf28e --- /dev/null +++ b/apis/codepipeline/v1beta1/zz_customactiontype_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CustomActionType +func (mg *CustomActionType) GetTerraformResourceType() string { + return "aws_codepipeline_custom_action_type" +} + +// GetConnectionDetailsMapping for this CustomActionType +func (tr *CustomActionType) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CustomActionType +func (tr *CustomActionType) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CustomActionType +func (tr *CustomActionType) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CustomActionType +func (tr *CustomActionType) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CustomActionType +func (tr *CustomActionType) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CustomActionType +func (tr *CustomActionType) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CustomActionType +func (tr *CustomActionType) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CustomActionType +func (tr *CustomActionType) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CustomActionType using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CustomActionType) LateInitialize(attrs []byte) (bool, error) { + params := &CustomActionTypeParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CustomActionType) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/codepipeline/v1beta1/zz_customactiontype_types.go b/apis/codepipeline/v1beta1/zz_customactiontype_types.go index e64517c449..b91d528aed 100755 --- a/apis/codepipeline/v1beta1/zz_customactiontype_types.go +++ b/apis/codepipeline/v1beta1/zz_customactiontype_types.go @@ -337,13 +337,14 @@ type CustomActionTypeStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CustomActionType is the Schema for the CustomActionTypes API. Provides a CodePipeline CustomActionType. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CustomActionType struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/codepipeline/v1beta1/zz_generated.conversion_hubs.go b/apis/codepipeline/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..f671de2911 --- /dev/null +++ b/apis/codepipeline/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Codepipeline) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CustomActionType) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Webhook) Hub() {} diff --git a/apis/codepipeline/v1beta1/zz_generated_terraformed.go b/apis/codepipeline/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 2d4ea7d7d8..0000000000 --- a/apis/codepipeline/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Codepipeline -func (mg *Codepipeline) GetTerraformResourceType() string { - return "aws_codepipeline" -} - -// GetConnectionDetailsMapping for this Codepipeline -func (tr *Codepipeline) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Codepipeline -func (tr *Codepipeline) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Codepipeline -func (tr *Codepipeline) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Codepipeline -func (tr *Codepipeline) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Codepipeline -func (tr *Codepipeline) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Codepipeline -func (tr *Codepipeline) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Codepipeline -func (tr *Codepipeline) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Codepipeline -func (tr *Codepipeline) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Codepipeline using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Codepipeline) LateInitialize(attrs []byte) (bool, error) { - params := &CodepipelineParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Codepipeline) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CustomActionType -func (mg *CustomActionType) GetTerraformResourceType() string { - return "aws_codepipeline_custom_action_type" -} - -// GetConnectionDetailsMapping for this CustomActionType -func (tr *CustomActionType) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CustomActionType -func (tr *CustomActionType) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CustomActionType -func (tr *CustomActionType) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CustomActionType -func (tr *CustomActionType) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CustomActionType -func (tr *CustomActionType) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CustomActionType -func (tr *CustomActionType) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CustomActionType -func (tr *CustomActionType) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CustomActionType -func (tr *CustomActionType) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CustomActionType using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CustomActionType) LateInitialize(attrs []byte) (bool, error) { - params := &CustomActionTypeParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CustomActionType) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Webhook -func (mg *Webhook) GetTerraformResourceType() string { - return "aws_codepipeline_webhook" -} - -// GetConnectionDetailsMapping for this Webhook -func (tr *Webhook) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"authentication_configuration[*].secret_token": "spec.forProvider.authenticationConfiguration[*].secretTokenSecretRef"} -} - -// GetObservation of this Webhook -func (tr *Webhook) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Webhook -func (tr *Webhook) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Webhook -func (tr *Webhook) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Webhook -func (tr *Webhook) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Webhook -func (tr *Webhook) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Webhook -func (tr *Webhook) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Webhook -func (tr *Webhook) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Webhook using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Webhook) LateInitialize(attrs []byte) (bool, error) { - params := &WebhookParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Webhook) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/codepipeline/v1beta1/zz_webhook_terraformed.go b/apis/codepipeline/v1beta1/zz_webhook_terraformed.go new file mode 100755 index 0000000000..b12722d4da --- /dev/null +++ b/apis/codepipeline/v1beta1/zz_webhook_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Webhook +func (mg *Webhook) GetTerraformResourceType() string { + return "aws_codepipeline_webhook" +} + +// GetConnectionDetailsMapping for this Webhook +func (tr *Webhook) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"authentication_configuration[*].secret_token": "spec.forProvider.authenticationConfiguration[*].secretTokenSecretRef"} +} + +// GetObservation of this Webhook +func (tr *Webhook) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Webhook +func (tr *Webhook) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Webhook +func (tr *Webhook) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Webhook +func (tr *Webhook) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Webhook +func (tr *Webhook) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Webhook +func (tr *Webhook) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Webhook +func (tr *Webhook) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Webhook using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Webhook) LateInitialize(attrs []byte) (bool, error) { + params := &WebhookParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Webhook) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/codepipeline/v1beta1/zz_webhook_types.go b/apis/codepipeline/v1beta1/zz_webhook_types.go index 03408b0dbb..6252bdac04 100755 --- a/apis/codepipeline/v1beta1/zz_webhook_types.go +++ b/apis/codepipeline/v1beta1/zz_webhook_types.go @@ -201,13 +201,14 @@ type WebhookStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Webhook is the Schema for the Webhooks API. Provides a CodePipeline Webhook // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Webhook struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/codestarconnections/v1beta1/zz_generated_terraformed.go b/apis/codestarconnections/v1beta1/zz_connection_terraformed.go similarity index 53% rename from apis/codestarconnections/v1beta1/zz_generated_terraformed.go rename to apis/codestarconnections/v1beta1/zz_connection_terraformed.go index 836de38f49..41a8cfcb83 100755 --- a/apis/codestarconnections/v1beta1/zz_generated_terraformed.go +++ b/apis/codestarconnections/v1beta1/zz_connection_terraformed.go @@ -131,117 +131,3 @@ func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { func (tr *Connection) GetTerraformSchemaVersion() int { return 0 } - -// GetTerraformResourceType returns Terraform resource type for this Host -func (mg *Host) GetTerraformResourceType() string { - return "aws_codestarconnections_host" -} - -// GetConnectionDetailsMapping for this Host -func (tr *Host) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Host -func (tr *Host) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Host -func (tr *Host) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Host -func (tr *Host) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Host -func (tr *Host) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Host -func (tr *Host) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Host -func (tr *Host) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Host -func (tr *Host) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Host using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Host) LateInitialize(attrs []byte) (bool, error) { - params := &HostParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Host) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/codestarconnections/v1beta1/zz_connection_types.go b/apis/codestarconnections/v1beta1/zz_connection_types.go index 34f7edf620..b1cd6ef321 100755 --- a/apis/codestarconnections/v1beta1/zz_connection_types.go +++ b/apis/codestarconnections/v1beta1/zz_connection_types.go @@ -111,13 +111,14 @@ type ConnectionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Connection is the Schema for the Connections API. Provides a CodeStar Connection // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Connection struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/codestarconnections/v1beta1/zz_generated.conversion_hubs.go b/apis/codestarconnections/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b5884b47b7 --- /dev/null +++ b/apis/codestarconnections/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Connection) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Host) Hub() {} diff --git a/apis/codestarconnections/v1beta1/zz_host_terraformed.go b/apis/codestarconnections/v1beta1/zz_host_terraformed.go new file mode 100755 index 0000000000..2d66dc8e28 --- /dev/null +++ b/apis/codestarconnections/v1beta1/zz_host_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Host +func (mg *Host) GetTerraformResourceType() string { + return "aws_codestarconnections_host" +} + +// GetConnectionDetailsMapping for this Host +func (tr *Host) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Host +func (tr *Host) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Host +func (tr *Host) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Host +func (tr *Host) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Host +func (tr *Host) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Host +func (tr *Host) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Host +func (tr *Host) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Host +func (tr *Host) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Host using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Host) LateInitialize(attrs []byte) (bool, error) { + params := &HostParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Host) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/codestarconnections/v1beta1/zz_host_types.go b/apis/codestarconnections/v1beta1/zz_host_types.go index 63eed89c65..ba732a7fff 100755 --- a/apis/codestarconnections/v1beta1/zz_host_types.go +++ b/apis/codestarconnections/v1beta1/zz_host_types.go @@ -159,13 +159,14 @@ type HostStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Host is the Schema for the Hosts API. Provides a CodeStar Host // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Host struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/codestarnotifications/v1beta1/zz_generated.conversion_hubs.go b/apis/codestarnotifications/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..528810dae7 --- /dev/null +++ b/apis/codestarnotifications/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *NotificationRule) Hub() {} diff --git a/apis/codestarnotifications/v1beta1/zz_generated_terraformed.go b/apis/codestarnotifications/v1beta1/zz_notificationrule_terraformed.go similarity index 100% rename from apis/codestarnotifications/v1beta1/zz_generated_terraformed.go rename to apis/codestarnotifications/v1beta1/zz_notificationrule_terraformed.go diff --git a/apis/codestarnotifications/v1beta1/zz_notificationrule_types.go b/apis/codestarnotifications/v1beta1/zz_notificationrule_types.go index 4d0f691d63..aee86595f8 100755 --- a/apis/codestarnotifications/v1beta1/zz_notificationrule_types.go +++ b/apis/codestarnotifications/v1beta1/zz_notificationrule_types.go @@ -216,13 +216,14 @@ type NotificationRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NotificationRule is the Schema for the NotificationRules API. Provides a CodeStar Notifications Rule // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NotificationRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidentity/v1beta1/zz_cognitoidentitypoolproviderprincipaltag_terraformed.go b/apis/cognitoidentity/v1beta1/zz_cognitoidentitypoolproviderprincipaltag_terraformed.go new file mode 100755 index 0000000000..8a26ea977e --- /dev/null +++ b/apis/cognitoidentity/v1beta1/zz_cognitoidentitypoolproviderprincipaltag_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CognitoIdentityPoolProviderPrincipalTag +func (mg *CognitoIdentityPoolProviderPrincipalTag) GetTerraformResourceType() string { + return "aws_cognito_identity_pool_provider_principal_tag" +} + +// GetConnectionDetailsMapping for this CognitoIdentityPoolProviderPrincipalTag +func (tr *CognitoIdentityPoolProviderPrincipalTag) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CognitoIdentityPoolProviderPrincipalTag +func (tr *CognitoIdentityPoolProviderPrincipalTag) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CognitoIdentityPoolProviderPrincipalTag +func (tr *CognitoIdentityPoolProviderPrincipalTag) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CognitoIdentityPoolProviderPrincipalTag +func (tr *CognitoIdentityPoolProviderPrincipalTag) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CognitoIdentityPoolProviderPrincipalTag +func (tr *CognitoIdentityPoolProviderPrincipalTag) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CognitoIdentityPoolProviderPrincipalTag +func (tr *CognitoIdentityPoolProviderPrincipalTag) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CognitoIdentityPoolProviderPrincipalTag +func (tr *CognitoIdentityPoolProviderPrincipalTag) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CognitoIdentityPoolProviderPrincipalTag +func (tr *CognitoIdentityPoolProviderPrincipalTag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CognitoIdentityPoolProviderPrincipalTag using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CognitoIdentityPoolProviderPrincipalTag) LateInitialize(attrs []byte) (bool, error) { + params := &CognitoIdentityPoolProviderPrincipalTagParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CognitoIdentityPoolProviderPrincipalTag) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidentity/v1beta1/zz_cognitoidentitypoolproviderprincipaltag_types.go b/apis/cognitoidentity/v1beta1/zz_cognitoidentitypoolproviderprincipaltag_types.go index eeafbd4ab0..088f95aca2 100755 --- a/apis/cognitoidentity/v1beta1/zz_cognitoidentitypoolproviderprincipaltag_types.go +++ b/apis/cognitoidentity/v1beta1/zz_cognitoidentitypoolproviderprincipaltag_types.go @@ -139,13 +139,14 @@ type CognitoIdentityPoolProviderPrincipalTagStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CognitoIdentityPoolProviderPrincipalTag is the Schema for the CognitoIdentityPoolProviderPrincipalTags API. Provides an AWS Cognito Identity Principal Mapping. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CognitoIdentityPoolProviderPrincipalTag struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidentity/v1beta1/zz_generated.conversion_hubs.go b/apis/cognitoidentity/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..f87a3b1045 --- /dev/null +++ b/apis/cognitoidentity/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Pool) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CognitoIdentityPoolProviderPrincipalTag) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PoolRolesAttachment) Hub() {} diff --git a/apis/cognitoidentity/v1beta1/zz_generated_terraformed.go b/apis/cognitoidentity/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 7fb0cd03d3..0000000000 --- a/apis/cognitoidentity/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Pool -func (mg *Pool) GetTerraformResourceType() string { - return "aws_cognito_identity_pool" -} - -// GetConnectionDetailsMapping for this Pool -func (tr *Pool) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Pool -func (tr *Pool) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Pool -func (tr *Pool) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Pool -func (tr *Pool) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Pool -func (tr *Pool) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Pool -func (tr *Pool) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Pool -func (tr *Pool) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Pool -func (tr *Pool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Pool using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Pool) LateInitialize(attrs []byte) (bool, error) { - params := &PoolParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Pool) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CognitoIdentityPoolProviderPrincipalTag -func (mg *CognitoIdentityPoolProviderPrincipalTag) GetTerraformResourceType() string { - return "aws_cognito_identity_pool_provider_principal_tag" -} - -// GetConnectionDetailsMapping for this CognitoIdentityPoolProviderPrincipalTag -func (tr *CognitoIdentityPoolProviderPrincipalTag) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CognitoIdentityPoolProviderPrincipalTag -func (tr *CognitoIdentityPoolProviderPrincipalTag) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CognitoIdentityPoolProviderPrincipalTag -func (tr *CognitoIdentityPoolProviderPrincipalTag) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CognitoIdentityPoolProviderPrincipalTag -func (tr *CognitoIdentityPoolProviderPrincipalTag) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CognitoIdentityPoolProviderPrincipalTag -func (tr *CognitoIdentityPoolProviderPrincipalTag) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CognitoIdentityPoolProviderPrincipalTag -func (tr *CognitoIdentityPoolProviderPrincipalTag) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CognitoIdentityPoolProviderPrincipalTag -func (tr *CognitoIdentityPoolProviderPrincipalTag) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CognitoIdentityPoolProviderPrincipalTag -func (tr *CognitoIdentityPoolProviderPrincipalTag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CognitoIdentityPoolProviderPrincipalTag using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CognitoIdentityPoolProviderPrincipalTag) LateInitialize(attrs []byte) (bool, error) { - params := &CognitoIdentityPoolProviderPrincipalTagParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CognitoIdentityPoolProviderPrincipalTag) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PoolRolesAttachment -func (mg *PoolRolesAttachment) GetTerraformResourceType() string { - return "aws_cognito_identity_pool_roles_attachment" -} - -// GetConnectionDetailsMapping for this PoolRolesAttachment -func (tr *PoolRolesAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PoolRolesAttachment -func (tr *PoolRolesAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PoolRolesAttachment -func (tr *PoolRolesAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PoolRolesAttachment -func (tr *PoolRolesAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PoolRolesAttachment -func (tr *PoolRolesAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PoolRolesAttachment -func (tr *PoolRolesAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PoolRolesAttachment -func (tr *PoolRolesAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PoolRolesAttachment -func (tr *PoolRolesAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PoolRolesAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PoolRolesAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &PoolRolesAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PoolRolesAttachment) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/cognitoidentity/v1beta1/zz_pool_terraformed.go b/apis/cognitoidentity/v1beta1/zz_pool_terraformed.go new file mode 100755 index 0000000000..b8f9313695 --- /dev/null +++ b/apis/cognitoidentity/v1beta1/zz_pool_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Pool +func (mg *Pool) GetTerraformResourceType() string { + return "aws_cognito_identity_pool" +} + +// GetConnectionDetailsMapping for this Pool +func (tr *Pool) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Pool +func (tr *Pool) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Pool +func (tr *Pool) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Pool +func (tr *Pool) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Pool +func (tr *Pool) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Pool +func (tr *Pool) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Pool +func (tr *Pool) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Pool +func (tr *Pool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Pool using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Pool) LateInitialize(attrs []byte) (bool, error) { + params := &PoolParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Pool) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidentity/v1beta1/zz_pool_types.go b/apis/cognitoidentity/v1beta1/zz_pool_types.go index 3d10d86d3c..9e025ca3c3 100755 --- a/apis/cognitoidentity/v1beta1/zz_pool_types.go +++ b/apis/cognitoidentity/v1beta1/zz_pool_types.go @@ -244,13 +244,14 @@ type PoolStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Pool is the Schema for the Pools API. Provides an AWS Cognito Identity Pool. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Pool struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidentity/v1beta1/zz_poolrolesattachment_terraformed.go b/apis/cognitoidentity/v1beta1/zz_poolrolesattachment_terraformed.go new file mode 100755 index 0000000000..a8ec6ec360 --- /dev/null +++ b/apis/cognitoidentity/v1beta1/zz_poolrolesattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PoolRolesAttachment +func (mg *PoolRolesAttachment) GetTerraformResourceType() string { + return "aws_cognito_identity_pool_roles_attachment" +} + +// GetConnectionDetailsMapping for this PoolRolesAttachment +func (tr *PoolRolesAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PoolRolesAttachment +func (tr *PoolRolesAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PoolRolesAttachment +func (tr *PoolRolesAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PoolRolesAttachment +func (tr *PoolRolesAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PoolRolesAttachment +func (tr *PoolRolesAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PoolRolesAttachment +func (tr *PoolRolesAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PoolRolesAttachment +func (tr *PoolRolesAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PoolRolesAttachment +func (tr *PoolRolesAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PoolRolesAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PoolRolesAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &PoolRolesAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PoolRolesAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidentity/v1beta1/zz_poolrolesattachment_types.go b/apis/cognitoidentity/v1beta1/zz_poolrolesattachment_types.go index 7a83943ee3..2ed88b19eb 100755 --- a/apis/cognitoidentity/v1beta1/zz_poolrolesattachment_types.go +++ b/apis/cognitoidentity/v1beta1/zz_poolrolesattachment_types.go @@ -229,13 +229,14 @@ type PoolRolesAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PoolRolesAttachment is the Schema for the PoolRolesAttachments API. Provides an AWS Cognito Identity Pool Roles Attachment. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PoolRolesAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidp/v1beta1/zz_generated.conversion_hubs.go b/apis/cognitoidp/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..5dc46305b6 --- /dev/null +++ b/apis/cognitoidp/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,41 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *IdentityProvider) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResourceServer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RiskConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *User) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserInGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserPool) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserPoolClient) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserPoolDomain) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserPoolUICustomization) Hub() {} diff --git a/apis/cognitoidp/v1beta1/zz_generated_terraformed.go b/apis/cognitoidp/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 38a0365533..0000000000 --- a/apis/cognitoidp/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1163 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this IdentityProvider -func (mg *IdentityProvider) GetTerraformResourceType() string { - return "aws_cognito_identity_provider" -} - -// GetConnectionDetailsMapping for this IdentityProvider -func (tr *IdentityProvider) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this IdentityProvider -func (tr *IdentityProvider) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this IdentityProvider -func (tr *IdentityProvider) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this IdentityProvider -func (tr *IdentityProvider) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this IdentityProvider -func (tr *IdentityProvider) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this IdentityProvider -func (tr *IdentityProvider) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this IdentityProvider -func (tr *IdentityProvider) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this IdentityProvider -func (tr *IdentityProvider) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this IdentityProvider using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *IdentityProvider) LateInitialize(attrs []byte) (bool, error) { - params := &IdentityProviderParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *IdentityProvider) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ResourceServer -func (mg *ResourceServer) GetTerraformResourceType() string { - return "aws_cognito_resource_server" -} - -// GetConnectionDetailsMapping for this ResourceServer -func (tr *ResourceServer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResourceServer -func (tr *ResourceServer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResourceServer -func (tr *ResourceServer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResourceServer -func (tr *ResourceServer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResourceServer -func (tr *ResourceServer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResourceServer -func (tr *ResourceServer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResourceServer -func (tr *ResourceServer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResourceServer -func (tr *ResourceServer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResourceServer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResourceServer) LateInitialize(attrs []byte) (bool, error) { - params := &ResourceServerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResourceServer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RiskConfiguration -func (mg *RiskConfiguration) GetTerraformResourceType() string { - return "aws_cognito_risk_configuration" -} - -// GetConnectionDetailsMapping for this RiskConfiguration -func (tr *RiskConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RiskConfiguration -func (tr *RiskConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RiskConfiguration -func (tr *RiskConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RiskConfiguration -func (tr *RiskConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RiskConfiguration -func (tr *RiskConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RiskConfiguration -func (tr *RiskConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RiskConfiguration -func (tr *RiskConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RiskConfiguration -func (tr *RiskConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RiskConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RiskConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &RiskConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RiskConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this User -func (mg *User) GetTerraformResourceType() string { - return "aws_cognito_user" -} - -// GetConnectionDetailsMapping for this User -func (tr *User) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"password": "spec.forProvider.passwordSecretRef", "temporary_password": "spec.forProvider.temporaryPasswordSecretRef"} -} - -// GetObservation of this User -func (tr *User) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this User -func (tr *User) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this User -func (tr *User) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this User -func (tr *User) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this User -func (tr *User) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this User -func (tr *User) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this User -func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this User using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *User) LateInitialize(attrs []byte) (bool, error) { - params := &UserParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *User) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserGroup -func (mg *UserGroup) GetTerraformResourceType() string { - return "aws_cognito_user_group" -} - -// GetConnectionDetailsMapping for this UserGroup -func (tr *UserGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserGroup -func (tr *UserGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserGroup -func (tr *UserGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserGroup -func (tr *UserGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserGroup -func (tr *UserGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserGroup -func (tr *UserGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserGroup -func (tr *UserGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserGroup -func (tr *UserGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserGroup) LateInitialize(attrs []byte) (bool, error) { - params := &UserGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserInGroup -func (mg *UserInGroup) GetTerraformResourceType() string { - return "aws_cognito_user_in_group" -} - -// GetConnectionDetailsMapping for this UserInGroup -func (tr *UserInGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserInGroup -func (tr *UserInGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserInGroup -func (tr *UserInGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserInGroup -func (tr *UserInGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserInGroup -func (tr *UserInGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserInGroup -func (tr *UserInGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserInGroup -func (tr *UserInGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserInGroup -func (tr *UserInGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserInGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserInGroup) LateInitialize(attrs []byte) (bool, error) { - params := &UserInGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserInGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserPool -func (mg *UserPool) GetTerraformResourceType() string { - return "aws_cognito_user_pool" -} - -// GetConnectionDetailsMapping for this UserPool -func (tr *UserPool) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserPool -func (tr *UserPool) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserPool -func (tr *UserPool) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserPool -func (tr *UserPool) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserPool -func (tr *UserPool) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserPool -func (tr *UserPool) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserPool -func (tr *UserPool) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserPool -func (tr *UserPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserPool using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserPool) LateInitialize(attrs []byte) (bool, error) { - params := &UserPoolParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("EmailVerificationMessage")) - opts = append(opts, resource.WithNameFilter("EmailVerificationSubject")) - opts = append(opts, resource.WithNameFilter("SMSVerificationMessage")) - opts = append(opts, resource.WithNameFilter("VerificationMessageTemplate")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserPool) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserPoolClient -func (mg *UserPoolClient) GetTerraformResourceType() string { - return "aws_cognito_user_pool_client" -} - -// GetConnectionDetailsMapping for this UserPoolClient -func (tr *UserPoolClient) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"client_secret": "status.atProvider.clientSecret"} -} - -// GetObservation of this UserPoolClient -func (tr *UserPoolClient) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserPoolClient -func (tr *UserPoolClient) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserPoolClient -func (tr *UserPoolClient) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserPoolClient -func (tr *UserPoolClient) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserPoolClient -func (tr *UserPoolClient) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserPoolClient -func (tr *UserPoolClient) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserPoolClient -func (tr *UserPoolClient) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserPoolClient using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserPoolClient) LateInitialize(attrs []byte) (bool, error) { - params := &UserPoolClientParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserPoolClient) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserPoolDomain -func (mg *UserPoolDomain) GetTerraformResourceType() string { - return "aws_cognito_user_pool_domain" -} - -// GetConnectionDetailsMapping for this UserPoolDomain -func (tr *UserPoolDomain) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserPoolDomain -func (tr *UserPoolDomain) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserPoolDomain -func (tr *UserPoolDomain) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserPoolDomain -func (tr *UserPoolDomain) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserPoolDomain -func (tr *UserPoolDomain) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserPoolDomain -func (tr *UserPoolDomain) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserPoolDomain -func (tr *UserPoolDomain) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserPoolDomain -func (tr *UserPoolDomain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserPoolDomain using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserPoolDomain) LateInitialize(attrs []byte) (bool, error) { - params := &UserPoolDomainParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserPoolDomain) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserPoolUICustomization -func (mg *UserPoolUICustomization) GetTerraformResourceType() string { - return "aws_cognito_user_pool_ui_customization" -} - -// GetConnectionDetailsMapping for this UserPoolUICustomization -func (tr *UserPoolUICustomization) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserPoolUICustomization -func (tr *UserPoolUICustomization) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserPoolUICustomization -func (tr *UserPoolUICustomization) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserPoolUICustomization -func (tr *UserPoolUICustomization) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserPoolUICustomization -func (tr *UserPoolUICustomization) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserPoolUICustomization -func (tr *UserPoolUICustomization) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserPoolUICustomization -func (tr *UserPoolUICustomization) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserPoolUICustomization -func (tr *UserPoolUICustomization) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserPoolUICustomization using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserPoolUICustomization) LateInitialize(attrs []byte) (bool, error) { - params := &UserPoolUICustomizationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserPoolUICustomization) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/cognitoidp/v1beta1/zz_identityprovider_terraformed.go b/apis/cognitoidp/v1beta1/zz_identityprovider_terraformed.go new file mode 100755 index 0000000000..10cc59b101 --- /dev/null +++ b/apis/cognitoidp/v1beta1/zz_identityprovider_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this IdentityProvider +func (mg *IdentityProvider) GetTerraformResourceType() string { + return "aws_cognito_identity_provider" +} + +// GetConnectionDetailsMapping for this IdentityProvider +func (tr *IdentityProvider) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this IdentityProvider +func (tr *IdentityProvider) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this IdentityProvider +func (tr *IdentityProvider) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this IdentityProvider +func (tr *IdentityProvider) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this IdentityProvider +func (tr *IdentityProvider) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this IdentityProvider +func (tr *IdentityProvider) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this IdentityProvider +func (tr *IdentityProvider) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this IdentityProvider +func (tr *IdentityProvider) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this IdentityProvider using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *IdentityProvider) LateInitialize(attrs []byte) (bool, error) { + params := &IdentityProviderParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *IdentityProvider) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidp/v1beta1/zz_identityprovider_types.go b/apis/cognitoidp/v1beta1/zz_identityprovider_types.go index 172195be95..ca8c3060ec 100755 --- a/apis/cognitoidp/v1beta1/zz_identityprovider_types.go +++ b/apis/cognitoidp/v1beta1/zz_identityprovider_types.go @@ -141,13 +141,14 @@ type IdentityProviderStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IdentityProvider is the Schema for the IdentityProviders API. Provides a Cognito User Identity Provider resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type IdentityProvider struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidp/v1beta1/zz_resourceserver_terraformed.go b/apis/cognitoidp/v1beta1/zz_resourceserver_terraformed.go new file mode 100755 index 0000000000..4500bad93d --- /dev/null +++ b/apis/cognitoidp/v1beta1/zz_resourceserver_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResourceServer +func (mg *ResourceServer) GetTerraformResourceType() string { + return "aws_cognito_resource_server" +} + +// GetConnectionDetailsMapping for this ResourceServer +func (tr *ResourceServer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResourceServer +func (tr *ResourceServer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResourceServer +func (tr *ResourceServer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResourceServer +func (tr *ResourceServer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResourceServer +func (tr *ResourceServer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResourceServer +func (tr *ResourceServer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResourceServer +func (tr *ResourceServer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResourceServer +func (tr *ResourceServer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResourceServer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResourceServer) LateInitialize(attrs []byte) (bool, error) { + params := &ResourceServerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResourceServer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidp/v1beta1/zz_resourceserver_types.go b/apis/cognitoidp/v1beta1/zz_resourceserver_types.go index 0ab212922b..88fd89cdab 100755 --- a/apis/cognitoidp/v1beta1/zz_resourceserver_types.go +++ b/apis/cognitoidp/v1beta1/zz_resourceserver_types.go @@ -143,13 +143,14 @@ type ResourceServerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResourceServer is the Schema for the ResourceServers API. Provides a Cognito Resource Server. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResourceServer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidp/v1beta1/zz_riskconfiguration_terraformed.go b/apis/cognitoidp/v1beta1/zz_riskconfiguration_terraformed.go new file mode 100755 index 0000000000..8bf842eb09 --- /dev/null +++ b/apis/cognitoidp/v1beta1/zz_riskconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RiskConfiguration +func (mg *RiskConfiguration) GetTerraformResourceType() string { + return "aws_cognito_risk_configuration" +} + +// GetConnectionDetailsMapping for this RiskConfiguration +func (tr *RiskConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RiskConfiguration +func (tr *RiskConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RiskConfiguration +func (tr *RiskConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RiskConfiguration +func (tr *RiskConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RiskConfiguration +func (tr *RiskConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RiskConfiguration +func (tr *RiskConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RiskConfiguration +func (tr *RiskConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RiskConfiguration +func (tr *RiskConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RiskConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RiskConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &RiskConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RiskConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidp/v1beta1/zz_riskconfiguration_types.go b/apis/cognitoidp/v1beta1/zz_riskconfiguration_types.go index 40d795df46..a2ce95ba27 100755 --- a/apis/cognitoidp/v1beta1/zz_riskconfiguration_types.go +++ b/apis/cognitoidp/v1beta1/zz_riskconfiguration_types.go @@ -567,13 +567,14 @@ type RiskConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RiskConfiguration is the Schema for the RiskConfigurations API. Provides a Cognito Risk Configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RiskConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidp/v1beta1/zz_user_terraformed.go b/apis/cognitoidp/v1beta1/zz_user_terraformed.go new file mode 100755 index 0000000000..a0fb68a15d --- /dev/null +++ b/apis/cognitoidp/v1beta1/zz_user_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this User +func (mg *User) GetTerraformResourceType() string { + return "aws_cognito_user" +} + +// GetConnectionDetailsMapping for this User +func (tr *User) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"password": "spec.forProvider.passwordSecretRef", "temporary_password": "spec.forProvider.temporaryPasswordSecretRef"} +} + +// GetObservation of this User +func (tr *User) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this User +func (tr *User) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this User +func (tr *User) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this User +func (tr *User) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this User +func (tr *User) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this User +func (tr *User) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this User +func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this User using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *User) LateInitialize(attrs []byte) (bool, error) { + params := &UserParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *User) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidp/v1beta1/zz_user_types.go b/apis/cognitoidp/v1beta1/zz_user_types.go index ecd6b1cb5d..4eaf95250f 100755 --- a/apis/cognitoidp/v1beta1/zz_user_types.go +++ b/apis/cognitoidp/v1beta1/zz_user_types.go @@ -179,13 +179,14 @@ type UserStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // User is the Schema for the Users API. Provides a Cognito User resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type User struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidp/v1beta1/zz_usergroup_terraformed.go b/apis/cognitoidp/v1beta1/zz_usergroup_terraformed.go new file mode 100755 index 0000000000..0f7a100ba3 --- /dev/null +++ b/apis/cognitoidp/v1beta1/zz_usergroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserGroup +func (mg *UserGroup) GetTerraformResourceType() string { + return "aws_cognito_user_group" +} + +// GetConnectionDetailsMapping for this UserGroup +func (tr *UserGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserGroup +func (tr *UserGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserGroup +func (tr *UserGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserGroup +func (tr *UserGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserGroup +func (tr *UserGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserGroup +func (tr *UserGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserGroup +func (tr *UserGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserGroup +func (tr *UserGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserGroup) LateInitialize(attrs []byte) (bool, error) { + params := &UserGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidp/v1beta1/zz_usergroup_types.go b/apis/cognitoidp/v1beta1/zz_usergroup_types.go index 75eec28619..f58ea265cb 100755 --- a/apis/cognitoidp/v1beta1/zz_usergroup_types.go +++ b/apis/cognitoidp/v1beta1/zz_usergroup_types.go @@ -145,13 +145,14 @@ type UserGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserGroup is the Schema for the UserGroups API. Provides a Cognito User Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidp/v1beta1/zz_useringroup_terraformed.go b/apis/cognitoidp/v1beta1/zz_useringroup_terraformed.go new file mode 100755 index 0000000000..be29057286 --- /dev/null +++ b/apis/cognitoidp/v1beta1/zz_useringroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserInGroup +func (mg *UserInGroup) GetTerraformResourceType() string { + return "aws_cognito_user_in_group" +} + +// GetConnectionDetailsMapping for this UserInGroup +func (tr *UserInGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserInGroup +func (tr *UserInGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserInGroup +func (tr *UserInGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserInGroup +func (tr *UserInGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserInGroup +func (tr *UserInGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserInGroup +func (tr *UserInGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserInGroup +func (tr *UserInGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserInGroup +func (tr *UserInGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserInGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserInGroup) LateInitialize(attrs []byte) (bool, error) { + params := &UserInGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserInGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidp/v1beta1/zz_useringroup_types.go b/apis/cognitoidp/v1beta1/zz_useringroup_types.go index a98372f0cd..0d2f7069e4 100755 --- a/apis/cognitoidp/v1beta1/zz_useringroup_types.go +++ b/apis/cognitoidp/v1beta1/zz_useringroup_types.go @@ -145,13 +145,14 @@ type UserInGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserInGroup is the Schema for the UserInGroups API. Adds the specified user to the specified group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserInGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidp/v1beta1/zz_userpool_terraformed.go b/apis/cognitoidp/v1beta1/zz_userpool_terraformed.go new file mode 100755 index 0000000000..b7fb0ee59f --- /dev/null +++ b/apis/cognitoidp/v1beta1/zz_userpool_terraformed.go @@ -0,0 +1,137 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserPool +func (mg *UserPool) GetTerraformResourceType() string { + return "aws_cognito_user_pool" +} + +// GetConnectionDetailsMapping for this UserPool +func (tr *UserPool) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserPool +func (tr *UserPool) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserPool +func (tr *UserPool) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserPool +func (tr *UserPool) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserPool +func (tr *UserPool) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserPool +func (tr *UserPool) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserPool +func (tr *UserPool) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserPool +func (tr *UserPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserPool using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserPool) LateInitialize(attrs []byte) (bool, error) { + params := &UserPoolParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("EmailVerificationMessage")) + opts = append(opts, resource.WithNameFilter("EmailVerificationSubject")) + opts = append(opts, resource.WithNameFilter("SMSVerificationMessage")) + opts = append(opts, resource.WithNameFilter("VerificationMessageTemplate")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserPool) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidp/v1beta1/zz_userpool_types.go b/apis/cognitoidp/v1beta1/zz_userpool_types.go index 59842ca64e..d0a3a6947a 100755 --- a/apis/cognitoidp/v1beta1/zz_userpool_types.go +++ b/apis/cognitoidp/v1beta1/zz_userpool_types.go @@ -1409,13 +1409,14 @@ type UserPoolStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserPool is the Schema for the UserPools API. Provides a Cognito User Pool resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserPool struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidp/v1beta1/zz_userpoolclient_terraformed.go b/apis/cognitoidp/v1beta1/zz_userpoolclient_terraformed.go new file mode 100755 index 0000000000..90f2f30dcc --- /dev/null +++ b/apis/cognitoidp/v1beta1/zz_userpoolclient_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserPoolClient +func (mg *UserPoolClient) GetTerraformResourceType() string { + return "aws_cognito_user_pool_client" +} + +// GetConnectionDetailsMapping for this UserPoolClient +func (tr *UserPoolClient) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"client_secret": "status.atProvider.clientSecret"} +} + +// GetObservation of this UserPoolClient +func (tr *UserPoolClient) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserPoolClient +func (tr *UserPoolClient) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserPoolClient +func (tr *UserPoolClient) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserPoolClient +func (tr *UserPoolClient) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserPoolClient +func (tr *UserPoolClient) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserPoolClient +func (tr *UserPoolClient) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserPoolClient +func (tr *UserPoolClient) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserPoolClient using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserPoolClient) LateInitialize(attrs []byte) (bool, error) { + params := &UserPoolClientParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserPoolClient) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidp/v1beta1/zz_userpoolclient_types.go b/apis/cognitoidp/v1beta1/zz_userpoolclient_types.go index 1c2bafc544..703fed2a01 100755 --- a/apis/cognitoidp/v1beta1/zz_userpoolclient_types.go +++ b/apis/cognitoidp/v1beta1/zz_userpoolclient_types.go @@ -476,13 +476,14 @@ type UserPoolClientStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserPoolClient is the Schema for the UserPoolClients API. Provides a Cognito User Pool Client resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserPoolClient struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidp/v1beta1/zz_userpooldomain_terraformed.go b/apis/cognitoidp/v1beta1/zz_userpooldomain_terraformed.go new file mode 100755 index 0000000000..6df97041c4 --- /dev/null +++ b/apis/cognitoidp/v1beta1/zz_userpooldomain_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserPoolDomain +func (mg *UserPoolDomain) GetTerraformResourceType() string { + return "aws_cognito_user_pool_domain" +} + +// GetConnectionDetailsMapping for this UserPoolDomain +func (tr *UserPoolDomain) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserPoolDomain +func (tr *UserPoolDomain) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserPoolDomain +func (tr *UserPoolDomain) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserPoolDomain +func (tr *UserPoolDomain) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserPoolDomain +func (tr *UserPoolDomain) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserPoolDomain +func (tr *UserPoolDomain) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserPoolDomain +func (tr *UserPoolDomain) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserPoolDomain +func (tr *UserPoolDomain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserPoolDomain using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserPoolDomain) LateInitialize(attrs []byte) (bool, error) { + params := &UserPoolDomainParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserPoolDomain) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidp/v1beta1/zz_userpooldomain_types.go b/apis/cognitoidp/v1beta1/zz_userpooldomain_types.go index e7fac4a7b9..825e9e061b 100755 --- a/apis/cognitoidp/v1beta1/zz_userpooldomain_types.go +++ b/apis/cognitoidp/v1beta1/zz_userpooldomain_types.go @@ -143,13 +143,14 @@ type UserPoolDomainStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserPoolDomain is the Schema for the UserPoolDomains API. Provides a Cognito User Pool Domain resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserPoolDomain struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cognitoidp/v1beta1/zz_userpooluicustomization_terraformed.go b/apis/cognitoidp/v1beta1/zz_userpooluicustomization_terraformed.go new file mode 100755 index 0000000000..016718238a --- /dev/null +++ b/apis/cognitoidp/v1beta1/zz_userpooluicustomization_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserPoolUICustomization +func (mg *UserPoolUICustomization) GetTerraformResourceType() string { + return "aws_cognito_user_pool_ui_customization" +} + +// GetConnectionDetailsMapping for this UserPoolUICustomization +func (tr *UserPoolUICustomization) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserPoolUICustomization +func (tr *UserPoolUICustomization) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserPoolUICustomization +func (tr *UserPoolUICustomization) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserPoolUICustomization +func (tr *UserPoolUICustomization) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserPoolUICustomization +func (tr *UserPoolUICustomization) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserPoolUICustomization +func (tr *UserPoolUICustomization) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserPoolUICustomization +func (tr *UserPoolUICustomization) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserPoolUICustomization +func (tr *UserPoolUICustomization) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserPoolUICustomization using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserPoolUICustomization) LateInitialize(attrs []byte) (bool, error) { + params := &UserPoolUICustomizationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserPoolUICustomization) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/cognitoidp/v1beta1/zz_userpooluicustomization_types.go b/apis/cognitoidp/v1beta1/zz_userpooluicustomization_types.go index 6624fe3cce..e3fa5af855 100755 --- a/apis/cognitoidp/v1beta1/zz_userpooluicustomization_types.go +++ b/apis/cognitoidp/v1beta1/zz_userpooluicustomization_types.go @@ -145,13 +145,14 @@ type UserPoolUICustomizationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserPoolUICustomization is the Schema for the UserPoolUICustomizations API. Provides a Cognito User Pool UI Customization resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserPoolUICustomization struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/configservice/v1beta1/zz_awsconfigurationrecorderstatus_terraformed.go b/apis/configservice/v1beta1/zz_awsconfigurationrecorderstatus_terraformed.go new file mode 100755 index 0000000000..1c6a163171 --- /dev/null +++ b/apis/configservice/v1beta1/zz_awsconfigurationrecorderstatus_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AWSConfigurationRecorderStatus +func (mg *AWSConfigurationRecorderStatus) GetTerraformResourceType() string { + return "aws_config_configuration_recorder_status" +} + +// GetConnectionDetailsMapping for this AWSConfigurationRecorderStatus +func (tr *AWSConfigurationRecorderStatus) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AWSConfigurationRecorderStatus +func (tr *AWSConfigurationRecorderStatus) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AWSConfigurationRecorderStatus +func (tr *AWSConfigurationRecorderStatus) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AWSConfigurationRecorderStatus +func (tr *AWSConfigurationRecorderStatus) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AWSConfigurationRecorderStatus +func (tr *AWSConfigurationRecorderStatus) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AWSConfigurationRecorderStatus +func (tr *AWSConfigurationRecorderStatus) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AWSConfigurationRecorderStatus +func (tr *AWSConfigurationRecorderStatus) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AWSConfigurationRecorderStatus +func (tr *AWSConfigurationRecorderStatus) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AWSConfigurationRecorderStatus using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AWSConfigurationRecorderStatus) LateInitialize(attrs []byte) (bool, error) { + params := &AWSConfigurationRecorderStatusParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AWSConfigurationRecorderStatus) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/configservice/v1beta1/zz_awsconfigurationrecorderstatus_types.go b/apis/configservice/v1beta1/zz_awsconfigurationrecorderstatus_types.go index 5dbf82d8eb..1e0f7afa82 100755 --- a/apis/configservice/v1beta1/zz_awsconfigurationrecorderstatus_types.go +++ b/apis/configservice/v1beta1/zz_awsconfigurationrecorderstatus_types.go @@ -66,13 +66,14 @@ type AWSConfigurationRecorderStatusStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AWSConfigurationRecorderStatus is the Schema for the AWSConfigurationRecorderStatuss API. Manages status of an AWS Config Configuration Recorder. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AWSConfigurationRecorderStatus struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/configservice/v1beta1/zz_configrule_terraformed.go b/apis/configservice/v1beta1/zz_configrule_terraformed.go new file mode 100755 index 0000000000..9accfd918b --- /dev/null +++ b/apis/configservice/v1beta1/zz_configrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConfigRule +func (mg *ConfigRule) GetTerraformResourceType() string { + return "aws_config_config_rule" +} + +// GetConnectionDetailsMapping for this ConfigRule +func (tr *ConfigRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ConfigRule +func (tr *ConfigRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConfigRule +func (tr *ConfigRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConfigRule +func (tr *ConfigRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConfigRule +func (tr *ConfigRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConfigRule +func (tr *ConfigRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConfigRule +func (tr *ConfigRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConfigRule +func (tr *ConfigRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConfigRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConfigRule) LateInitialize(attrs []byte) (bool, error) { + params := &ConfigRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConfigRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/configservice/v1beta1/zz_configrule_types.go b/apis/configservice/v1beta1/zz_configrule_types.go index facc94c5eb..db0a64ca52 100755 --- a/apis/configservice/v1beta1/zz_configrule_types.go +++ b/apis/configservice/v1beta1/zz_configrule_types.go @@ -329,13 +329,14 @@ type ConfigRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConfigRule is the Schema for the ConfigRules API. Provides an AWS Config Rule. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConfigRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/configservice/v1beta1/zz_configurationaggregator_terraformed.go b/apis/configservice/v1beta1/zz_configurationaggregator_terraformed.go new file mode 100755 index 0000000000..de31f971d5 --- /dev/null +++ b/apis/configservice/v1beta1/zz_configurationaggregator_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConfigurationAggregator +func (mg *ConfigurationAggregator) GetTerraformResourceType() string { + return "aws_config_configuration_aggregator" +} + +// GetConnectionDetailsMapping for this ConfigurationAggregator +func (tr *ConfigurationAggregator) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ConfigurationAggregator +func (tr *ConfigurationAggregator) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConfigurationAggregator +func (tr *ConfigurationAggregator) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConfigurationAggregator +func (tr *ConfigurationAggregator) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConfigurationAggregator +func (tr *ConfigurationAggregator) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConfigurationAggregator +func (tr *ConfigurationAggregator) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConfigurationAggregator +func (tr *ConfigurationAggregator) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConfigurationAggregator +func (tr *ConfigurationAggregator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConfigurationAggregator using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConfigurationAggregator) LateInitialize(attrs []byte) (bool, error) { + params := &ConfigurationAggregatorParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConfigurationAggregator) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/configservice/v1beta1/zz_configurationaggregator_types.go b/apis/configservice/v1beta1/zz_configurationaggregator_types.go index b21bd64dbf..c30950e393 100755 --- a/apis/configservice/v1beta1/zz_configurationaggregator_types.go +++ b/apis/configservice/v1beta1/zz_configurationaggregator_types.go @@ -195,13 +195,14 @@ type ConfigurationAggregatorStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConfigurationAggregator is the Schema for the ConfigurationAggregators API. Manages an AWS Config Configuration Aggregator. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConfigurationAggregator struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/configservice/v1beta1/zz_configurationrecorder_terraformed.go b/apis/configservice/v1beta1/zz_configurationrecorder_terraformed.go new file mode 100755 index 0000000000..f46f8bcbc8 --- /dev/null +++ b/apis/configservice/v1beta1/zz_configurationrecorder_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConfigurationRecorder +func (mg *ConfigurationRecorder) GetTerraformResourceType() string { + return "aws_config_configuration_recorder" +} + +// GetConnectionDetailsMapping for this ConfigurationRecorder +func (tr *ConfigurationRecorder) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ConfigurationRecorder +func (tr *ConfigurationRecorder) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConfigurationRecorder +func (tr *ConfigurationRecorder) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConfigurationRecorder +func (tr *ConfigurationRecorder) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConfigurationRecorder +func (tr *ConfigurationRecorder) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConfigurationRecorder +func (tr *ConfigurationRecorder) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConfigurationRecorder +func (tr *ConfigurationRecorder) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConfigurationRecorder +func (tr *ConfigurationRecorder) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConfigurationRecorder using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConfigurationRecorder) LateInitialize(attrs []byte) (bool, error) { + params := &ConfigurationRecorderParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConfigurationRecorder) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/configservice/v1beta1/zz_configurationrecorder_types.go b/apis/configservice/v1beta1/zz_configurationrecorder_types.go index bd2c6b0fbd..48f411402a 100755 --- a/apis/configservice/v1beta1/zz_configurationrecorder_types.go +++ b/apis/configservice/v1beta1/zz_configurationrecorder_types.go @@ -140,13 +140,14 @@ type ConfigurationRecorderStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConfigurationRecorder is the Schema for the ConfigurationRecorders API. Provides an AWS Config Configuration Recorder. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConfigurationRecorder struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/configservice/v1beta1/zz_conformancepack_terraformed.go b/apis/configservice/v1beta1/zz_conformancepack_terraformed.go new file mode 100755 index 0000000000..fba81ff2c2 --- /dev/null +++ b/apis/configservice/v1beta1/zz_conformancepack_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConformancePack +func (mg *ConformancePack) GetTerraformResourceType() string { + return "aws_config_conformance_pack" +} + +// GetConnectionDetailsMapping for this ConformancePack +func (tr *ConformancePack) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ConformancePack +func (tr *ConformancePack) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConformancePack +func (tr *ConformancePack) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConformancePack +func (tr *ConformancePack) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConformancePack +func (tr *ConformancePack) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConformancePack +func (tr *ConformancePack) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConformancePack +func (tr *ConformancePack) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConformancePack +func (tr *ConformancePack) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConformancePack using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConformancePack) LateInitialize(attrs []byte) (bool, error) { + params := &ConformancePackParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConformancePack) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/configservice/v1beta1/zz_conformancepack_types.go b/apis/configservice/v1beta1/zz_conformancepack_types.go index 5393e92fdb..06ba18dcc9 100755 --- a/apis/configservice/v1beta1/zz_conformancepack_types.go +++ b/apis/configservice/v1beta1/zz_conformancepack_types.go @@ -139,13 +139,14 @@ type ConformancePackStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConformancePack is the Schema for the ConformancePacks API. Manages a Config Conformance Pack // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConformancePack struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/configservice/v1beta1/zz_deliverychannel_terraformed.go b/apis/configservice/v1beta1/zz_deliverychannel_terraformed.go new file mode 100755 index 0000000000..f152dfa7fe --- /dev/null +++ b/apis/configservice/v1beta1/zz_deliverychannel_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DeliveryChannel +func (mg *DeliveryChannel) GetTerraformResourceType() string { + return "aws_config_delivery_channel" +} + +// GetConnectionDetailsMapping for this DeliveryChannel +func (tr *DeliveryChannel) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DeliveryChannel +func (tr *DeliveryChannel) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DeliveryChannel +func (tr *DeliveryChannel) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DeliveryChannel +func (tr *DeliveryChannel) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DeliveryChannel +func (tr *DeliveryChannel) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DeliveryChannel +func (tr *DeliveryChannel) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DeliveryChannel +func (tr *DeliveryChannel) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DeliveryChannel +func (tr *DeliveryChannel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DeliveryChannel using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DeliveryChannel) LateInitialize(attrs []byte) (bool, error) { + params := &DeliveryChannelParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DeliveryChannel) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/configservice/v1beta1/zz_deliverychannel_types.go b/apis/configservice/v1beta1/zz_deliverychannel_types.go index 4e895276ce..355ff0f325 100755 --- a/apis/configservice/v1beta1/zz_deliverychannel_types.go +++ b/apis/configservice/v1beta1/zz_deliverychannel_types.go @@ -145,13 +145,14 @@ type DeliveryChannelStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DeliveryChannel is the Schema for the DeliveryChannels API. Provides an AWS Config Delivery Channel. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DeliveryChannel struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/configservice/v1beta1/zz_generated.conversion_hubs.go b/apis/configservice/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..fbaf5aa793 --- /dev/null +++ b/apis/configservice/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ConfigRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ConfigurationAggregator) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ConfigurationRecorder) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *AWSConfigurationRecorderStatus) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ConformancePack) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DeliveryChannel) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RemediationConfiguration) Hub() {} diff --git a/apis/configservice/v1beta1/zz_generated_terraformed.go b/apis/configservice/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 97bf228fff..0000000000 --- a/apis/configservice/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,817 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this ConfigRule -func (mg *ConfigRule) GetTerraformResourceType() string { - return "aws_config_config_rule" -} - -// GetConnectionDetailsMapping for this ConfigRule -func (tr *ConfigRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ConfigRule -func (tr *ConfigRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConfigRule -func (tr *ConfigRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConfigRule -func (tr *ConfigRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConfigRule -func (tr *ConfigRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConfigRule -func (tr *ConfigRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConfigRule -func (tr *ConfigRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConfigRule -func (tr *ConfigRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConfigRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConfigRule) LateInitialize(attrs []byte) (bool, error) { - params := &ConfigRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConfigRule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ConfigurationAggregator -func (mg *ConfigurationAggregator) GetTerraformResourceType() string { - return "aws_config_configuration_aggregator" -} - -// GetConnectionDetailsMapping for this ConfigurationAggregator -func (tr *ConfigurationAggregator) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ConfigurationAggregator -func (tr *ConfigurationAggregator) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConfigurationAggregator -func (tr *ConfigurationAggregator) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConfigurationAggregator -func (tr *ConfigurationAggregator) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConfigurationAggregator -func (tr *ConfigurationAggregator) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConfigurationAggregator -func (tr *ConfigurationAggregator) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConfigurationAggregator -func (tr *ConfigurationAggregator) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConfigurationAggregator -func (tr *ConfigurationAggregator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConfigurationAggregator using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConfigurationAggregator) LateInitialize(attrs []byte) (bool, error) { - params := &ConfigurationAggregatorParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConfigurationAggregator) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ConfigurationRecorder -func (mg *ConfigurationRecorder) GetTerraformResourceType() string { - return "aws_config_configuration_recorder" -} - -// GetConnectionDetailsMapping for this ConfigurationRecorder -func (tr *ConfigurationRecorder) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ConfigurationRecorder -func (tr *ConfigurationRecorder) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConfigurationRecorder -func (tr *ConfigurationRecorder) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConfigurationRecorder -func (tr *ConfigurationRecorder) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConfigurationRecorder -func (tr *ConfigurationRecorder) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConfigurationRecorder -func (tr *ConfigurationRecorder) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConfigurationRecorder -func (tr *ConfigurationRecorder) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConfigurationRecorder -func (tr *ConfigurationRecorder) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConfigurationRecorder using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConfigurationRecorder) LateInitialize(attrs []byte) (bool, error) { - params := &ConfigurationRecorderParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConfigurationRecorder) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this AWSConfigurationRecorderStatus -func (mg *AWSConfigurationRecorderStatus) GetTerraformResourceType() string { - return "aws_config_configuration_recorder_status" -} - -// GetConnectionDetailsMapping for this AWSConfigurationRecorderStatus -func (tr *AWSConfigurationRecorderStatus) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AWSConfigurationRecorderStatus -func (tr *AWSConfigurationRecorderStatus) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AWSConfigurationRecorderStatus -func (tr *AWSConfigurationRecorderStatus) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AWSConfigurationRecorderStatus -func (tr *AWSConfigurationRecorderStatus) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AWSConfigurationRecorderStatus -func (tr *AWSConfigurationRecorderStatus) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AWSConfigurationRecorderStatus -func (tr *AWSConfigurationRecorderStatus) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AWSConfigurationRecorderStatus -func (tr *AWSConfigurationRecorderStatus) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AWSConfigurationRecorderStatus -func (tr *AWSConfigurationRecorderStatus) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AWSConfigurationRecorderStatus using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AWSConfigurationRecorderStatus) LateInitialize(attrs []byte) (bool, error) { - params := &AWSConfigurationRecorderStatusParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AWSConfigurationRecorderStatus) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ConformancePack -func (mg *ConformancePack) GetTerraformResourceType() string { - return "aws_config_conformance_pack" -} - -// GetConnectionDetailsMapping for this ConformancePack -func (tr *ConformancePack) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ConformancePack -func (tr *ConformancePack) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConformancePack -func (tr *ConformancePack) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConformancePack -func (tr *ConformancePack) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConformancePack -func (tr *ConformancePack) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConformancePack -func (tr *ConformancePack) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConformancePack -func (tr *ConformancePack) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConformancePack -func (tr *ConformancePack) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConformancePack using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConformancePack) LateInitialize(attrs []byte) (bool, error) { - params := &ConformancePackParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConformancePack) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DeliveryChannel -func (mg *DeliveryChannel) GetTerraformResourceType() string { - return "aws_config_delivery_channel" -} - -// GetConnectionDetailsMapping for this DeliveryChannel -func (tr *DeliveryChannel) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DeliveryChannel -func (tr *DeliveryChannel) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DeliveryChannel -func (tr *DeliveryChannel) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DeliveryChannel -func (tr *DeliveryChannel) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DeliveryChannel -func (tr *DeliveryChannel) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DeliveryChannel -func (tr *DeliveryChannel) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DeliveryChannel -func (tr *DeliveryChannel) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DeliveryChannel -func (tr *DeliveryChannel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DeliveryChannel using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DeliveryChannel) LateInitialize(attrs []byte) (bool, error) { - params := &DeliveryChannelParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DeliveryChannel) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RemediationConfiguration -func (mg *RemediationConfiguration) GetTerraformResourceType() string { - return "aws_config_remediation_configuration" -} - -// GetConnectionDetailsMapping for this RemediationConfiguration -func (tr *RemediationConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RemediationConfiguration -func (tr *RemediationConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RemediationConfiguration -func (tr *RemediationConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RemediationConfiguration -func (tr *RemediationConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RemediationConfiguration -func (tr *RemediationConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RemediationConfiguration -func (tr *RemediationConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RemediationConfiguration -func (tr *RemediationConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RemediationConfiguration -func (tr *RemediationConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RemediationConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RemediationConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &RemediationConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RemediationConfiguration) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/configservice/v1beta1/zz_remediationconfiguration_terraformed.go b/apis/configservice/v1beta1/zz_remediationconfiguration_terraformed.go new file mode 100755 index 0000000000..88679af071 --- /dev/null +++ b/apis/configservice/v1beta1/zz_remediationconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RemediationConfiguration +func (mg *RemediationConfiguration) GetTerraformResourceType() string { + return "aws_config_remediation_configuration" +} + +// GetConnectionDetailsMapping for this RemediationConfiguration +func (tr *RemediationConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RemediationConfiguration +func (tr *RemediationConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RemediationConfiguration +func (tr *RemediationConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RemediationConfiguration +func (tr *RemediationConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RemediationConfiguration +func (tr *RemediationConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RemediationConfiguration +func (tr *RemediationConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RemediationConfiguration +func (tr *RemediationConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RemediationConfiguration +func (tr *RemediationConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RemediationConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RemediationConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &RemediationConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RemediationConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/configservice/v1beta1/zz_remediationconfiguration_types.go b/apis/configservice/v1beta1/zz_remediationconfiguration_types.go index c42ca4a691..a05c4b1494 100755 --- a/apis/configservice/v1beta1/zz_remediationconfiguration_types.go +++ b/apis/configservice/v1beta1/zz_remediationconfiguration_types.go @@ -247,13 +247,14 @@ type RemediationConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RemediationConfiguration is the Schema for the RemediationConfigurations API. Provides an AWS Config Remediation Configuration. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RemediationConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_botassociation_terraformed.go b/apis/connect/v1beta1/zz_botassociation_terraformed.go new file mode 100755 index 0000000000..790f9f2eef --- /dev/null +++ b/apis/connect/v1beta1/zz_botassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BotAssociation +func (mg *BotAssociation) GetTerraformResourceType() string { + return "aws_connect_bot_association" +} + +// GetConnectionDetailsMapping for this BotAssociation +func (tr *BotAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BotAssociation +func (tr *BotAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BotAssociation +func (tr *BotAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BotAssociation +func (tr *BotAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BotAssociation +func (tr *BotAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BotAssociation +func (tr *BotAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BotAssociation +func (tr *BotAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BotAssociation +func (tr *BotAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BotAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BotAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &BotAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BotAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_botassociation_types.go b/apis/connect/v1beta1/zz_botassociation_types.go index a5259d5d24..be4f5ecfff 100755 --- a/apis/connect/v1beta1/zz_botassociation_types.go +++ b/apis/connect/v1beta1/zz_botassociation_types.go @@ -132,13 +132,14 @@ type BotAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BotAssociation is the Schema for the BotAssociations API. Associates an Amazon Connect instance to an Amazon Lex (V1) bot // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BotAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_contactflow_terraformed.go b/apis/connect/v1beta1/zz_contactflow_terraformed.go new file mode 100755 index 0000000000..e8bc939298 --- /dev/null +++ b/apis/connect/v1beta1/zz_contactflow_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ContactFlow +func (mg *ContactFlow) GetTerraformResourceType() string { + return "aws_connect_contact_flow" +} + +// GetConnectionDetailsMapping for this ContactFlow +func (tr *ContactFlow) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ContactFlow +func (tr *ContactFlow) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ContactFlow +func (tr *ContactFlow) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ContactFlow +func (tr *ContactFlow) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ContactFlow +func (tr *ContactFlow) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ContactFlow +func (tr *ContactFlow) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ContactFlow +func (tr *ContactFlow) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ContactFlow +func (tr *ContactFlow) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ContactFlow using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ContactFlow) LateInitialize(attrs []byte) (bool, error) { + params := &ContactFlowParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ContactFlow) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_contactflow_types.go b/apis/connect/v1beta1/zz_contactflow_types.go index 43e2944ed2..a36558e330 100755 --- a/apis/connect/v1beta1/zz_contactflow_types.go +++ b/apis/connect/v1beta1/zz_contactflow_types.go @@ -171,13 +171,14 @@ type ContactFlowStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ContactFlow is the Schema for the ContactFlows API. Provides details about a specific Amazon Connect Contact Flow. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ContactFlow struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_contactflowmodule_terraformed.go b/apis/connect/v1beta1/zz_contactflowmodule_terraformed.go new file mode 100755 index 0000000000..e873862fe8 --- /dev/null +++ b/apis/connect/v1beta1/zz_contactflowmodule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ContactFlowModule +func (mg *ContactFlowModule) GetTerraformResourceType() string { + return "aws_connect_contact_flow_module" +} + +// GetConnectionDetailsMapping for this ContactFlowModule +func (tr *ContactFlowModule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ContactFlowModule +func (tr *ContactFlowModule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ContactFlowModule +func (tr *ContactFlowModule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ContactFlowModule +func (tr *ContactFlowModule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ContactFlowModule +func (tr *ContactFlowModule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ContactFlowModule +func (tr *ContactFlowModule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ContactFlowModule +func (tr *ContactFlowModule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ContactFlowModule +func (tr *ContactFlowModule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ContactFlowModule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ContactFlowModule) LateInitialize(attrs []byte) (bool, error) { + params := &ContactFlowModuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ContactFlowModule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_contactflowmodule_types.go b/apis/connect/v1beta1/zz_contactflowmodule_types.go index 0a8c751782..e4c8d5fc4d 100755 --- a/apis/connect/v1beta1/zz_contactflowmodule_types.go +++ b/apis/connect/v1beta1/zz_contactflowmodule_types.go @@ -161,13 +161,14 @@ type ContactFlowModuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ContactFlowModule is the Schema for the ContactFlowModules API. Provides details about a specific Amazon Connect Contact Flow Module. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ContactFlowModule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_generated.conversion_hubs.go b/apis/connect/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..44264ec465 --- /dev/null +++ b/apis/connect/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,56 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *BotAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ContactFlow) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ContactFlowModule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HoursOfOperation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Instance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InstanceStorageConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LambdaFunctionAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PhoneNumber) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Queue) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *QuickConnect) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RoutingProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SecurityProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *User) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserHierarchyStructure) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Vocabulary) Hub() {} diff --git a/apis/connect/v1beta1/zz_generated_terraformed.go b/apis/connect/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index feb989e291..0000000000 --- a/apis/connect/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1729 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this BotAssociation -func (mg *BotAssociation) GetTerraformResourceType() string { - return "aws_connect_bot_association" -} - -// GetConnectionDetailsMapping for this BotAssociation -func (tr *BotAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BotAssociation -func (tr *BotAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BotAssociation -func (tr *BotAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BotAssociation -func (tr *BotAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BotAssociation -func (tr *BotAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BotAssociation -func (tr *BotAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BotAssociation -func (tr *BotAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BotAssociation -func (tr *BotAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BotAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BotAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &BotAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BotAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ContactFlow -func (mg *ContactFlow) GetTerraformResourceType() string { - return "aws_connect_contact_flow" -} - -// GetConnectionDetailsMapping for this ContactFlow -func (tr *ContactFlow) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ContactFlow -func (tr *ContactFlow) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ContactFlow -func (tr *ContactFlow) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ContactFlow -func (tr *ContactFlow) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ContactFlow -func (tr *ContactFlow) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ContactFlow -func (tr *ContactFlow) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ContactFlow -func (tr *ContactFlow) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ContactFlow -func (tr *ContactFlow) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ContactFlow using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ContactFlow) LateInitialize(attrs []byte) (bool, error) { - params := &ContactFlowParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ContactFlow) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ContactFlowModule -func (mg *ContactFlowModule) GetTerraformResourceType() string { - return "aws_connect_contact_flow_module" -} - -// GetConnectionDetailsMapping for this ContactFlowModule -func (tr *ContactFlowModule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ContactFlowModule -func (tr *ContactFlowModule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ContactFlowModule -func (tr *ContactFlowModule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ContactFlowModule -func (tr *ContactFlowModule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ContactFlowModule -func (tr *ContactFlowModule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ContactFlowModule -func (tr *ContactFlowModule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ContactFlowModule -func (tr *ContactFlowModule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ContactFlowModule -func (tr *ContactFlowModule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ContactFlowModule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ContactFlowModule) LateInitialize(attrs []byte) (bool, error) { - params := &ContactFlowModuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ContactFlowModule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HoursOfOperation -func (mg *HoursOfOperation) GetTerraformResourceType() string { - return "aws_connect_hours_of_operation" -} - -// GetConnectionDetailsMapping for this HoursOfOperation -func (tr *HoursOfOperation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HoursOfOperation -func (tr *HoursOfOperation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HoursOfOperation -func (tr *HoursOfOperation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HoursOfOperation -func (tr *HoursOfOperation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HoursOfOperation -func (tr *HoursOfOperation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HoursOfOperation -func (tr *HoursOfOperation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HoursOfOperation -func (tr *HoursOfOperation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HoursOfOperation -func (tr *HoursOfOperation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HoursOfOperation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HoursOfOperation) LateInitialize(attrs []byte) (bool, error) { - params := &HoursOfOperationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HoursOfOperation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Instance -func (mg *Instance) GetTerraformResourceType() string { - return "aws_connect_instance" -} - -// GetConnectionDetailsMapping for this Instance -func (tr *Instance) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Instance -func (tr *Instance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Instance -func (tr *Instance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Instance -func (tr *Instance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Instance -func (tr *Instance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Instance -func (tr *Instance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Instance -func (tr *Instance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Instance -func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Instance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { - params := &InstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Instance) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InstanceStorageConfig -func (mg *InstanceStorageConfig) GetTerraformResourceType() string { - return "aws_connect_instance_storage_config" -} - -// GetConnectionDetailsMapping for this InstanceStorageConfig -func (tr *InstanceStorageConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InstanceStorageConfig -func (tr *InstanceStorageConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InstanceStorageConfig -func (tr *InstanceStorageConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InstanceStorageConfig -func (tr *InstanceStorageConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InstanceStorageConfig -func (tr *InstanceStorageConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InstanceStorageConfig -func (tr *InstanceStorageConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InstanceStorageConfig -func (tr *InstanceStorageConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InstanceStorageConfig -func (tr *InstanceStorageConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InstanceStorageConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InstanceStorageConfig) LateInitialize(attrs []byte) (bool, error) { - params := &InstanceStorageConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InstanceStorageConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LambdaFunctionAssociation -func (mg *LambdaFunctionAssociation) GetTerraformResourceType() string { - return "aws_connect_lambda_function_association" -} - -// GetConnectionDetailsMapping for this LambdaFunctionAssociation -func (tr *LambdaFunctionAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LambdaFunctionAssociation -func (tr *LambdaFunctionAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LambdaFunctionAssociation -func (tr *LambdaFunctionAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LambdaFunctionAssociation -func (tr *LambdaFunctionAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LambdaFunctionAssociation -func (tr *LambdaFunctionAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LambdaFunctionAssociation -func (tr *LambdaFunctionAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LambdaFunctionAssociation -func (tr *LambdaFunctionAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LambdaFunctionAssociation -func (tr *LambdaFunctionAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LambdaFunctionAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LambdaFunctionAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &LambdaFunctionAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LambdaFunctionAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PhoneNumber -func (mg *PhoneNumber) GetTerraformResourceType() string { - return "aws_connect_phone_number" -} - -// GetConnectionDetailsMapping for this PhoneNumber -func (tr *PhoneNumber) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PhoneNumber -func (tr *PhoneNumber) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PhoneNumber -func (tr *PhoneNumber) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PhoneNumber -func (tr *PhoneNumber) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PhoneNumber -func (tr *PhoneNumber) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PhoneNumber -func (tr *PhoneNumber) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PhoneNumber -func (tr *PhoneNumber) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PhoneNumber -func (tr *PhoneNumber) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PhoneNumber using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PhoneNumber) LateInitialize(attrs []byte) (bool, error) { - params := &PhoneNumberParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PhoneNumber) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Queue -func (mg *Queue) GetTerraformResourceType() string { - return "aws_connect_queue" -} - -// GetConnectionDetailsMapping for this Queue -func (tr *Queue) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Queue -func (tr *Queue) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Queue -func (tr *Queue) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Queue -func (tr *Queue) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Queue -func (tr *Queue) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Queue -func (tr *Queue) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Queue -func (tr *Queue) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Queue -func (tr *Queue) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Queue using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Queue) LateInitialize(attrs []byte) (bool, error) { - params := &QueueParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Queue) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this QuickConnect -func (mg *QuickConnect) GetTerraformResourceType() string { - return "aws_connect_quick_connect" -} - -// GetConnectionDetailsMapping for this QuickConnect -func (tr *QuickConnect) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this QuickConnect -func (tr *QuickConnect) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this QuickConnect -func (tr *QuickConnect) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this QuickConnect -func (tr *QuickConnect) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this QuickConnect -func (tr *QuickConnect) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this QuickConnect -func (tr *QuickConnect) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this QuickConnect -func (tr *QuickConnect) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this QuickConnect -func (tr *QuickConnect) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this QuickConnect using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *QuickConnect) LateInitialize(attrs []byte) (bool, error) { - params := &QuickConnectParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *QuickConnect) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RoutingProfile -func (mg *RoutingProfile) GetTerraformResourceType() string { - return "aws_connect_routing_profile" -} - -// GetConnectionDetailsMapping for this RoutingProfile -func (tr *RoutingProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RoutingProfile -func (tr *RoutingProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RoutingProfile -func (tr *RoutingProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RoutingProfile -func (tr *RoutingProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RoutingProfile -func (tr *RoutingProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RoutingProfile -func (tr *RoutingProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RoutingProfile -func (tr *RoutingProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RoutingProfile -func (tr *RoutingProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RoutingProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RoutingProfile) LateInitialize(attrs []byte) (bool, error) { - params := &RoutingProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RoutingProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SecurityProfile -func (mg *SecurityProfile) GetTerraformResourceType() string { - return "aws_connect_security_profile" -} - -// GetConnectionDetailsMapping for this SecurityProfile -func (tr *SecurityProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SecurityProfile -func (tr *SecurityProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SecurityProfile -func (tr *SecurityProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SecurityProfile -func (tr *SecurityProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SecurityProfile -func (tr *SecurityProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SecurityProfile -func (tr *SecurityProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SecurityProfile -func (tr *SecurityProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SecurityProfile -func (tr *SecurityProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SecurityProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SecurityProfile) LateInitialize(attrs []byte) (bool, error) { - params := &SecurityProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SecurityProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this User -func (mg *User) GetTerraformResourceType() string { - return "aws_connect_user" -} - -// GetConnectionDetailsMapping for this User -func (tr *User) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"password": "spec.forProvider.passwordSecretRef"} -} - -// GetObservation of this User -func (tr *User) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this User -func (tr *User) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this User -func (tr *User) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this User -func (tr *User) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this User -func (tr *User) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this User -func (tr *User) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this User -func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this User using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *User) LateInitialize(attrs []byte) (bool, error) { - params := &UserParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *User) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserHierarchyStructure -func (mg *UserHierarchyStructure) GetTerraformResourceType() string { - return "aws_connect_user_hierarchy_structure" -} - -// GetConnectionDetailsMapping for this UserHierarchyStructure -func (tr *UserHierarchyStructure) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserHierarchyStructure -func (tr *UserHierarchyStructure) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserHierarchyStructure -func (tr *UserHierarchyStructure) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserHierarchyStructure -func (tr *UserHierarchyStructure) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserHierarchyStructure -func (tr *UserHierarchyStructure) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserHierarchyStructure -func (tr *UserHierarchyStructure) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserHierarchyStructure -func (tr *UserHierarchyStructure) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserHierarchyStructure -func (tr *UserHierarchyStructure) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserHierarchyStructure using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserHierarchyStructure) LateInitialize(attrs []byte) (bool, error) { - params := &UserHierarchyStructureParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserHierarchyStructure) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Vocabulary -func (mg *Vocabulary) GetTerraformResourceType() string { - return "aws_connect_vocabulary" -} - -// GetConnectionDetailsMapping for this Vocabulary -func (tr *Vocabulary) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Vocabulary -func (tr *Vocabulary) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Vocabulary -func (tr *Vocabulary) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Vocabulary -func (tr *Vocabulary) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Vocabulary -func (tr *Vocabulary) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Vocabulary -func (tr *Vocabulary) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Vocabulary -func (tr *Vocabulary) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Vocabulary -func (tr *Vocabulary) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Vocabulary using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Vocabulary) LateInitialize(attrs []byte) (bool, error) { - params := &VocabularyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Vocabulary) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/connect/v1beta1/zz_hoursofoperation_terraformed.go b/apis/connect/v1beta1/zz_hoursofoperation_terraformed.go new file mode 100755 index 0000000000..bffcce363b --- /dev/null +++ b/apis/connect/v1beta1/zz_hoursofoperation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HoursOfOperation +func (mg *HoursOfOperation) GetTerraformResourceType() string { + return "aws_connect_hours_of_operation" +} + +// GetConnectionDetailsMapping for this HoursOfOperation +func (tr *HoursOfOperation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HoursOfOperation +func (tr *HoursOfOperation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HoursOfOperation +func (tr *HoursOfOperation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HoursOfOperation +func (tr *HoursOfOperation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HoursOfOperation +func (tr *HoursOfOperation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HoursOfOperation +func (tr *HoursOfOperation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HoursOfOperation +func (tr *HoursOfOperation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HoursOfOperation +func (tr *HoursOfOperation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HoursOfOperation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HoursOfOperation) LateInitialize(attrs []byte) (bool, error) { + params := &HoursOfOperationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HoursOfOperation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_hoursofoperation_types.go b/apis/connect/v1beta1/zz_hoursofoperation_types.go index 4ef0caec0d..5968a8880e 100755 --- a/apis/connect/v1beta1/zz_hoursofoperation_types.go +++ b/apis/connect/v1beta1/zz_hoursofoperation_types.go @@ -251,13 +251,14 @@ type HoursOfOperationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HoursOfOperation is the Schema for the HoursOfOperations API. Provides details about a specific Amazon Connect Hours of Operation. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HoursOfOperation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_instance_terraformed.go b/apis/connect/v1beta1/zz_instance_terraformed.go new file mode 100755 index 0000000000..8a3d6d6245 --- /dev/null +++ b/apis/connect/v1beta1/zz_instance_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Instance +func (mg *Instance) GetTerraformResourceType() string { + return "aws_connect_instance" +} + +// GetConnectionDetailsMapping for this Instance +func (tr *Instance) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Instance +func (tr *Instance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Instance +func (tr *Instance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Instance +func (tr *Instance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Instance +func (tr *Instance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Instance +func (tr *Instance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Instance +func (tr *Instance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Instance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { + params := &InstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Instance) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_instance_types.go b/apis/connect/v1beta1/zz_instance_types.go index 081d8dae6d..ee595c3d29 100755 --- a/apis/connect/v1beta1/zz_instance_types.go +++ b/apis/connect/v1beta1/zz_instance_types.go @@ -190,13 +190,14 @@ type InstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Instance is the Schema for the Instances API. Provides details about a specific Connect Instance. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Instance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_instancestorageconfig_terraformed.go b/apis/connect/v1beta1/zz_instancestorageconfig_terraformed.go new file mode 100755 index 0000000000..68b115ccfe --- /dev/null +++ b/apis/connect/v1beta1/zz_instancestorageconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InstanceStorageConfig +func (mg *InstanceStorageConfig) GetTerraformResourceType() string { + return "aws_connect_instance_storage_config" +} + +// GetConnectionDetailsMapping for this InstanceStorageConfig +func (tr *InstanceStorageConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InstanceStorageConfig +func (tr *InstanceStorageConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InstanceStorageConfig +func (tr *InstanceStorageConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InstanceStorageConfig +func (tr *InstanceStorageConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InstanceStorageConfig +func (tr *InstanceStorageConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InstanceStorageConfig +func (tr *InstanceStorageConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InstanceStorageConfig +func (tr *InstanceStorageConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InstanceStorageConfig +func (tr *InstanceStorageConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InstanceStorageConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InstanceStorageConfig) LateInitialize(attrs []byte) (bool, error) { + params := &InstanceStorageConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InstanceStorageConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_instancestorageconfig_types.go b/apis/connect/v1beta1/zz_instancestorageconfig_types.go index 26d4188013..350969d80d 100755 --- a/apis/connect/v1beta1/zz_instancestorageconfig_types.go +++ b/apis/connect/v1beta1/zz_instancestorageconfig_types.go @@ -444,13 +444,14 @@ type InstanceStorageConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InstanceStorageConfig is the Schema for the InstanceStorageConfigs API. Provides details about a specific Amazon Connect Instance Storage Config. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InstanceStorageConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_lambdafunctionassociation_terraformed.go b/apis/connect/v1beta1/zz_lambdafunctionassociation_terraformed.go new file mode 100755 index 0000000000..9cf7022b54 --- /dev/null +++ b/apis/connect/v1beta1/zz_lambdafunctionassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LambdaFunctionAssociation +func (mg *LambdaFunctionAssociation) GetTerraformResourceType() string { + return "aws_connect_lambda_function_association" +} + +// GetConnectionDetailsMapping for this LambdaFunctionAssociation +func (tr *LambdaFunctionAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LambdaFunctionAssociation +func (tr *LambdaFunctionAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LambdaFunctionAssociation +func (tr *LambdaFunctionAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LambdaFunctionAssociation +func (tr *LambdaFunctionAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LambdaFunctionAssociation +func (tr *LambdaFunctionAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LambdaFunctionAssociation +func (tr *LambdaFunctionAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LambdaFunctionAssociation +func (tr *LambdaFunctionAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LambdaFunctionAssociation +func (tr *LambdaFunctionAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LambdaFunctionAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LambdaFunctionAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &LambdaFunctionAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LambdaFunctionAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_lambdafunctionassociation_types.go b/apis/connect/v1beta1/zz_lambdafunctionassociation_types.go index e8c3af2962..c70f8b654e 100755 --- a/apis/connect/v1beta1/zz_lambdafunctionassociation_types.go +++ b/apis/connect/v1beta1/zz_lambdafunctionassociation_types.go @@ -92,13 +92,14 @@ type LambdaFunctionAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LambdaFunctionAssociation is the Schema for the LambdaFunctionAssociations API. Provides details about a specific Connect Lambda Function Association. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LambdaFunctionAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_phonenumber_terraformed.go b/apis/connect/v1beta1/zz_phonenumber_terraformed.go new file mode 100755 index 0000000000..517e24a2a6 --- /dev/null +++ b/apis/connect/v1beta1/zz_phonenumber_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PhoneNumber +func (mg *PhoneNumber) GetTerraformResourceType() string { + return "aws_connect_phone_number" +} + +// GetConnectionDetailsMapping for this PhoneNumber +func (tr *PhoneNumber) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PhoneNumber +func (tr *PhoneNumber) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PhoneNumber +func (tr *PhoneNumber) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PhoneNumber +func (tr *PhoneNumber) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PhoneNumber +func (tr *PhoneNumber) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PhoneNumber +func (tr *PhoneNumber) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PhoneNumber +func (tr *PhoneNumber) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PhoneNumber +func (tr *PhoneNumber) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PhoneNumber using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PhoneNumber) LateInitialize(attrs []byte) (bool, error) { + params := &PhoneNumberParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PhoneNumber) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_phonenumber_types.go b/apis/connect/v1beta1/zz_phonenumber_types.go index 2a1a3d563e..8f9ce3725b 100755 --- a/apis/connect/v1beta1/zz_phonenumber_types.go +++ b/apis/connect/v1beta1/zz_phonenumber_types.go @@ -169,13 +169,14 @@ type PhoneNumberStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PhoneNumber is the Schema for the PhoneNumbers API. Provides details about a specific Amazon Connect Phone Number. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PhoneNumber struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_queue_terraformed.go b/apis/connect/v1beta1/zz_queue_terraformed.go new file mode 100755 index 0000000000..08fb26c535 --- /dev/null +++ b/apis/connect/v1beta1/zz_queue_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Queue +func (mg *Queue) GetTerraformResourceType() string { + return "aws_connect_queue" +} + +// GetConnectionDetailsMapping for this Queue +func (tr *Queue) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Queue +func (tr *Queue) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Queue +func (tr *Queue) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Queue +func (tr *Queue) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Queue +func (tr *Queue) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Queue +func (tr *Queue) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Queue +func (tr *Queue) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Queue +func (tr *Queue) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Queue using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Queue) LateInitialize(attrs []byte) (bool, error) { + params := &QueueParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Queue) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_queue_types.go b/apis/connect/v1beta1/zz_queue_types.go index 17bdfc0904..86270981ff 100755 --- a/apis/connect/v1beta1/zz_queue_types.go +++ b/apis/connect/v1beta1/zz_queue_types.go @@ -246,13 +246,14 @@ type QueueStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Queue is the Schema for the Queues API. Provides details about a specific Amazon Connect Queue // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Queue struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_quickconnect_terraformed.go b/apis/connect/v1beta1/zz_quickconnect_terraformed.go new file mode 100755 index 0000000000..75d20e4150 --- /dev/null +++ b/apis/connect/v1beta1/zz_quickconnect_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this QuickConnect +func (mg *QuickConnect) GetTerraformResourceType() string { + return "aws_connect_quick_connect" +} + +// GetConnectionDetailsMapping for this QuickConnect +func (tr *QuickConnect) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this QuickConnect +func (tr *QuickConnect) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this QuickConnect +func (tr *QuickConnect) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this QuickConnect +func (tr *QuickConnect) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this QuickConnect +func (tr *QuickConnect) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this QuickConnect +func (tr *QuickConnect) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this QuickConnect +func (tr *QuickConnect) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this QuickConnect +func (tr *QuickConnect) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this QuickConnect using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *QuickConnect) LateInitialize(attrs []byte) (bool, error) { + params := &QuickConnectParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *QuickConnect) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_quickconnect_types.go b/apis/connect/v1beta1/zz_quickconnect_types.go index 52e3e5f994..ebbb3b81bf 100755 --- a/apis/connect/v1beta1/zz_quickconnect_types.go +++ b/apis/connect/v1beta1/zz_quickconnect_types.go @@ -267,13 +267,14 @@ type QuickConnectStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // QuickConnect is the Schema for the QuickConnects API. Provides details about a specific Amazon Quick Connect // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type QuickConnect struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_routingprofile_terraformed.go b/apis/connect/v1beta1/zz_routingprofile_terraformed.go new file mode 100755 index 0000000000..1f1c78ca78 --- /dev/null +++ b/apis/connect/v1beta1/zz_routingprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RoutingProfile +func (mg *RoutingProfile) GetTerraformResourceType() string { + return "aws_connect_routing_profile" +} + +// GetConnectionDetailsMapping for this RoutingProfile +func (tr *RoutingProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RoutingProfile +func (tr *RoutingProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RoutingProfile +func (tr *RoutingProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RoutingProfile +func (tr *RoutingProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RoutingProfile +func (tr *RoutingProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RoutingProfile +func (tr *RoutingProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RoutingProfile +func (tr *RoutingProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RoutingProfile +func (tr *RoutingProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RoutingProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RoutingProfile) LateInitialize(attrs []byte) (bool, error) { + params := &RoutingProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RoutingProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_routingprofile_types.go b/apis/connect/v1beta1/zz_routingprofile_types.go index 86698ff104..181660a18c 100755 --- a/apis/connect/v1beta1/zz_routingprofile_types.go +++ b/apis/connect/v1beta1/zz_routingprofile_types.go @@ -294,13 +294,14 @@ type RoutingProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RoutingProfile is the Schema for the RoutingProfiles API. Provides details about a specific Amazon Connect Routing Profile. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RoutingProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_securityprofile_terraformed.go b/apis/connect/v1beta1/zz_securityprofile_terraformed.go new file mode 100755 index 0000000000..203967fd12 --- /dev/null +++ b/apis/connect/v1beta1/zz_securityprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SecurityProfile +func (mg *SecurityProfile) GetTerraformResourceType() string { + return "aws_connect_security_profile" +} + +// GetConnectionDetailsMapping for this SecurityProfile +func (tr *SecurityProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SecurityProfile +func (tr *SecurityProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SecurityProfile +func (tr *SecurityProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SecurityProfile +func (tr *SecurityProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SecurityProfile +func (tr *SecurityProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SecurityProfile +func (tr *SecurityProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SecurityProfile +func (tr *SecurityProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SecurityProfile +func (tr *SecurityProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SecurityProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SecurityProfile) LateInitialize(attrs []byte) (bool, error) { + params := &SecurityProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SecurityProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_securityprofile_types.go b/apis/connect/v1beta1/zz_securityprofile_types.go index dd278479ca..c263d3fed4 100755 --- a/apis/connect/v1beta1/zz_securityprofile_types.go +++ b/apis/connect/v1beta1/zz_securityprofile_types.go @@ -147,13 +147,14 @@ type SecurityProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SecurityProfile is the Schema for the SecurityProfiles API. Provides details about a specific Amazon Connect Security Profile. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SecurityProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_user_terraformed.go b/apis/connect/v1beta1/zz_user_terraformed.go new file mode 100755 index 0000000000..bd4f5fa8fd --- /dev/null +++ b/apis/connect/v1beta1/zz_user_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this User +func (mg *User) GetTerraformResourceType() string { + return "aws_connect_user" +} + +// GetConnectionDetailsMapping for this User +func (tr *User) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"password": "spec.forProvider.passwordSecretRef"} +} + +// GetObservation of this User +func (tr *User) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this User +func (tr *User) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this User +func (tr *User) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this User +func (tr *User) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this User +func (tr *User) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this User +func (tr *User) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this User +func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this User using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *User) LateInitialize(attrs []byte) (bool, error) { + params := &UserParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *User) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_user_types.go b/apis/connect/v1beta1/zz_user_types.go index 25a5173ef3..22a4bf640d 100755 --- a/apis/connect/v1beta1/zz_user_types.go +++ b/apis/connect/v1beta1/zz_user_types.go @@ -297,13 +297,14 @@ type UserStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // User is the Schema for the Users API. Provides details about a specific Amazon Connect User // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type User struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_userhierarchystructure_terraformed.go b/apis/connect/v1beta1/zz_userhierarchystructure_terraformed.go new file mode 100755 index 0000000000..c728e8338d --- /dev/null +++ b/apis/connect/v1beta1/zz_userhierarchystructure_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserHierarchyStructure +func (mg *UserHierarchyStructure) GetTerraformResourceType() string { + return "aws_connect_user_hierarchy_structure" +} + +// GetConnectionDetailsMapping for this UserHierarchyStructure +func (tr *UserHierarchyStructure) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserHierarchyStructure +func (tr *UserHierarchyStructure) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserHierarchyStructure +func (tr *UserHierarchyStructure) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserHierarchyStructure +func (tr *UserHierarchyStructure) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserHierarchyStructure +func (tr *UserHierarchyStructure) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserHierarchyStructure +func (tr *UserHierarchyStructure) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserHierarchyStructure +func (tr *UserHierarchyStructure) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserHierarchyStructure +func (tr *UserHierarchyStructure) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserHierarchyStructure using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserHierarchyStructure) LateInitialize(attrs []byte) (bool, error) { + params := &UserHierarchyStructureParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserHierarchyStructure) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_userhierarchystructure_types.go b/apis/connect/v1beta1/zz_userhierarchystructure_types.go index 079ca79559..2e02352d86 100755 --- a/apis/connect/v1beta1/zz_userhierarchystructure_types.go +++ b/apis/connect/v1beta1/zz_userhierarchystructure_types.go @@ -282,13 +282,14 @@ type UserHierarchyStructureStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserHierarchyStructure is the Schema for the UserHierarchyStructures API. Provides details about a specific Amazon Connect User Hierarchy Structure // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserHierarchyStructure struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/connect/v1beta1/zz_vocabulary_terraformed.go b/apis/connect/v1beta1/zz_vocabulary_terraformed.go new file mode 100755 index 0000000000..3b50bf014b --- /dev/null +++ b/apis/connect/v1beta1/zz_vocabulary_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Vocabulary +func (mg *Vocabulary) GetTerraformResourceType() string { + return "aws_connect_vocabulary" +} + +// GetConnectionDetailsMapping for this Vocabulary +func (tr *Vocabulary) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Vocabulary +func (tr *Vocabulary) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Vocabulary +func (tr *Vocabulary) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Vocabulary +func (tr *Vocabulary) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Vocabulary +func (tr *Vocabulary) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Vocabulary +func (tr *Vocabulary) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Vocabulary +func (tr *Vocabulary) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Vocabulary +func (tr *Vocabulary) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Vocabulary using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Vocabulary) LateInitialize(attrs []byte) (bool, error) { + params := &VocabularyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Vocabulary) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/connect/v1beta1/zz_vocabulary_types.go b/apis/connect/v1beta1/zz_vocabulary_types.go index dfe60336a1..d6d8868b9d 100755 --- a/apis/connect/v1beta1/zz_vocabulary_types.go +++ b/apis/connect/v1beta1/zz_vocabulary_types.go @@ -151,13 +151,14 @@ type VocabularyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Vocabulary is the Schema for the Vocabularys API. Provides details about a specific Amazon Connect Vocabulary // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Vocabulary struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/cur/v1beta1/zz_generated.conversion_hubs.go b/apis/cur/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..12bee3edd8 --- /dev/null +++ b/apis/cur/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ReportDefinition) Hub() {} diff --git a/apis/cur/v1beta1/zz_generated_terraformed.go b/apis/cur/v1beta1/zz_reportdefinition_terraformed.go similarity index 100% rename from apis/cur/v1beta1/zz_generated_terraformed.go rename to apis/cur/v1beta1/zz_reportdefinition_terraformed.go diff --git a/apis/cur/v1beta1/zz_reportdefinition_types.go b/apis/cur/v1beta1/zz_reportdefinition_types.go index 9dd09f968d..86e5b1ed29 100755 --- a/apis/cur/v1beta1/zz_reportdefinition_types.go +++ b/apis/cur/v1beta1/zz_reportdefinition_types.go @@ -184,13 +184,14 @@ type ReportDefinitionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReportDefinition is the Schema for the ReportDefinitions API. Provides a Cost and Usage Report Definition. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReportDefinition struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dataexchange/v1beta1/zz_dataset_terraformed.go b/apis/dataexchange/v1beta1/zz_dataset_terraformed.go new file mode 100755 index 0000000000..47d30aa7af --- /dev/null +++ b/apis/dataexchange/v1beta1/zz_dataset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DataSet +func (mg *DataSet) GetTerraformResourceType() string { + return "aws_dataexchange_data_set" +} + +// GetConnectionDetailsMapping for this DataSet +func (tr *DataSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DataSet +func (tr *DataSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DataSet +func (tr *DataSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DataSet +func (tr *DataSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DataSet +func (tr *DataSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DataSet +func (tr *DataSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DataSet +func (tr *DataSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DataSet +func (tr *DataSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DataSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DataSet) LateInitialize(attrs []byte) (bool, error) { + params := &DataSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DataSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dataexchange/v1beta1/zz_dataset_types.go b/apis/dataexchange/v1beta1/zz_dataset_types.go index 6c3aa358e3..379fe59cfc 100755 --- a/apis/dataexchange/v1beta1/zz_dataset_types.go +++ b/apis/dataexchange/v1beta1/zz_dataset_types.go @@ -108,13 +108,14 @@ type DataSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DataSet is the Schema for the DataSets API. Provides a DataExchange DataSet // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DataSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dataexchange/v1beta1/zz_generated.conversion_hubs.go b/apis/dataexchange/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..88646269f5 --- /dev/null +++ b/apis/dataexchange/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *DataSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Revision) Hub() {} diff --git a/apis/dataexchange/v1beta1/zz_generated_terraformed.go b/apis/dataexchange/v1beta1/zz_revision_terraformed.go similarity index 52% rename from apis/dataexchange/v1beta1/zz_generated_terraformed.go rename to apis/dataexchange/v1beta1/zz_revision_terraformed.go index 5f9995094d..5c9613ea25 100755 --- a/apis/dataexchange/v1beta1/zz_generated_terraformed.go +++ b/apis/dataexchange/v1beta1/zz_revision_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this DataSet -func (mg *DataSet) GetTerraformResourceType() string { - return "aws_dataexchange_data_set" -} - -// GetConnectionDetailsMapping for this DataSet -func (tr *DataSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DataSet -func (tr *DataSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DataSet -func (tr *DataSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DataSet -func (tr *DataSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DataSet -func (tr *DataSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DataSet -func (tr *DataSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DataSet -func (tr *DataSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DataSet -func (tr *DataSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DataSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DataSet) LateInitialize(attrs []byte) (bool, error) { - params := &DataSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DataSet) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this Revision func (mg *Revision) GetTerraformResourceType() string { return "aws_dataexchange_revision" diff --git a/apis/dataexchange/v1beta1/zz_revision_types.go b/apis/dataexchange/v1beta1/zz_revision_types.go index c751b765e9..989baf8a41 100755 --- a/apis/dataexchange/v1beta1/zz_revision_types.go +++ b/apis/dataexchange/v1beta1/zz_revision_types.go @@ -121,13 +121,14 @@ type RevisionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Revision is the Schema for the Revisions API. Provides a DataExchange Revision // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Revision struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/datapipeline/v1beta1/zz_generated.conversion_hubs.go b/apis/datapipeline/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..23066f6a49 --- /dev/null +++ b/apis/datapipeline/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Pipeline) Hub() {} diff --git a/apis/datapipeline/v1beta1/zz_generated_terraformed.go b/apis/datapipeline/v1beta1/zz_pipeline_terraformed.go similarity index 100% rename from apis/datapipeline/v1beta1/zz_generated_terraformed.go rename to apis/datapipeline/v1beta1/zz_pipeline_terraformed.go diff --git a/apis/datapipeline/v1beta1/zz_pipeline_types.go b/apis/datapipeline/v1beta1/zz_pipeline_types.go index 3e3e5eadc8..a8987a4512 100755 --- a/apis/datapipeline/v1beta1/zz_pipeline_types.go +++ b/apis/datapipeline/v1beta1/zz_pipeline_types.go @@ -95,13 +95,14 @@ type PipelineStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Pipeline is the Schema for the Pipelines API. Provides a AWS DataPipeline Pipeline. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Pipeline struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/datasync/v1beta1/zz_generated.conversion_hubs.go b/apis/datasync/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..0be3b1fbaf --- /dev/null +++ b/apis/datasync/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *LocationS3) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Task) Hub() {} diff --git a/apis/datasync/v1beta1/zz_generated_terraformed.go b/apis/datasync/v1beta1/zz_locations3_terraformed.go similarity index 53% rename from apis/datasync/v1beta1/zz_generated_terraformed.go rename to apis/datasync/v1beta1/zz_locations3_terraformed.go index fc6cb690f1..fcb5bdd575 100755 --- a/apis/datasync/v1beta1/zz_generated_terraformed.go +++ b/apis/datasync/v1beta1/zz_locations3_terraformed.go @@ -131,117 +131,3 @@ func (tr *LocationS3) LateInitialize(attrs []byte) (bool, error) { func (tr *LocationS3) GetTerraformSchemaVersion() int { return 0 } - -// GetTerraformResourceType returns Terraform resource type for this Task -func (mg *Task) GetTerraformResourceType() string { - return "aws_datasync_task" -} - -// GetConnectionDetailsMapping for this Task -func (tr *Task) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Task -func (tr *Task) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Task -func (tr *Task) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Task -func (tr *Task) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Task -func (tr *Task) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Task -func (tr *Task) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Task -func (tr *Task) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Task -func (tr *Task) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Task using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Task) LateInitialize(attrs []byte) (bool, error) { - params := &TaskParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Task) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/datasync/v1beta1/zz_locations3_types.go b/apis/datasync/v1beta1/zz_locations3_types.go index 8451c5013b..6114001b62 100755 --- a/apis/datasync/v1beta1/zz_locations3_types.go +++ b/apis/datasync/v1beta1/zz_locations3_types.go @@ -192,13 +192,14 @@ type LocationS3Status struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LocationS3 is the Schema for the LocationS3s API. Manages an AWS DataSync S3 Location // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LocationS3 struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/datasync/v1beta1/zz_task_terraformed.go b/apis/datasync/v1beta1/zz_task_terraformed.go new file mode 100755 index 0000000000..766fb9d4a4 --- /dev/null +++ b/apis/datasync/v1beta1/zz_task_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Task +func (mg *Task) GetTerraformResourceType() string { + return "aws_datasync_task" +} + +// GetConnectionDetailsMapping for this Task +func (tr *Task) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Task +func (tr *Task) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Task +func (tr *Task) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Task +func (tr *Task) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Task +func (tr *Task) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Task +func (tr *Task) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Task +func (tr *Task) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Task +func (tr *Task) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Task using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Task) LateInitialize(attrs []byte) (bool, error) { + params := &TaskParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Task) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/datasync/v1beta1/zz_task_types.go b/apis/datasync/v1beta1/zz_task_types.go index aa9795ffb6..0a2a6a0536 100755 --- a/apis/datasync/v1beta1/zz_task_types.go +++ b/apis/datasync/v1beta1/zz_task_types.go @@ -440,13 +440,14 @@ type TaskStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Task is the Schema for the Tasks API. Manages an AWS DataSync Task // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Task struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dax/v1beta1/zz_cluster_terraformed.go b/apis/dax/v1beta1/zz_cluster_terraformed.go new file mode 100755 index 0000000000..9d135184fa --- /dev/null +++ b/apis/dax/v1beta1/zz_cluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cluster +func (mg *Cluster) GetTerraformResourceType() string { + return "aws_dax_cluster" +} + +// GetConnectionDetailsMapping for this Cluster +func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Cluster +func (tr *Cluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cluster +func (tr *Cluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cluster +func (tr *Cluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cluster +func (tr *Cluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cluster +func (tr *Cluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dax/v1beta1/zz_cluster_types.go b/apis/dax/v1beta1/zz_cluster_types.go index 783fc31621..0ae479392f 100755 --- a/apis/dax/v1beta1/zz_cluster_types.go +++ b/apis/dax/v1beta1/zz_cluster_types.go @@ -332,13 +332,14 @@ type ClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cluster is the Schema for the Clusters API. Provides an DAX Cluster resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dax/v1beta1/zz_generated.conversion_hubs.go b/apis/dax/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..6218ba6abd --- /dev/null +++ b/apis/dax/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Cluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ParameterGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SubnetGroup) Hub() {} diff --git a/apis/dax/v1beta1/zz_generated_terraformed.go b/apis/dax/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index f936adf796..0000000000 --- a/apis/dax/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Cluster -func (mg *Cluster) GetTerraformResourceType() string { - return "aws_dax_cluster" -} - -// GetConnectionDetailsMapping for this Cluster -func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Cluster -func (tr *Cluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cluster -func (tr *Cluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cluster -func (tr *Cluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cluster -func (tr *Cluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cluster -func (tr *Cluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ParameterGroup -func (mg *ParameterGroup) GetTerraformResourceType() string { - return "aws_dax_parameter_group" -} - -// GetConnectionDetailsMapping for this ParameterGroup -func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ParameterGroup -func (tr *ParameterGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ParameterGroup -func (tr *ParameterGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ParameterGroup -func (tr *ParameterGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ParameterGroup -func (tr *ParameterGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ParameterGroup -func (tr *ParameterGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ParameterGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ParameterGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ParameterGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SubnetGroup -func (mg *SubnetGroup) GetTerraformResourceType() string { - return "aws_dax_subnet_group" -} - -// GetConnectionDetailsMapping for this SubnetGroup -func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SubnetGroup -func (tr *SubnetGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SubnetGroup -func (tr *SubnetGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SubnetGroup -func (tr *SubnetGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SubnetGroup -func (tr *SubnetGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SubnetGroup -func (tr *SubnetGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SubnetGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { - params := &SubnetGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SubnetGroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/dax/v1beta1/zz_parametergroup_terraformed.go b/apis/dax/v1beta1/zz_parametergroup_terraformed.go new file mode 100755 index 0000000000..28a0a33fb7 --- /dev/null +++ b/apis/dax/v1beta1/zz_parametergroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ParameterGroup +func (mg *ParameterGroup) GetTerraformResourceType() string { + return "aws_dax_parameter_group" +} + +// GetConnectionDetailsMapping for this ParameterGroup +func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ParameterGroup +func (tr *ParameterGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ParameterGroup +func (tr *ParameterGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ParameterGroup +func (tr *ParameterGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ParameterGroup +func (tr *ParameterGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ParameterGroup +func (tr *ParameterGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ParameterGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ParameterGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ParameterGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dax/v1beta1/zz_parametergroup_types.go b/apis/dax/v1beta1/zz_parametergroup_types.go index 9f40bbc012..932c3d64ae 100755 --- a/apis/dax/v1beta1/zz_parametergroup_types.go +++ b/apis/dax/v1beta1/zz_parametergroup_types.go @@ -107,13 +107,14 @@ type ParameterGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ParameterGroup is the Schema for the ParameterGroups API. Provides an DAX Parameter Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ParameterGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dax/v1beta1/zz_subnetgroup_terraformed.go b/apis/dax/v1beta1/zz_subnetgroup_terraformed.go new file mode 100755 index 0000000000..27c79054e3 --- /dev/null +++ b/apis/dax/v1beta1/zz_subnetgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SubnetGroup +func (mg *SubnetGroup) GetTerraformResourceType() string { + return "aws_dax_subnet_group" +} + +// GetConnectionDetailsMapping for this SubnetGroup +func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SubnetGroup +func (tr *SubnetGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SubnetGroup +func (tr *SubnetGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SubnetGroup +func (tr *SubnetGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SubnetGroup +func (tr *SubnetGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SubnetGroup +func (tr *SubnetGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SubnetGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { + params := &SubnetGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SubnetGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dax/v1beta1/zz_subnetgroup_types.go b/apis/dax/v1beta1/zz_subnetgroup_types.go index d78dfabc07..e468b90683 100755 --- a/apis/dax/v1beta1/zz_subnetgroup_types.go +++ b/apis/dax/v1beta1/zz_subnetgroup_types.go @@ -106,13 +106,14 @@ type SubnetGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SubnetGroup is the Schema for the SubnetGroups API. Provides an DAX Subnet Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SubnetGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/deploy/v1beta1/zz_app_terraformed.go b/apis/deploy/v1beta1/zz_app_terraformed.go new file mode 100755 index 0000000000..4e496816c6 --- /dev/null +++ b/apis/deploy/v1beta1/zz_app_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this App +func (mg *App) GetTerraformResourceType() string { + return "aws_codedeploy_app" +} + +// GetConnectionDetailsMapping for this App +func (tr *App) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this App +func (tr *App) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this App +func (tr *App) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this App +func (tr *App) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this App +func (tr *App) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this App +func (tr *App) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this App +func (tr *App) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this App +func (tr *App) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this App using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *App) LateInitialize(attrs []byte) (bool, error) { + params := &AppParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *App) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/deploy/v1beta1/zz_app_types.go b/apis/deploy/v1beta1/zz_app_types.go index dedb0598c5..46cbea8ab4 100755 --- a/apis/deploy/v1beta1/zz_app_types.go +++ b/apis/deploy/v1beta1/zz_app_types.go @@ -97,13 +97,14 @@ type AppStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // App is the Schema for the Apps API. Provides a CodeDeploy application. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type App struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/deploy/v1beta1/zz_deploymentconfig_terraformed.go b/apis/deploy/v1beta1/zz_deploymentconfig_terraformed.go new file mode 100755 index 0000000000..cc2dcbc58f --- /dev/null +++ b/apis/deploy/v1beta1/zz_deploymentconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DeploymentConfig +func (mg *DeploymentConfig) GetTerraformResourceType() string { + return "aws_codedeploy_deployment_config" +} + +// GetConnectionDetailsMapping for this DeploymentConfig +func (tr *DeploymentConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DeploymentConfig +func (tr *DeploymentConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DeploymentConfig +func (tr *DeploymentConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DeploymentConfig +func (tr *DeploymentConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DeploymentConfig +func (tr *DeploymentConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DeploymentConfig +func (tr *DeploymentConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DeploymentConfig +func (tr *DeploymentConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DeploymentConfig +func (tr *DeploymentConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DeploymentConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DeploymentConfig) LateInitialize(attrs []byte) (bool, error) { + params := &DeploymentConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DeploymentConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/deploy/v1beta1/zz_deploymentconfig_types.go b/apis/deploy/v1beta1/zz_deploymentconfig_types.go index e228d98358..908b9a4e3a 100755 --- a/apis/deploy/v1beta1/zz_deploymentconfig_types.go +++ b/apis/deploy/v1beta1/zz_deploymentconfig_types.go @@ -226,13 +226,14 @@ type DeploymentConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DeploymentConfig is the Schema for the DeploymentConfigs API. Provides a CodeDeploy deployment config. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DeploymentConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/deploy/v1beta1/zz_deploymentgroup_terraformed.go b/apis/deploy/v1beta1/zz_deploymentgroup_terraformed.go new file mode 100755 index 0000000000..3bff543a3d --- /dev/null +++ b/apis/deploy/v1beta1/zz_deploymentgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DeploymentGroup +func (mg *DeploymentGroup) GetTerraformResourceType() string { + return "aws_codedeploy_deployment_group" +} + +// GetConnectionDetailsMapping for this DeploymentGroup +func (tr *DeploymentGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DeploymentGroup +func (tr *DeploymentGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DeploymentGroup +func (tr *DeploymentGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DeploymentGroup +func (tr *DeploymentGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DeploymentGroup +func (tr *DeploymentGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DeploymentGroup +func (tr *DeploymentGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DeploymentGroup +func (tr *DeploymentGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DeploymentGroup +func (tr *DeploymentGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DeploymentGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DeploymentGroup) LateInitialize(attrs []byte) (bool, error) { + params := &DeploymentGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DeploymentGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/deploy/v1beta1/zz_deploymentgroup_types.go b/apis/deploy/v1beta1/zz_deploymentgroup_types.go index c7a3f8f1d1..3c44ff1b6e 100755 --- a/apis/deploy/v1beta1/zz_deploymentgroup_types.go +++ b/apis/deploy/v1beta1/zz_deploymentgroup_types.go @@ -952,13 +952,14 @@ type DeploymentGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DeploymentGroup is the Schema for the DeploymentGroups API. Provides a CodeDeploy deployment group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DeploymentGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/deploy/v1beta1/zz_generated.conversion_hubs.go b/apis/deploy/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..d669d1ed58 --- /dev/null +++ b/apis/deploy/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *App) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DeploymentConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DeploymentGroup) Hub() {} diff --git a/apis/deploy/v1beta1/zz_generated_terraformed.go b/apis/deploy/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index c766a5f921..0000000000 --- a/apis/deploy/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this App -func (mg *App) GetTerraformResourceType() string { - return "aws_codedeploy_app" -} - -// GetConnectionDetailsMapping for this App -func (tr *App) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this App -func (tr *App) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this App -func (tr *App) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this App -func (tr *App) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this App -func (tr *App) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this App -func (tr *App) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this App -func (tr *App) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this App -func (tr *App) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this App using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *App) LateInitialize(attrs []byte) (bool, error) { - params := &AppParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *App) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DeploymentConfig -func (mg *DeploymentConfig) GetTerraformResourceType() string { - return "aws_codedeploy_deployment_config" -} - -// GetConnectionDetailsMapping for this DeploymentConfig -func (tr *DeploymentConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DeploymentConfig -func (tr *DeploymentConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DeploymentConfig -func (tr *DeploymentConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DeploymentConfig -func (tr *DeploymentConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DeploymentConfig -func (tr *DeploymentConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DeploymentConfig -func (tr *DeploymentConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DeploymentConfig -func (tr *DeploymentConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DeploymentConfig -func (tr *DeploymentConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DeploymentConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DeploymentConfig) LateInitialize(attrs []byte) (bool, error) { - params := &DeploymentConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DeploymentConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DeploymentGroup -func (mg *DeploymentGroup) GetTerraformResourceType() string { - return "aws_codedeploy_deployment_group" -} - -// GetConnectionDetailsMapping for this DeploymentGroup -func (tr *DeploymentGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DeploymentGroup -func (tr *DeploymentGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DeploymentGroup -func (tr *DeploymentGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DeploymentGroup -func (tr *DeploymentGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DeploymentGroup -func (tr *DeploymentGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DeploymentGroup -func (tr *DeploymentGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DeploymentGroup -func (tr *DeploymentGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DeploymentGroup -func (tr *DeploymentGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DeploymentGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DeploymentGroup) LateInitialize(attrs []byte) (bool, error) { - params := &DeploymentGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DeploymentGroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/detective/v1beta1/zz_generated.conversion_hubs.go b/apis/detective/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..844d3f352a --- /dev/null +++ b/apis/detective/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Graph) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InvitationAccepter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Member) Hub() {} diff --git a/apis/detective/v1beta1/zz_generated_terraformed.go b/apis/detective/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index e7a1259bd4..0000000000 --- a/apis/detective/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Graph -func (mg *Graph) GetTerraformResourceType() string { - return "aws_detective_graph" -} - -// GetConnectionDetailsMapping for this Graph -func (tr *Graph) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Graph -func (tr *Graph) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Graph -func (tr *Graph) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Graph -func (tr *Graph) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Graph -func (tr *Graph) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Graph -func (tr *Graph) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Graph -func (tr *Graph) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Graph -func (tr *Graph) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Graph using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Graph) LateInitialize(attrs []byte) (bool, error) { - params := &GraphParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Graph) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InvitationAccepter -func (mg *InvitationAccepter) GetTerraformResourceType() string { - return "aws_detective_invitation_accepter" -} - -// GetConnectionDetailsMapping for this InvitationAccepter -func (tr *InvitationAccepter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InvitationAccepter -func (tr *InvitationAccepter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InvitationAccepter -func (tr *InvitationAccepter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InvitationAccepter -func (tr *InvitationAccepter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InvitationAccepter -func (tr *InvitationAccepter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InvitationAccepter -func (tr *InvitationAccepter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InvitationAccepter -func (tr *InvitationAccepter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InvitationAccepter -func (tr *InvitationAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InvitationAccepter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InvitationAccepter) LateInitialize(attrs []byte) (bool, error) { - params := &InvitationAccepterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InvitationAccepter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Member -func (mg *Member) GetTerraformResourceType() string { - return "aws_detective_member" -} - -// GetConnectionDetailsMapping for this Member -func (tr *Member) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Member -func (tr *Member) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Member -func (tr *Member) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Member -func (tr *Member) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Member -func (tr *Member) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Member -func (tr *Member) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Member -func (tr *Member) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Member -func (tr *Member) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Member using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Member) LateInitialize(attrs []byte) (bool, error) { - params := &MemberParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Member) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/detective/v1beta1/zz_graph_terraformed.go b/apis/detective/v1beta1/zz_graph_terraformed.go new file mode 100755 index 0000000000..370d1c4791 --- /dev/null +++ b/apis/detective/v1beta1/zz_graph_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Graph +func (mg *Graph) GetTerraformResourceType() string { + return "aws_detective_graph" +} + +// GetConnectionDetailsMapping for this Graph +func (tr *Graph) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Graph +func (tr *Graph) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Graph +func (tr *Graph) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Graph +func (tr *Graph) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Graph +func (tr *Graph) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Graph +func (tr *Graph) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Graph +func (tr *Graph) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Graph +func (tr *Graph) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Graph using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Graph) LateInitialize(attrs []byte) (bool, error) { + params := &GraphParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Graph) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/detective/v1beta1/zz_graph_types.go b/apis/detective/v1beta1/zz_graph_types.go index 0c6b473f35..8b3771f4e6 100755 --- a/apis/detective/v1beta1/zz_graph_types.go +++ b/apis/detective/v1beta1/zz_graph_types.go @@ -80,13 +80,14 @@ type GraphStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Graph is the Schema for the Graphs API. Provides a resource to manage an Amazon Detective graph. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Graph struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/detective/v1beta1/zz_invitationaccepter_terraformed.go b/apis/detective/v1beta1/zz_invitationaccepter_terraformed.go new file mode 100755 index 0000000000..be3d0102b5 --- /dev/null +++ b/apis/detective/v1beta1/zz_invitationaccepter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InvitationAccepter +func (mg *InvitationAccepter) GetTerraformResourceType() string { + return "aws_detective_invitation_accepter" +} + +// GetConnectionDetailsMapping for this InvitationAccepter +func (tr *InvitationAccepter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InvitationAccepter +func (tr *InvitationAccepter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InvitationAccepter +func (tr *InvitationAccepter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InvitationAccepter +func (tr *InvitationAccepter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InvitationAccepter +func (tr *InvitationAccepter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InvitationAccepter +func (tr *InvitationAccepter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InvitationAccepter +func (tr *InvitationAccepter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InvitationAccepter +func (tr *InvitationAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InvitationAccepter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InvitationAccepter) LateInitialize(attrs []byte) (bool, error) { + params := &InvitationAccepterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InvitationAccepter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/detective/v1beta1/zz_invitationaccepter_types.go b/apis/detective/v1beta1/zz_invitationaccepter_types.go index 80ff7db552..eb0cd70ca8 100755 --- a/apis/detective/v1beta1/zz_invitationaccepter_types.go +++ b/apis/detective/v1beta1/zz_invitationaccepter_types.go @@ -88,13 +88,14 @@ type InvitationAccepterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InvitationAccepter is the Schema for the InvitationAccepters API. Provides a resource to manage an Amazon Detective member invitation accepter. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InvitationAccepter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/detective/v1beta1/zz_member_terraformed.go b/apis/detective/v1beta1/zz_member_terraformed.go new file mode 100755 index 0000000000..8ccef55a09 --- /dev/null +++ b/apis/detective/v1beta1/zz_member_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Member +func (mg *Member) GetTerraformResourceType() string { + return "aws_detective_member" +} + +// GetConnectionDetailsMapping for this Member +func (tr *Member) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Member +func (tr *Member) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Member +func (tr *Member) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Member +func (tr *Member) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Member +func (tr *Member) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Member +func (tr *Member) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Member +func (tr *Member) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Member +func (tr *Member) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Member using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Member) LateInitialize(attrs []byte) (bool, error) { + params := &MemberParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Member) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/detective/v1beta1/zz_member_types.go b/apis/detective/v1beta1/zz_member_types.go index d278179fc1..881fb9fe60 100755 --- a/apis/detective/v1beta1/zz_member_types.go +++ b/apis/detective/v1beta1/zz_member_types.go @@ -145,13 +145,14 @@ type MemberStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Member is the Schema for the Members API. Provides a resource to manage an Amazon Detective member. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Member struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/devicefarm/v1beta1/zz_devicepool_terraformed.go b/apis/devicefarm/v1beta1/zz_devicepool_terraformed.go new file mode 100755 index 0000000000..0a2e67985f --- /dev/null +++ b/apis/devicefarm/v1beta1/zz_devicepool_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DevicePool +func (mg *DevicePool) GetTerraformResourceType() string { + return "aws_devicefarm_device_pool" +} + +// GetConnectionDetailsMapping for this DevicePool +func (tr *DevicePool) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DevicePool +func (tr *DevicePool) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DevicePool +func (tr *DevicePool) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DevicePool +func (tr *DevicePool) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DevicePool +func (tr *DevicePool) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DevicePool +func (tr *DevicePool) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DevicePool +func (tr *DevicePool) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DevicePool +func (tr *DevicePool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DevicePool using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DevicePool) LateInitialize(attrs []byte) (bool, error) { + params := &DevicePoolParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DevicePool) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/devicefarm/v1beta1/zz_devicepool_types.go b/apis/devicefarm/v1beta1/zz_devicepool_types.go index 9287695b0b..8fd33b7e60 100755 --- a/apis/devicefarm/v1beta1/zz_devicepool_types.go +++ b/apis/devicefarm/v1beta1/zz_devicepool_types.go @@ -188,13 +188,14 @@ type DevicePoolStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DevicePool is the Schema for the DevicePools API. Provides a Devicefarm device_pool // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DevicePool struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/devicefarm/v1beta1/zz_generated.conversion_hubs.go b/apis/devicefarm/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b3f192cac0 --- /dev/null +++ b/apis/devicefarm/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *DevicePool) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InstanceProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NetworkProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Project) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TestGridProject) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Upload) Hub() {} diff --git a/apis/devicefarm/v1beta1/zz_generated_terraformed.go b/apis/devicefarm/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 5bf49a989d..0000000000 --- a/apis/devicefarm/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,703 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this DevicePool -func (mg *DevicePool) GetTerraformResourceType() string { - return "aws_devicefarm_device_pool" -} - -// GetConnectionDetailsMapping for this DevicePool -func (tr *DevicePool) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DevicePool -func (tr *DevicePool) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DevicePool -func (tr *DevicePool) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DevicePool -func (tr *DevicePool) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DevicePool -func (tr *DevicePool) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DevicePool -func (tr *DevicePool) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DevicePool -func (tr *DevicePool) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DevicePool -func (tr *DevicePool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DevicePool using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DevicePool) LateInitialize(attrs []byte) (bool, error) { - params := &DevicePoolParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DevicePool) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InstanceProfile -func (mg *InstanceProfile) GetTerraformResourceType() string { - return "aws_devicefarm_instance_profile" -} - -// GetConnectionDetailsMapping for this InstanceProfile -func (tr *InstanceProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InstanceProfile -func (tr *InstanceProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InstanceProfile -func (tr *InstanceProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InstanceProfile -func (tr *InstanceProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InstanceProfile -func (tr *InstanceProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InstanceProfile -func (tr *InstanceProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InstanceProfile -func (tr *InstanceProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InstanceProfile -func (tr *InstanceProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InstanceProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InstanceProfile) LateInitialize(attrs []byte) (bool, error) { - params := &InstanceProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InstanceProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NetworkProfile -func (mg *NetworkProfile) GetTerraformResourceType() string { - return "aws_devicefarm_network_profile" -} - -// GetConnectionDetailsMapping for this NetworkProfile -func (tr *NetworkProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NetworkProfile -func (tr *NetworkProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NetworkProfile -func (tr *NetworkProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NetworkProfile -func (tr *NetworkProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NetworkProfile -func (tr *NetworkProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NetworkProfile -func (tr *NetworkProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NetworkProfile -func (tr *NetworkProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NetworkProfile -func (tr *NetworkProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NetworkProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NetworkProfile) LateInitialize(attrs []byte) (bool, error) { - params := &NetworkProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NetworkProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Project -func (mg *Project) GetTerraformResourceType() string { - return "aws_devicefarm_project" -} - -// GetConnectionDetailsMapping for this Project -func (tr *Project) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Project -func (tr *Project) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Project -func (tr *Project) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Project -func (tr *Project) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Project -func (tr *Project) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Project -func (tr *Project) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Project -func (tr *Project) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Project -func (tr *Project) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Project using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Project) LateInitialize(attrs []byte) (bool, error) { - params := &ProjectParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Project) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TestGridProject -func (mg *TestGridProject) GetTerraformResourceType() string { - return "aws_devicefarm_test_grid_project" -} - -// GetConnectionDetailsMapping for this TestGridProject -func (tr *TestGridProject) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TestGridProject -func (tr *TestGridProject) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TestGridProject -func (tr *TestGridProject) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TestGridProject -func (tr *TestGridProject) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TestGridProject -func (tr *TestGridProject) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TestGridProject -func (tr *TestGridProject) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TestGridProject -func (tr *TestGridProject) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TestGridProject -func (tr *TestGridProject) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TestGridProject using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TestGridProject) LateInitialize(attrs []byte) (bool, error) { - params := &TestGridProjectParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TestGridProject) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Upload -func (mg *Upload) GetTerraformResourceType() string { - return "aws_devicefarm_upload" -} - -// GetConnectionDetailsMapping for this Upload -func (tr *Upload) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Upload -func (tr *Upload) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Upload -func (tr *Upload) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Upload -func (tr *Upload) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Upload -func (tr *Upload) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Upload -func (tr *Upload) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Upload -func (tr *Upload) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Upload -func (tr *Upload) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Upload using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Upload) LateInitialize(attrs []byte) (bool, error) { - params := &UploadParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Upload) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/devicefarm/v1beta1/zz_instanceprofile_terraformed.go b/apis/devicefarm/v1beta1/zz_instanceprofile_terraformed.go new file mode 100755 index 0000000000..6050415285 --- /dev/null +++ b/apis/devicefarm/v1beta1/zz_instanceprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InstanceProfile +func (mg *InstanceProfile) GetTerraformResourceType() string { + return "aws_devicefarm_instance_profile" +} + +// GetConnectionDetailsMapping for this InstanceProfile +func (tr *InstanceProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InstanceProfile +func (tr *InstanceProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InstanceProfile +func (tr *InstanceProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InstanceProfile +func (tr *InstanceProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InstanceProfile +func (tr *InstanceProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InstanceProfile +func (tr *InstanceProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InstanceProfile +func (tr *InstanceProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InstanceProfile +func (tr *InstanceProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InstanceProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InstanceProfile) LateInitialize(attrs []byte) (bool, error) { + params := &InstanceProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InstanceProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/devicefarm/v1beta1/zz_instanceprofile_types.go b/apis/devicefarm/v1beta1/zz_instanceprofile_types.go index 1e08d0c804..3ec3cc4463 100755 --- a/apis/devicefarm/v1beta1/zz_instanceprofile_types.go +++ b/apis/devicefarm/v1beta1/zz_instanceprofile_types.go @@ -130,13 +130,14 @@ type InstanceProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InstanceProfile is the Schema for the InstanceProfiles API. Provides a Devicefarm instance profile // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InstanceProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/devicefarm/v1beta1/zz_networkprofile_terraformed.go b/apis/devicefarm/v1beta1/zz_networkprofile_terraformed.go new file mode 100755 index 0000000000..136f28e662 --- /dev/null +++ b/apis/devicefarm/v1beta1/zz_networkprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NetworkProfile +func (mg *NetworkProfile) GetTerraformResourceType() string { + return "aws_devicefarm_network_profile" +} + +// GetConnectionDetailsMapping for this NetworkProfile +func (tr *NetworkProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NetworkProfile +func (tr *NetworkProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NetworkProfile +func (tr *NetworkProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NetworkProfile +func (tr *NetworkProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NetworkProfile +func (tr *NetworkProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NetworkProfile +func (tr *NetworkProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NetworkProfile +func (tr *NetworkProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NetworkProfile +func (tr *NetworkProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NetworkProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NetworkProfile) LateInitialize(attrs []byte) (bool, error) { + params := &NetworkProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NetworkProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/devicefarm/v1beta1/zz_networkprofile_types.go b/apis/devicefarm/v1beta1/zz_networkprofile_types.go index 74e14740be..49528aa896 100755 --- a/apis/devicefarm/v1beta1/zz_networkprofile_types.go +++ b/apis/devicefarm/v1beta1/zz_networkprofile_types.go @@ -217,13 +217,14 @@ type NetworkProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NetworkProfile is the Schema for the NetworkProfiles API. Provides a Devicefarm network profile // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NetworkProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/devicefarm/v1beta1/zz_project_terraformed.go b/apis/devicefarm/v1beta1/zz_project_terraformed.go new file mode 100755 index 0000000000..a3322e2adb --- /dev/null +++ b/apis/devicefarm/v1beta1/zz_project_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Project +func (mg *Project) GetTerraformResourceType() string { + return "aws_devicefarm_project" +} + +// GetConnectionDetailsMapping for this Project +func (tr *Project) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Project +func (tr *Project) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Project +func (tr *Project) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Project +func (tr *Project) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Project +func (tr *Project) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Project +func (tr *Project) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Project +func (tr *Project) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Project +func (tr *Project) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Project using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Project) LateInitialize(attrs []byte) (bool, error) { + params := &ProjectParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Project) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/devicefarm/v1beta1/zz_project_types.go b/apis/devicefarm/v1beta1/zz_project_types.go index 880c73c86f..41ac48ab71 100755 --- a/apis/devicefarm/v1beta1/zz_project_types.go +++ b/apis/devicefarm/v1beta1/zz_project_types.go @@ -97,13 +97,14 @@ type ProjectStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Project is the Schema for the Projects API. Provides a Devicefarm project // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Project struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/devicefarm/v1beta1/zz_testgridproject_terraformed.go b/apis/devicefarm/v1beta1/zz_testgridproject_terraformed.go new file mode 100755 index 0000000000..4ffc0b8b46 --- /dev/null +++ b/apis/devicefarm/v1beta1/zz_testgridproject_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TestGridProject +func (mg *TestGridProject) GetTerraformResourceType() string { + return "aws_devicefarm_test_grid_project" +} + +// GetConnectionDetailsMapping for this TestGridProject +func (tr *TestGridProject) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TestGridProject +func (tr *TestGridProject) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TestGridProject +func (tr *TestGridProject) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TestGridProject +func (tr *TestGridProject) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TestGridProject +func (tr *TestGridProject) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TestGridProject +func (tr *TestGridProject) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TestGridProject +func (tr *TestGridProject) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TestGridProject +func (tr *TestGridProject) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TestGridProject using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TestGridProject) LateInitialize(attrs []byte) (bool, error) { + params := &TestGridProjectParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TestGridProject) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/devicefarm/v1beta1/zz_testgridproject_types.go b/apis/devicefarm/v1beta1/zz_testgridproject_types.go index bc25b295c2..89ef758cc5 100755 --- a/apis/devicefarm/v1beta1/zz_testgridproject_types.go +++ b/apis/devicefarm/v1beta1/zz_testgridproject_types.go @@ -216,13 +216,14 @@ type TestGridProjectStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TestGridProject is the Schema for the TestGridProjects API. Provides a Devicefarm test_grid_project // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TestGridProject struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/devicefarm/v1beta1/zz_upload_terraformed.go b/apis/devicefarm/v1beta1/zz_upload_terraformed.go new file mode 100755 index 0000000000..b13f551772 --- /dev/null +++ b/apis/devicefarm/v1beta1/zz_upload_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Upload +func (mg *Upload) GetTerraformResourceType() string { + return "aws_devicefarm_upload" +} + +// GetConnectionDetailsMapping for this Upload +func (tr *Upload) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Upload +func (tr *Upload) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Upload +func (tr *Upload) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Upload +func (tr *Upload) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Upload +func (tr *Upload) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Upload +func (tr *Upload) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Upload +func (tr *Upload) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Upload +func (tr *Upload) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Upload using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Upload) LateInitialize(attrs []byte) (bool, error) { + params := &UploadParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Upload) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/devicefarm/v1beta1/zz_upload_types.go b/apis/devicefarm/v1beta1/zz_upload_types.go index 85c3f88b6c..d9002bdd99 100755 --- a/apis/devicefarm/v1beta1/zz_upload_types.go +++ b/apis/devicefarm/v1beta1/zz_upload_types.go @@ -129,13 +129,14 @@ type UploadStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Upload is the Schema for the Uploads API. Provides a Devicefarm upload // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Upload struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_bgppeer_terraformed.go b/apis/directconnect/v1beta1/zz_bgppeer_terraformed.go new file mode 100755 index 0000000000..e2d6935d5b --- /dev/null +++ b/apis/directconnect/v1beta1/zz_bgppeer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BGPPeer +func (mg *BGPPeer) GetTerraformResourceType() string { + return "aws_dx_bgp_peer" +} + +// GetConnectionDetailsMapping for this BGPPeer +func (tr *BGPPeer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BGPPeer +func (tr *BGPPeer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BGPPeer +func (tr *BGPPeer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BGPPeer +func (tr *BGPPeer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BGPPeer +func (tr *BGPPeer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BGPPeer +func (tr *BGPPeer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BGPPeer +func (tr *BGPPeer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BGPPeer +func (tr *BGPPeer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BGPPeer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BGPPeer) LateInitialize(attrs []byte) (bool, error) { + params := &BGPPeerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BGPPeer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_bgppeer_types.go b/apis/directconnect/v1beta1/zz_bgppeer_types.go index bb6a630a6e..2025a7d05b 100755 --- a/apis/directconnect/v1beta1/zz_bgppeer_types.go +++ b/apis/directconnect/v1beta1/zz_bgppeer_types.go @@ -153,13 +153,14 @@ type BGPPeerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BGPPeer is the Schema for the BGPPeers API. Provides a Direct Connect BGP peer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BGPPeer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_connection_terraformed.go b/apis/directconnect/v1beta1/zz_connection_terraformed.go new file mode 100755 index 0000000000..522b791ac4 --- /dev/null +++ b/apis/directconnect/v1beta1/zz_connection_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Connection +func (mg *Connection) GetTerraformResourceType() string { + return "aws_dx_connection" +} + +// GetConnectionDetailsMapping for this Connection +func (tr *Connection) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Connection +func (tr *Connection) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Connection +func (tr *Connection) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Connection +func (tr *Connection) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Connection +func (tr *Connection) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Connection +func (tr *Connection) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Connection +func (tr *Connection) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Connection +func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Connection using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { + params := &ConnectionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("EncryptionMode")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Connection) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_connection_types.go b/apis/directconnect/v1beta1/zz_connection_types.go index 27487a83fa..bfa8f8e64b 100755 --- a/apis/directconnect/v1beta1/zz_connection_types.go +++ b/apis/directconnect/v1beta1/zz_connection_types.go @@ -169,13 +169,14 @@ type ConnectionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Connection is the Schema for the Connections API. Provides a Connection of Direct Connect. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Connection struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_connectionassociation_terraformed.go b/apis/directconnect/v1beta1/zz_connectionassociation_terraformed.go new file mode 100755 index 0000000000..665883c462 --- /dev/null +++ b/apis/directconnect/v1beta1/zz_connectionassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConnectionAssociation +func (mg *ConnectionAssociation) GetTerraformResourceType() string { + return "aws_dx_connection_association" +} + +// GetConnectionDetailsMapping for this ConnectionAssociation +func (tr *ConnectionAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ConnectionAssociation +func (tr *ConnectionAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConnectionAssociation +func (tr *ConnectionAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConnectionAssociation +func (tr *ConnectionAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConnectionAssociation +func (tr *ConnectionAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConnectionAssociation +func (tr *ConnectionAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConnectionAssociation +func (tr *ConnectionAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConnectionAssociation +func (tr *ConnectionAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConnectionAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConnectionAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &ConnectionAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConnectionAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_connectionassociation_types.go b/apis/directconnect/v1beta1/zz_connectionassociation_types.go index 7fc0b334db..53c0ff23d4 100755 --- a/apis/directconnect/v1beta1/zz_connectionassociation_types.go +++ b/apis/directconnect/v1beta1/zz_connectionassociation_types.go @@ -117,13 +117,14 @@ type ConnectionAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConnectionAssociation is the Schema for the ConnectionAssociations API. Associates a Direct Connect Connection with a LAG. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConnectionAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_gateway_terraformed.go b/apis/directconnect/v1beta1/zz_gateway_terraformed.go new file mode 100755 index 0000000000..877bd2b3b3 --- /dev/null +++ b/apis/directconnect/v1beta1/zz_gateway_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Gateway +func (mg *Gateway) GetTerraformResourceType() string { + return "aws_dx_gateway" +} + +// GetConnectionDetailsMapping for this Gateway +func (tr *Gateway) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Gateway +func (tr *Gateway) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Gateway +func (tr *Gateway) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Gateway +func (tr *Gateway) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Gateway +func (tr *Gateway) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Gateway +func (tr *Gateway) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Gateway +func (tr *Gateway) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Gateway +func (tr *Gateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Gateway using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Gateway) LateInitialize(attrs []byte) (bool, error) { + params := &GatewayParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Gateway) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_gateway_types.go b/apis/directconnect/v1beta1/zz_gateway_types.go index a6d0e90c48..62ab5c2730 100755 --- a/apis/directconnect/v1beta1/zz_gateway_types.go +++ b/apis/directconnect/v1beta1/zz_gateway_types.go @@ -81,13 +81,14 @@ type GatewayStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Gateway is the Schema for the Gateways API. Provides a Direct Connect Gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Gateway struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_gatewayassociation_terraformed.go b/apis/directconnect/v1beta1/zz_gatewayassociation_terraformed.go new file mode 100755 index 0000000000..780298431c --- /dev/null +++ b/apis/directconnect/v1beta1/zz_gatewayassociation_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GatewayAssociation +func (mg *GatewayAssociation) GetTerraformResourceType() string { + return "aws_dx_gateway_association" +} + +// GetConnectionDetailsMapping for this GatewayAssociation +func (tr *GatewayAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GatewayAssociation +func (tr *GatewayAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GatewayAssociation +func (tr *GatewayAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GatewayAssociation +func (tr *GatewayAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GatewayAssociation +func (tr *GatewayAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GatewayAssociation +func (tr *GatewayAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GatewayAssociation +func (tr *GatewayAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GatewayAssociation +func (tr *GatewayAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GatewayAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GatewayAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &GatewayAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("AssociatedGatewayOwnerAccountID")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GatewayAssociation) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/directconnect/v1beta1/zz_gatewayassociation_types.go b/apis/directconnect/v1beta1/zz_gatewayassociation_types.go index d27384caed..3fc8b2bc43 100755 --- a/apis/directconnect/v1beta1/zz_gatewayassociation_types.go +++ b/apis/directconnect/v1beta1/zz_gatewayassociation_types.go @@ -179,13 +179,14 @@ type GatewayAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GatewayAssociation is the Schema for the GatewayAssociations API. Associates a Direct Connect Gateway with a VGW or transit gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GatewayAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_gatewayassociationproposal_terraformed.go b/apis/directconnect/v1beta1/zz_gatewayassociationproposal_terraformed.go new file mode 100755 index 0000000000..a43378cd76 --- /dev/null +++ b/apis/directconnect/v1beta1/zz_gatewayassociationproposal_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GatewayAssociationProposal +func (mg *GatewayAssociationProposal) GetTerraformResourceType() string { + return "aws_dx_gateway_association_proposal" +} + +// GetConnectionDetailsMapping for this GatewayAssociationProposal +func (tr *GatewayAssociationProposal) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GatewayAssociationProposal +func (tr *GatewayAssociationProposal) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GatewayAssociationProposal +func (tr *GatewayAssociationProposal) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GatewayAssociationProposal +func (tr *GatewayAssociationProposal) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GatewayAssociationProposal +func (tr *GatewayAssociationProposal) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GatewayAssociationProposal +func (tr *GatewayAssociationProposal) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GatewayAssociationProposal +func (tr *GatewayAssociationProposal) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GatewayAssociationProposal +func (tr *GatewayAssociationProposal) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GatewayAssociationProposal using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GatewayAssociationProposal) LateInitialize(attrs []byte) (bool, error) { + params := &GatewayAssociationProposalParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GatewayAssociationProposal) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_gatewayassociationproposal_types.go b/apis/directconnect/v1beta1/zz_gatewayassociationproposal_types.go index 6f7890b5e6..3f567bae32 100755 --- a/apis/directconnect/v1beta1/zz_gatewayassociationproposal_types.go +++ b/apis/directconnect/v1beta1/zz_gatewayassociationproposal_types.go @@ -167,13 +167,14 @@ type GatewayAssociationProposalStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GatewayAssociationProposal is the Schema for the GatewayAssociationProposals API. Manages a Direct Connect Gateway Association Proposal. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GatewayAssociationProposal struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_generated.conversion_hubs.go b/apis/directconnect/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..afb95aab2e --- /dev/null +++ b/apis/directconnect/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,59 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *BGPPeer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Connection) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ConnectionAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Gateway) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GatewayAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GatewayAssociationProposal) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HostedPrivateVirtualInterface) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HostedPrivateVirtualInterfaceAccepter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HostedPublicVirtualInterface) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HostedPublicVirtualInterfaceAccepter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HostedTransitVirtualInterface) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HostedTransitVirtualInterfaceAccepter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Lag) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PrivateVirtualInterface) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PublicVirtualInterface) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitVirtualInterface) Hub() {} diff --git a/apis/directconnect/v1beta1/zz_generated_terraformed.go b/apis/directconnect/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 2c73e7ca5d..0000000000 --- a/apis/directconnect/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1845 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this BGPPeer -func (mg *BGPPeer) GetTerraformResourceType() string { - return "aws_dx_bgp_peer" -} - -// GetConnectionDetailsMapping for this BGPPeer -func (tr *BGPPeer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BGPPeer -func (tr *BGPPeer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BGPPeer -func (tr *BGPPeer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BGPPeer -func (tr *BGPPeer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BGPPeer -func (tr *BGPPeer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BGPPeer -func (tr *BGPPeer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BGPPeer -func (tr *BGPPeer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BGPPeer -func (tr *BGPPeer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BGPPeer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BGPPeer) LateInitialize(attrs []byte) (bool, error) { - params := &BGPPeerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BGPPeer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Connection -func (mg *Connection) GetTerraformResourceType() string { - return "aws_dx_connection" -} - -// GetConnectionDetailsMapping for this Connection -func (tr *Connection) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Connection -func (tr *Connection) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Connection -func (tr *Connection) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Connection -func (tr *Connection) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Connection -func (tr *Connection) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Connection -func (tr *Connection) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Connection -func (tr *Connection) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Connection -func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Connection using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { - params := &ConnectionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("EncryptionMode")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Connection) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ConnectionAssociation -func (mg *ConnectionAssociation) GetTerraformResourceType() string { - return "aws_dx_connection_association" -} - -// GetConnectionDetailsMapping for this ConnectionAssociation -func (tr *ConnectionAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ConnectionAssociation -func (tr *ConnectionAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConnectionAssociation -func (tr *ConnectionAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConnectionAssociation -func (tr *ConnectionAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConnectionAssociation -func (tr *ConnectionAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConnectionAssociation -func (tr *ConnectionAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConnectionAssociation -func (tr *ConnectionAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConnectionAssociation -func (tr *ConnectionAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConnectionAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConnectionAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &ConnectionAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConnectionAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Gateway -func (mg *Gateway) GetTerraformResourceType() string { - return "aws_dx_gateway" -} - -// GetConnectionDetailsMapping for this Gateway -func (tr *Gateway) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Gateway -func (tr *Gateway) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Gateway -func (tr *Gateway) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Gateway -func (tr *Gateway) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Gateway -func (tr *Gateway) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Gateway -func (tr *Gateway) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Gateway -func (tr *Gateway) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Gateway -func (tr *Gateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Gateway using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Gateway) LateInitialize(attrs []byte) (bool, error) { - params := &GatewayParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Gateway) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GatewayAssociation -func (mg *GatewayAssociation) GetTerraformResourceType() string { - return "aws_dx_gateway_association" -} - -// GetConnectionDetailsMapping for this GatewayAssociation -func (tr *GatewayAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GatewayAssociation -func (tr *GatewayAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GatewayAssociation -func (tr *GatewayAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GatewayAssociation -func (tr *GatewayAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GatewayAssociation -func (tr *GatewayAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GatewayAssociation -func (tr *GatewayAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GatewayAssociation -func (tr *GatewayAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GatewayAssociation -func (tr *GatewayAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GatewayAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GatewayAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &GatewayAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("AssociatedGatewayOwnerAccountID")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GatewayAssociation) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this GatewayAssociationProposal -func (mg *GatewayAssociationProposal) GetTerraformResourceType() string { - return "aws_dx_gateway_association_proposal" -} - -// GetConnectionDetailsMapping for this GatewayAssociationProposal -func (tr *GatewayAssociationProposal) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GatewayAssociationProposal -func (tr *GatewayAssociationProposal) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GatewayAssociationProposal -func (tr *GatewayAssociationProposal) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GatewayAssociationProposal -func (tr *GatewayAssociationProposal) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GatewayAssociationProposal -func (tr *GatewayAssociationProposal) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GatewayAssociationProposal -func (tr *GatewayAssociationProposal) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GatewayAssociationProposal -func (tr *GatewayAssociationProposal) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GatewayAssociationProposal -func (tr *GatewayAssociationProposal) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GatewayAssociationProposal using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GatewayAssociationProposal) LateInitialize(attrs []byte) (bool, error) { - params := &GatewayAssociationProposalParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GatewayAssociationProposal) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HostedPrivateVirtualInterface -func (mg *HostedPrivateVirtualInterface) GetTerraformResourceType() string { - return "aws_dx_hosted_private_virtual_interface" -} - -// GetConnectionDetailsMapping for this HostedPrivateVirtualInterface -func (tr *HostedPrivateVirtualInterface) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HostedPrivateVirtualInterface -func (tr *HostedPrivateVirtualInterface) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HostedPrivateVirtualInterface -func (tr *HostedPrivateVirtualInterface) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HostedPrivateVirtualInterface -func (tr *HostedPrivateVirtualInterface) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HostedPrivateVirtualInterface -func (tr *HostedPrivateVirtualInterface) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HostedPrivateVirtualInterface -func (tr *HostedPrivateVirtualInterface) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HostedPrivateVirtualInterface -func (tr *HostedPrivateVirtualInterface) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HostedPrivateVirtualInterface -func (tr *HostedPrivateVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HostedPrivateVirtualInterface using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HostedPrivateVirtualInterface) LateInitialize(attrs []byte) (bool, error) { - params := &HostedPrivateVirtualInterfaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HostedPrivateVirtualInterface) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HostedPrivateVirtualInterfaceAccepter -func (mg *HostedPrivateVirtualInterfaceAccepter) GetTerraformResourceType() string { - return "aws_dx_hosted_private_virtual_interface_accepter" -} - -// GetConnectionDetailsMapping for this HostedPrivateVirtualInterfaceAccepter -func (tr *HostedPrivateVirtualInterfaceAccepter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HostedPrivateVirtualInterfaceAccepter -func (tr *HostedPrivateVirtualInterfaceAccepter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HostedPrivateVirtualInterfaceAccepter -func (tr *HostedPrivateVirtualInterfaceAccepter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HostedPrivateVirtualInterfaceAccepter -func (tr *HostedPrivateVirtualInterfaceAccepter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HostedPrivateVirtualInterfaceAccepter -func (tr *HostedPrivateVirtualInterfaceAccepter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HostedPrivateVirtualInterfaceAccepter -func (tr *HostedPrivateVirtualInterfaceAccepter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HostedPrivateVirtualInterfaceAccepter -func (tr *HostedPrivateVirtualInterfaceAccepter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HostedPrivateVirtualInterfaceAccepter -func (tr *HostedPrivateVirtualInterfaceAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HostedPrivateVirtualInterfaceAccepter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HostedPrivateVirtualInterfaceAccepter) LateInitialize(attrs []byte) (bool, error) { - params := &HostedPrivateVirtualInterfaceAccepterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HostedPrivateVirtualInterfaceAccepter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HostedPublicVirtualInterface -func (mg *HostedPublicVirtualInterface) GetTerraformResourceType() string { - return "aws_dx_hosted_public_virtual_interface" -} - -// GetConnectionDetailsMapping for this HostedPublicVirtualInterface -func (tr *HostedPublicVirtualInterface) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HostedPublicVirtualInterface -func (tr *HostedPublicVirtualInterface) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HostedPublicVirtualInterface -func (tr *HostedPublicVirtualInterface) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HostedPublicVirtualInterface -func (tr *HostedPublicVirtualInterface) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HostedPublicVirtualInterface -func (tr *HostedPublicVirtualInterface) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HostedPublicVirtualInterface -func (tr *HostedPublicVirtualInterface) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HostedPublicVirtualInterface -func (tr *HostedPublicVirtualInterface) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HostedPublicVirtualInterface -func (tr *HostedPublicVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HostedPublicVirtualInterface using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HostedPublicVirtualInterface) LateInitialize(attrs []byte) (bool, error) { - params := &HostedPublicVirtualInterfaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HostedPublicVirtualInterface) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HostedPublicVirtualInterfaceAccepter -func (mg *HostedPublicVirtualInterfaceAccepter) GetTerraformResourceType() string { - return "aws_dx_hosted_public_virtual_interface_accepter" -} - -// GetConnectionDetailsMapping for this HostedPublicVirtualInterfaceAccepter -func (tr *HostedPublicVirtualInterfaceAccepter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HostedPublicVirtualInterfaceAccepter -func (tr *HostedPublicVirtualInterfaceAccepter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HostedPublicVirtualInterfaceAccepter -func (tr *HostedPublicVirtualInterfaceAccepter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HostedPublicVirtualInterfaceAccepter -func (tr *HostedPublicVirtualInterfaceAccepter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HostedPublicVirtualInterfaceAccepter -func (tr *HostedPublicVirtualInterfaceAccepter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HostedPublicVirtualInterfaceAccepter -func (tr *HostedPublicVirtualInterfaceAccepter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HostedPublicVirtualInterfaceAccepter -func (tr *HostedPublicVirtualInterfaceAccepter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HostedPublicVirtualInterfaceAccepter -func (tr *HostedPublicVirtualInterfaceAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HostedPublicVirtualInterfaceAccepter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HostedPublicVirtualInterfaceAccepter) LateInitialize(attrs []byte) (bool, error) { - params := &HostedPublicVirtualInterfaceAccepterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HostedPublicVirtualInterfaceAccepter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HostedTransitVirtualInterface -func (mg *HostedTransitVirtualInterface) GetTerraformResourceType() string { - return "aws_dx_hosted_transit_virtual_interface" -} - -// GetConnectionDetailsMapping for this HostedTransitVirtualInterface -func (tr *HostedTransitVirtualInterface) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HostedTransitVirtualInterface -func (tr *HostedTransitVirtualInterface) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HostedTransitVirtualInterface -func (tr *HostedTransitVirtualInterface) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HostedTransitVirtualInterface -func (tr *HostedTransitVirtualInterface) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HostedTransitVirtualInterface -func (tr *HostedTransitVirtualInterface) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HostedTransitVirtualInterface -func (tr *HostedTransitVirtualInterface) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HostedTransitVirtualInterface -func (tr *HostedTransitVirtualInterface) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HostedTransitVirtualInterface -func (tr *HostedTransitVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HostedTransitVirtualInterface using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HostedTransitVirtualInterface) LateInitialize(attrs []byte) (bool, error) { - params := &HostedTransitVirtualInterfaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HostedTransitVirtualInterface) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HostedTransitVirtualInterfaceAccepter -func (mg *HostedTransitVirtualInterfaceAccepter) GetTerraformResourceType() string { - return "aws_dx_hosted_transit_virtual_interface_accepter" -} - -// GetConnectionDetailsMapping for this HostedTransitVirtualInterfaceAccepter -func (tr *HostedTransitVirtualInterfaceAccepter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HostedTransitVirtualInterfaceAccepter -func (tr *HostedTransitVirtualInterfaceAccepter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HostedTransitVirtualInterfaceAccepter -func (tr *HostedTransitVirtualInterfaceAccepter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HostedTransitVirtualInterfaceAccepter -func (tr *HostedTransitVirtualInterfaceAccepter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HostedTransitVirtualInterfaceAccepter -func (tr *HostedTransitVirtualInterfaceAccepter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HostedTransitVirtualInterfaceAccepter -func (tr *HostedTransitVirtualInterfaceAccepter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HostedTransitVirtualInterfaceAccepter -func (tr *HostedTransitVirtualInterfaceAccepter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HostedTransitVirtualInterfaceAccepter -func (tr *HostedTransitVirtualInterfaceAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HostedTransitVirtualInterfaceAccepter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HostedTransitVirtualInterfaceAccepter) LateInitialize(attrs []byte) (bool, error) { - params := &HostedTransitVirtualInterfaceAccepterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HostedTransitVirtualInterfaceAccepter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Lag -func (mg *Lag) GetTerraformResourceType() string { - return "aws_dx_lag" -} - -// GetConnectionDetailsMapping for this Lag -func (tr *Lag) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Lag -func (tr *Lag) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Lag -func (tr *Lag) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Lag -func (tr *Lag) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Lag -func (tr *Lag) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Lag -func (tr *Lag) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Lag -func (tr *Lag) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Lag -func (tr *Lag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Lag using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Lag) LateInitialize(attrs []byte) (bool, error) { - params := &LagParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Lag) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PrivateVirtualInterface -func (mg *PrivateVirtualInterface) GetTerraformResourceType() string { - return "aws_dx_private_virtual_interface" -} - -// GetConnectionDetailsMapping for this PrivateVirtualInterface -func (tr *PrivateVirtualInterface) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PrivateVirtualInterface -func (tr *PrivateVirtualInterface) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PrivateVirtualInterface -func (tr *PrivateVirtualInterface) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PrivateVirtualInterface -func (tr *PrivateVirtualInterface) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PrivateVirtualInterface -func (tr *PrivateVirtualInterface) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PrivateVirtualInterface -func (tr *PrivateVirtualInterface) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PrivateVirtualInterface -func (tr *PrivateVirtualInterface) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PrivateVirtualInterface -func (tr *PrivateVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PrivateVirtualInterface using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PrivateVirtualInterface) LateInitialize(attrs []byte) (bool, error) { - params := &PrivateVirtualInterfaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PrivateVirtualInterface) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PublicVirtualInterface -func (mg *PublicVirtualInterface) GetTerraformResourceType() string { - return "aws_dx_public_virtual_interface" -} - -// GetConnectionDetailsMapping for this PublicVirtualInterface -func (tr *PublicVirtualInterface) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PublicVirtualInterface -func (tr *PublicVirtualInterface) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PublicVirtualInterface -func (tr *PublicVirtualInterface) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PublicVirtualInterface -func (tr *PublicVirtualInterface) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PublicVirtualInterface -func (tr *PublicVirtualInterface) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PublicVirtualInterface -func (tr *PublicVirtualInterface) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PublicVirtualInterface -func (tr *PublicVirtualInterface) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PublicVirtualInterface -func (tr *PublicVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PublicVirtualInterface using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PublicVirtualInterface) LateInitialize(attrs []byte) (bool, error) { - params := &PublicVirtualInterfaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PublicVirtualInterface) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitVirtualInterface -func (mg *TransitVirtualInterface) GetTerraformResourceType() string { - return "aws_dx_transit_virtual_interface" -} - -// GetConnectionDetailsMapping for this TransitVirtualInterface -func (tr *TransitVirtualInterface) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitVirtualInterface -func (tr *TransitVirtualInterface) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitVirtualInterface -func (tr *TransitVirtualInterface) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitVirtualInterface -func (tr *TransitVirtualInterface) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitVirtualInterface -func (tr *TransitVirtualInterface) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitVirtualInterface -func (tr *TransitVirtualInterface) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitVirtualInterface -func (tr *TransitVirtualInterface) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitVirtualInterface -func (tr *TransitVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitVirtualInterface using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitVirtualInterface) LateInitialize(attrs []byte) (bool, error) { - params := &TransitVirtualInterfaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitVirtualInterface) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterface_terraformed.go b/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterface_terraformed.go new file mode 100755 index 0000000000..8a9882a56e --- /dev/null +++ b/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterface_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HostedPrivateVirtualInterface +func (mg *HostedPrivateVirtualInterface) GetTerraformResourceType() string { + return "aws_dx_hosted_private_virtual_interface" +} + +// GetConnectionDetailsMapping for this HostedPrivateVirtualInterface +func (tr *HostedPrivateVirtualInterface) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HostedPrivateVirtualInterface +func (tr *HostedPrivateVirtualInterface) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HostedPrivateVirtualInterface +func (tr *HostedPrivateVirtualInterface) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HostedPrivateVirtualInterface +func (tr *HostedPrivateVirtualInterface) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HostedPrivateVirtualInterface +func (tr *HostedPrivateVirtualInterface) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HostedPrivateVirtualInterface +func (tr *HostedPrivateVirtualInterface) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HostedPrivateVirtualInterface +func (tr *HostedPrivateVirtualInterface) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HostedPrivateVirtualInterface +func (tr *HostedPrivateVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HostedPrivateVirtualInterface using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HostedPrivateVirtualInterface) LateInitialize(attrs []byte) (bool, error) { + params := &HostedPrivateVirtualInterfaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HostedPrivateVirtualInterface) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterface_types.go b/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterface_types.go index 9ce9c2a6de..98df4c3963 100755 --- a/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterface_types.go +++ b/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterface_types.go @@ -187,13 +187,14 @@ type HostedPrivateVirtualInterfaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HostedPrivateVirtualInterface is the Schema for the HostedPrivateVirtualInterfaces API. Provides a Direct Connect hosted private virtual interface resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HostedPrivateVirtualInterface struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterfaceaccepter_terraformed.go b/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterfaceaccepter_terraformed.go new file mode 100755 index 0000000000..65d799d22a --- /dev/null +++ b/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterfaceaccepter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HostedPrivateVirtualInterfaceAccepter +func (mg *HostedPrivateVirtualInterfaceAccepter) GetTerraformResourceType() string { + return "aws_dx_hosted_private_virtual_interface_accepter" +} + +// GetConnectionDetailsMapping for this HostedPrivateVirtualInterfaceAccepter +func (tr *HostedPrivateVirtualInterfaceAccepter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HostedPrivateVirtualInterfaceAccepter +func (tr *HostedPrivateVirtualInterfaceAccepter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HostedPrivateVirtualInterfaceAccepter +func (tr *HostedPrivateVirtualInterfaceAccepter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HostedPrivateVirtualInterfaceAccepter +func (tr *HostedPrivateVirtualInterfaceAccepter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HostedPrivateVirtualInterfaceAccepter +func (tr *HostedPrivateVirtualInterfaceAccepter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HostedPrivateVirtualInterfaceAccepter +func (tr *HostedPrivateVirtualInterfaceAccepter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HostedPrivateVirtualInterfaceAccepter +func (tr *HostedPrivateVirtualInterfaceAccepter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HostedPrivateVirtualInterfaceAccepter +func (tr *HostedPrivateVirtualInterfaceAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HostedPrivateVirtualInterfaceAccepter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HostedPrivateVirtualInterfaceAccepter) LateInitialize(attrs []byte) (bool, error) { + params := &HostedPrivateVirtualInterfaceAccepterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HostedPrivateVirtualInterfaceAccepter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterfaceaccepter_types.go b/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterfaceaccepter_types.go index 4eebd6b60e..4461d53765 100755 --- a/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterfaceaccepter_types.go +++ b/apis/directconnect/v1beta1/zz_hostedprivatevirtualinterfaceaccepter_types.go @@ -146,13 +146,14 @@ type HostedPrivateVirtualInterfaceAccepterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HostedPrivateVirtualInterfaceAccepter is the Schema for the HostedPrivateVirtualInterfaceAccepters API. Provides a resource to manage the accepter's side of a Direct Connect hosted private virtual interface. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HostedPrivateVirtualInterfaceAccepter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterface_terraformed.go b/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterface_terraformed.go new file mode 100755 index 0000000000..860cec2ef5 --- /dev/null +++ b/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterface_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HostedPublicVirtualInterface +func (mg *HostedPublicVirtualInterface) GetTerraformResourceType() string { + return "aws_dx_hosted_public_virtual_interface" +} + +// GetConnectionDetailsMapping for this HostedPublicVirtualInterface +func (tr *HostedPublicVirtualInterface) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HostedPublicVirtualInterface +func (tr *HostedPublicVirtualInterface) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HostedPublicVirtualInterface +func (tr *HostedPublicVirtualInterface) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HostedPublicVirtualInterface +func (tr *HostedPublicVirtualInterface) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HostedPublicVirtualInterface +func (tr *HostedPublicVirtualInterface) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HostedPublicVirtualInterface +func (tr *HostedPublicVirtualInterface) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HostedPublicVirtualInterface +func (tr *HostedPublicVirtualInterface) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HostedPublicVirtualInterface +func (tr *HostedPublicVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HostedPublicVirtualInterface using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HostedPublicVirtualInterface) LateInitialize(attrs []byte) (bool, error) { + params := &HostedPublicVirtualInterfaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HostedPublicVirtualInterface) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterface_types.go b/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterface_types.go index b98b3e31af..74892248a0 100755 --- a/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterface_types.go +++ b/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterface_types.go @@ -187,13 +187,14 @@ type HostedPublicVirtualInterfaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HostedPublicVirtualInterface is the Schema for the HostedPublicVirtualInterfaces API. Provides a Direct Connect hosted public virtual interface resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HostedPublicVirtualInterface struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterfaceaccepter_terraformed.go b/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterfaceaccepter_terraformed.go new file mode 100755 index 0000000000..b0a0ee769b --- /dev/null +++ b/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterfaceaccepter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HostedPublicVirtualInterfaceAccepter +func (mg *HostedPublicVirtualInterfaceAccepter) GetTerraformResourceType() string { + return "aws_dx_hosted_public_virtual_interface_accepter" +} + +// GetConnectionDetailsMapping for this HostedPublicVirtualInterfaceAccepter +func (tr *HostedPublicVirtualInterfaceAccepter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HostedPublicVirtualInterfaceAccepter +func (tr *HostedPublicVirtualInterfaceAccepter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HostedPublicVirtualInterfaceAccepter +func (tr *HostedPublicVirtualInterfaceAccepter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HostedPublicVirtualInterfaceAccepter +func (tr *HostedPublicVirtualInterfaceAccepter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HostedPublicVirtualInterfaceAccepter +func (tr *HostedPublicVirtualInterfaceAccepter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HostedPublicVirtualInterfaceAccepter +func (tr *HostedPublicVirtualInterfaceAccepter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HostedPublicVirtualInterfaceAccepter +func (tr *HostedPublicVirtualInterfaceAccepter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HostedPublicVirtualInterfaceAccepter +func (tr *HostedPublicVirtualInterfaceAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HostedPublicVirtualInterfaceAccepter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HostedPublicVirtualInterfaceAccepter) LateInitialize(attrs []byte) (bool, error) { + params := &HostedPublicVirtualInterfaceAccepterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HostedPublicVirtualInterfaceAccepter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterfaceaccepter_types.go b/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterfaceaccepter_types.go index ff236522ea..c2cb1b3890 100755 --- a/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterfaceaccepter_types.go +++ b/apis/directconnect/v1beta1/zz_hostedpublicvirtualinterfaceaccepter_types.go @@ -106,13 +106,14 @@ type HostedPublicVirtualInterfaceAccepterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HostedPublicVirtualInterfaceAccepter is the Schema for the HostedPublicVirtualInterfaceAccepters API. Provides a resource to manage the accepter's side of a Direct Connect hosted public virtual interface. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HostedPublicVirtualInterfaceAccepter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterface_terraformed.go b/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterface_terraformed.go new file mode 100755 index 0000000000..cb3aeb1756 --- /dev/null +++ b/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterface_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HostedTransitVirtualInterface +func (mg *HostedTransitVirtualInterface) GetTerraformResourceType() string { + return "aws_dx_hosted_transit_virtual_interface" +} + +// GetConnectionDetailsMapping for this HostedTransitVirtualInterface +func (tr *HostedTransitVirtualInterface) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HostedTransitVirtualInterface +func (tr *HostedTransitVirtualInterface) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HostedTransitVirtualInterface +func (tr *HostedTransitVirtualInterface) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HostedTransitVirtualInterface +func (tr *HostedTransitVirtualInterface) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HostedTransitVirtualInterface +func (tr *HostedTransitVirtualInterface) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HostedTransitVirtualInterface +func (tr *HostedTransitVirtualInterface) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HostedTransitVirtualInterface +func (tr *HostedTransitVirtualInterface) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HostedTransitVirtualInterface +func (tr *HostedTransitVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HostedTransitVirtualInterface using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HostedTransitVirtualInterface) LateInitialize(attrs []byte) (bool, error) { + params := &HostedTransitVirtualInterfaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HostedTransitVirtualInterface) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterface_types.go b/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterface_types.go index b1b6bc22b0..37db170b75 100755 --- a/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterface_types.go +++ b/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterface_types.go @@ -187,13 +187,14 @@ type HostedTransitVirtualInterfaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HostedTransitVirtualInterface is the Schema for the HostedTransitVirtualInterfaces API. Provides a Direct Connect hosted transit virtual interface resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HostedTransitVirtualInterface struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterfaceaccepter_terraformed.go b/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterfaceaccepter_terraformed.go new file mode 100755 index 0000000000..377ad8d486 --- /dev/null +++ b/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterfaceaccepter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HostedTransitVirtualInterfaceAccepter +func (mg *HostedTransitVirtualInterfaceAccepter) GetTerraformResourceType() string { + return "aws_dx_hosted_transit_virtual_interface_accepter" +} + +// GetConnectionDetailsMapping for this HostedTransitVirtualInterfaceAccepter +func (tr *HostedTransitVirtualInterfaceAccepter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HostedTransitVirtualInterfaceAccepter +func (tr *HostedTransitVirtualInterfaceAccepter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HostedTransitVirtualInterfaceAccepter +func (tr *HostedTransitVirtualInterfaceAccepter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HostedTransitVirtualInterfaceAccepter +func (tr *HostedTransitVirtualInterfaceAccepter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HostedTransitVirtualInterfaceAccepter +func (tr *HostedTransitVirtualInterfaceAccepter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HostedTransitVirtualInterfaceAccepter +func (tr *HostedTransitVirtualInterfaceAccepter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HostedTransitVirtualInterfaceAccepter +func (tr *HostedTransitVirtualInterfaceAccepter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HostedTransitVirtualInterfaceAccepter +func (tr *HostedTransitVirtualInterfaceAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HostedTransitVirtualInterfaceAccepter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HostedTransitVirtualInterfaceAccepter) LateInitialize(attrs []byte) (bool, error) { + params := &HostedTransitVirtualInterfaceAccepterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HostedTransitVirtualInterfaceAccepter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterfaceaccepter_types.go b/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterfaceaccepter_types.go index 79fd8a5853..876ccaa543 100755 --- a/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterfaceaccepter_types.go +++ b/apis/directconnect/v1beta1/zz_hostedtransitvirtualinterfaceaccepter_types.go @@ -136,13 +136,14 @@ type HostedTransitVirtualInterfaceAccepterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HostedTransitVirtualInterfaceAccepter is the Schema for the HostedTransitVirtualInterfaceAccepters API. Provides a resource to manage the accepter's side of a Direct Connect hosted transit virtual interface. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HostedTransitVirtualInterfaceAccepter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_lag_terraformed.go b/apis/directconnect/v1beta1/zz_lag_terraformed.go new file mode 100755 index 0000000000..7459147f93 --- /dev/null +++ b/apis/directconnect/v1beta1/zz_lag_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Lag +func (mg *Lag) GetTerraformResourceType() string { + return "aws_dx_lag" +} + +// GetConnectionDetailsMapping for this Lag +func (tr *Lag) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Lag +func (tr *Lag) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Lag +func (tr *Lag) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Lag +func (tr *Lag) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Lag +func (tr *Lag) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Lag +func (tr *Lag) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Lag +func (tr *Lag) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Lag +func (tr *Lag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Lag using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Lag) LateInitialize(attrs []byte) (bool, error) { + params := &LagParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Lag) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_lag_types.go b/apis/directconnect/v1beta1/zz_lag_types.go index c2d67f4e80..d51d00e625 100755 --- a/apis/directconnect/v1beta1/zz_lag_types.go +++ b/apis/directconnect/v1beta1/zz_lag_types.go @@ -147,13 +147,14 @@ type LagStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Lag is the Schema for the Lags API. Provides a Direct Connect LAG. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Lag struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_privatevirtualinterface_terraformed.go b/apis/directconnect/v1beta1/zz_privatevirtualinterface_terraformed.go new file mode 100755 index 0000000000..b2b95524d1 --- /dev/null +++ b/apis/directconnect/v1beta1/zz_privatevirtualinterface_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PrivateVirtualInterface +func (mg *PrivateVirtualInterface) GetTerraformResourceType() string { + return "aws_dx_private_virtual_interface" +} + +// GetConnectionDetailsMapping for this PrivateVirtualInterface +func (tr *PrivateVirtualInterface) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PrivateVirtualInterface +func (tr *PrivateVirtualInterface) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PrivateVirtualInterface +func (tr *PrivateVirtualInterface) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PrivateVirtualInterface +func (tr *PrivateVirtualInterface) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PrivateVirtualInterface +func (tr *PrivateVirtualInterface) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PrivateVirtualInterface +func (tr *PrivateVirtualInterface) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PrivateVirtualInterface +func (tr *PrivateVirtualInterface) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PrivateVirtualInterface +func (tr *PrivateVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PrivateVirtualInterface using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PrivateVirtualInterface) LateInitialize(attrs []byte) (bool, error) { + params := &PrivateVirtualInterfaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PrivateVirtualInterface) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_privatevirtualinterface_types.go b/apis/directconnect/v1beta1/zz_privatevirtualinterface_types.go index f4d9ce6ed2..7277707f73 100755 --- a/apis/directconnect/v1beta1/zz_privatevirtualinterface_types.go +++ b/apis/directconnect/v1beta1/zz_privatevirtualinterface_types.go @@ -245,13 +245,14 @@ type PrivateVirtualInterfaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PrivateVirtualInterface is the Schema for the PrivateVirtualInterfaces API. Provides a Direct Connect private virtual interface resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PrivateVirtualInterface struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_publicvirtualinterface_terraformed.go b/apis/directconnect/v1beta1/zz_publicvirtualinterface_terraformed.go new file mode 100755 index 0000000000..f97604be4c --- /dev/null +++ b/apis/directconnect/v1beta1/zz_publicvirtualinterface_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PublicVirtualInterface +func (mg *PublicVirtualInterface) GetTerraformResourceType() string { + return "aws_dx_public_virtual_interface" +} + +// GetConnectionDetailsMapping for this PublicVirtualInterface +func (tr *PublicVirtualInterface) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PublicVirtualInterface +func (tr *PublicVirtualInterface) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PublicVirtualInterface +func (tr *PublicVirtualInterface) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PublicVirtualInterface +func (tr *PublicVirtualInterface) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PublicVirtualInterface +func (tr *PublicVirtualInterface) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PublicVirtualInterface +func (tr *PublicVirtualInterface) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PublicVirtualInterface +func (tr *PublicVirtualInterface) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PublicVirtualInterface +func (tr *PublicVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PublicVirtualInterface using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PublicVirtualInterface) LateInitialize(attrs []byte) (bool, error) { + params := &PublicVirtualInterfaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PublicVirtualInterface) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_publicvirtualinterface_types.go b/apis/directconnect/v1beta1/zz_publicvirtualinterface_types.go index f939fc7359..c07f13cafb 100755 --- a/apis/directconnect/v1beta1/zz_publicvirtualinterface_types.go +++ b/apis/directconnect/v1beta1/zz_publicvirtualinterface_types.go @@ -194,13 +194,14 @@ type PublicVirtualInterfaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PublicVirtualInterface is the Schema for the PublicVirtualInterfaces API. Provides a Direct Connect public virtual interface resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PublicVirtualInterface struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/directconnect/v1beta1/zz_transitvirtualinterface_terraformed.go b/apis/directconnect/v1beta1/zz_transitvirtualinterface_terraformed.go new file mode 100755 index 0000000000..7ce4860eb9 --- /dev/null +++ b/apis/directconnect/v1beta1/zz_transitvirtualinterface_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitVirtualInterface +func (mg *TransitVirtualInterface) GetTerraformResourceType() string { + return "aws_dx_transit_virtual_interface" +} + +// GetConnectionDetailsMapping for this TransitVirtualInterface +func (tr *TransitVirtualInterface) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitVirtualInterface +func (tr *TransitVirtualInterface) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitVirtualInterface +func (tr *TransitVirtualInterface) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitVirtualInterface +func (tr *TransitVirtualInterface) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitVirtualInterface +func (tr *TransitVirtualInterface) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitVirtualInterface +func (tr *TransitVirtualInterface) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitVirtualInterface +func (tr *TransitVirtualInterface) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitVirtualInterface +func (tr *TransitVirtualInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitVirtualInterface using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitVirtualInterface) LateInitialize(attrs []byte) (bool, error) { + params := &TransitVirtualInterfaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitVirtualInterface) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/directconnect/v1beta1/zz_transitvirtualinterface_types.go b/apis/directconnect/v1beta1/zz_transitvirtualinterface_types.go index 3c28c9e49d..70f0ab9123 100755 --- a/apis/directconnect/v1beta1/zz_transitvirtualinterface_types.go +++ b/apis/directconnect/v1beta1/zz_transitvirtualinterface_types.go @@ -239,13 +239,14 @@ type TransitVirtualInterfaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitVirtualInterface is the Schema for the TransitVirtualInterfaces API. Provides a Direct Connect transit virtual interface resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitVirtualInterface struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dlm/v1beta1/zz_generated.conversion_hubs.go b/apis/dlm/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b7fd341bd7 --- /dev/null +++ b/apis/dlm/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *LifecyclePolicy) Hub() {} diff --git a/apis/dlm/v1beta1/zz_generated_terraformed.go b/apis/dlm/v1beta1/zz_lifecyclepolicy_terraformed.go similarity index 100% rename from apis/dlm/v1beta1/zz_generated_terraformed.go rename to apis/dlm/v1beta1/zz_lifecyclepolicy_terraformed.go diff --git a/apis/dlm/v1beta1/zz_lifecyclepolicy_types.go b/apis/dlm/v1beta1/zz_lifecyclepolicy_types.go index 09887c42eb..5f19e55a2b 100755 --- a/apis/dlm/v1beta1/zz_lifecyclepolicy_types.go +++ b/apis/dlm/v1beta1/zz_lifecyclepolicy_types.go @@ -949,13 +949,14 @@ type LifecyclePolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LifecyclePolicy is the Schema for the LifecyclePolicys API. Provides a Data Lifecycle Manager (DLM) lifecycle policy for managing snapshots. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LifecyclePolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dms/v1beta1/zz_certificate_terraformed.go b/apis/dms/v1beta1/zz_certificate_terraformed.go new file mode 100755 index 0000000000..0a8b5d6d5b --- /dev/null +++ b/apis/dms/v1beta1/zz_certificate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Certificate +func (mg *Certificate) GetTerraformResourceType() string { + return "aws_dms_certificate" +} + +// GetConnectionDetailsMapping for this Certificate +func (tr *Certificate) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"certificate_pem": "spec.forProvider.certificatePemSecretRef", "certificate_wallet": "spec.forProvider.certificateWalletSecretRef"} +} + +// GetObservation of this Certificate +func (tr *Certificate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Certificate +func (tr *Certificate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Certificate +func (tr *Certificate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Certificate +func (tr *Certificate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Certificate +func (tr *Certificate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Certificate +func (tr *Certificate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Certificate +func (tr *Certificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Certificate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Certificate) LateInitialize(attrs []byte) (bool, error) { + params := &CertificateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Certificate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dms/v1beta1/zz_certificate_types.go b/apis/dms/v1beta1/zz_certificate_types.go index df1d3b128a..034f08d7c2 100755 --- a/apis/dms/v1beta1/zz_certificate_types.go +++ b/apis/dms/v1beta1/zz_certificate_types.go @@ -85,13 +85,14 @@ type CertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Certificate is the Schema for the Certificates API. Provides a DMS (Data Migration Service) certificate resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Certificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dms/v1beta1/zz_endpoint_terraformed.go b/apis/dms/v1beta1/zz_endpoint_terraformed.go new file mode 100755 index 0000000000..efc18ef035 --- /dev/null +++ b/apis/dms/v1beta1/zz_endpoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Endpoint +func (mg *Endpoint) GetTerraformResourceType() string { + return "aws_dms_endpoint" +} + +// GetConnectionDetailsMapping for this Endpoint +func (tr *Endpoint) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"kafka_settings[*].sasl_password": "spec.forProvider.kafkaSettings[*].saslPasswordSecretRef", "kafka_settings[*].ssl_client_key_password": "spec.forProvider.kafkaSettings[*].sslClientKeyPasswordSecretRef", "password": "spec.forProvider.passwordSecretRef", "redis_settings[*].auth_password": "spec.forProvider.redisSettings[*].authPasswordSecretRef"} +} + +// GetObservation of this Endpoint +func (tr *Endpoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Endpoint +func (tr *Endpoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Endpoint +func (tr *Endpoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Endpoint +func (tr *Endpoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Endpoint +func (tr *Endpoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Endpoint +func (tr *Endpoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Endpoint +func (tr *Endpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Endpoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Endpoint) LateInitialize(attrs []byte) (bool, error) { + params := &EndpointParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Endpoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dms/v1beta1/zz_endpoint_types.go b/apis/dms/v1beta1/zz_endpoint_types.go index 3b01116234..beb149317a 100755 --- a/apis/dms/v1beta1/zz_endpoint_types.go +++ b/apis/dms/v1beta1/zz_endpoint_types.go @@ -1259,13 +1259,14 @@ type EndpointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Endpoint is the Schema for the Endpoints API. Provides a DMS (Data Migration Service) endpoint resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Endpoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dms/v1beta1/zz_eventsubscription_terraformed.go b/apis/dms/v1beta1/zz_eventsubscription_terraformed.go new file mode 100755 index 0000000000..f03b109bd8 --- /dev/null +++ b/apis/dms/v1beta1/zz_eventsubscription_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EventSubscription +func (mg *EventSubscription) GetTerraformResourceType() string { + return "aws_dms_event_subscription" +} + +// GetConnectionDetailsMapping for this EventSubscription +func (tr *EventSubscription) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EventSubscription +func (tr *EventSubscription) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EventSubscription +func (tr *EventSubscription) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EventSubscription +func (tr *EventSubscription) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EventSubscription +func (tr *EventSubscription) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EventSubscription +func (tr *EventSubscription) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EventSubscription +func (tr *EventSubscription) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EventSubscription +func (tr *EventSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EventSubscription using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EventSubscription) LateInitialize(attrs []byte) (bool, error) { + params := &EventSubscriptionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EventSubscription) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dms/v1beta1/zz_eventsubscription_types.go b/apis/dms/v1beta1/zz_eventsubscription_types.go index a95a4499e5..7577ac09bc 100755 --- a/apis/dms/v1beta1/zz_eventsubscription_types.go +++ b/apis/dms/v1beta1/zz_eventsubscription_types.go @@ -153,13 +153,14 @@ type EventSubscriptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EventSubscription is the Schema for the EventSubscriptions API. Provides a DMS (Data Migration Service) event subscription resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EventSubscription struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dms/v1beta1/zz_generated.conversion_hubs.go b/apis/dms/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..0607116e3c --- /dev/null +++ b/apis/dms/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Certificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Endpoint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EventSubscription) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReplicationInstance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReplicationSubnetGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReplicationTask) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *S3Endpoint) Hub() {} diff --git a/apis/dms/v1beta1/zz_generated_terraformed.go b/apis/dms/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 768c27832e..0000000000 --- a/apis/dms/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,817 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Certificate -func (mg *Certificate) GetTerraformResourceType() string { - return "aws_dms_certificate" -} - -// GetConnectionDetailsMapping for this Certificate -func (tr *Certificate) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"certificate_pem": "spec.forProvider.certificatePemSecretRef", "certificate_wallet": "spec.forProvider.certificateWalletSecretRef"} -} - -// GetObservation of this Certificate -func (tr *Certificate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Certificate -func (tr *Certificate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Certificate -func (tr *Certificate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Certificate -func (tr *Certificate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Certificate -func (tr *Certificate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Certificate -func (tr *Certificate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Certificate -func (tr *Certificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Certificate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Certificate) LateInitialize(attrs []byte) (bool, error) { - params := &CertificateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Certificate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Endpoint -func (mg *Endpoint) GetTerraformResourceType() string { - return "aws_dms_endpoint" -} - -// GetConnectionDetailsMapping for this Endpoint -func (tr *Endpoint) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"kafka_settings[*].sasl_password": "spec.forProvider.kafkaSettings[*].saslPasswordSecretRef", "kafka_settings[*].ssl_client_key_password": "spec.forProvider.kafkaSettings[*].sslClientKeyPasswordSecretRef", "password": "spec.forProvider.passwordSecretRef", "redis_settings[*].auth_password": "spec.forProvider.redisSettings[*].authPasswordSecretRef"} -} - -// GetObservation of this Endpoint -func (tr *Endpoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Endpoint -func (tr *Endpoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Endpoint -func (tr *Endpoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Endpoint -func (tr *Endpoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Endpoint -func (tr *Endpoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Endpoint -func (tr *Endpoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Endpoint -func (tr *Endpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Endpoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Endpoint) LateInitialize(attrs []byte) (bool, error) { - params := &EndpointParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Endpoint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EventSubscription -func (mg *EventSubscription) GetTerraformResourceType() string { - return "aws_dms_event_subscription" -} - -// GetConnectionDetailsMapping for this EventSubscription -func (tr *EventSubscription) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EventSubscription -func (tr *EventSubscription) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EventSubscription -func (tr *EventSubscription) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EventSubscription -func (tr *EventSubscription) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EventSubscription -func (tr *EventSubscription) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EventSubscription -func (tr *EventSubscription) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EventSubscription -func (tr *EventSubscription) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EventSubscription -func (tr *EventSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EventSubscription using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EventSubscription) LateInitialize(attrs []byte) (bool, error) { - params := &EventSubscriptionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EventSubscription) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReplicationInstance -func (mg *ReplicationInstance) GetTerraformResourceType() string { - return "aws_dms_replication_instance" -} - -// GetConnectionDetailsMapping for this ReplicationInstance -func (tr *ReplicationInstance) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ReplicationInstance -func (tr *ReplicationInstance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReplicationInstance -func (tr *ReplicationInstance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReplicationInstance -func (tr *ReplicationInstance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReplicationInstance -func (tr *ReplicationInstance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReplicationInstance -func (tr *ReplicationInstance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReplicationInstance -func (tr *ReplicationInstance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReplicationInstance -func (tr *ReplicationInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReplicationInstance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReplicationInstance) LateInitialize(attrs []byte) (bool, error) { - params := &ReplicationInstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReplicationInstance) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReplicationSubnetGroup -func (mg *ReplicationSubnetGroup) GetTerraformResourceType() string { - return "aws_dms_replication_subnet_group" -} - -// GetConnectionDetailsMapping for this ReplicationSubnetGroup -func (tr *ReplicationSubnetGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ReplicationSubnetGroup -func (tr *ReplicationSubnetGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReplicationSubnetGroup -func (tr *ReplicationSubnetGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReplicationSubnetGroup -func (tr *ReplicationSubnetGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReplicationSubnetGroup -func (tr *ReplicationSubnetGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReplicationSubnetGroup -func (tr *ReplicationSubnetGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReplicationSubnetGroup -func (tr *ReplicationSubnetGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReplicationSubnetGroup -func (tr *ReplicationSubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReplicationSubnetGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReplicationSubnetGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ReplicationSubnetGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReplicationSubnetGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReplicationTask -func (mg *ReplicationTask) GetTerraformResourceType() string { - return "aws_dms_replication_task" -} - -// GetConnectionDetailsMapping for this ReplicationTask -func (tr *ReplicationTask) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ReplicationTask -func (tr *ReplicationTask) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReplicationTask -func (tr *ReplicationTask) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReplicationTask -func (tr *ReplicationTask) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReplicationTask -func (tr *ReplicationTask) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReplicationTask -func (tr *ReplicationTask) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReplicationTask -func (tr *ReplicationTask) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReplicationTask -func (tr *ReplicationTask) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReplicationTask using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReplicationTask) LateInitialize(attrs []byte) (bool, error) { - params := &ReplicationTaskParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReplicationTask) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this S3Endpoint -func (mg *S3Endpoint) GetTerraformResourceType() string { - return "aws_dms_s3_endpoint" -} - -// GetConnectionDetailsMapping for this S3Endpoint -func (tr *S3Endpoint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this S3Endpoint -func (tr *S3Endpoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this S3Endpoint -func (tr *S3Endpoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this S3Endpoint -func (tr *S3Endpoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this S3Endpoint -func (tr *S3Endpoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this S3Endpoint -func (tr *S3Endpoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this S3Endpoint -func (tr *S3Endpoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this S3Endpoint -func (tr *S3Endpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this S3Endpoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *S3Endpoint) LateInitialize(attrs []byte) (bool, error) { - params := &S3EndpointParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *S3Endpoint) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/dms/v1beta1/zz_replicationinstance_terraformed.go b/apis/dms/v1beta1/zz_replicationinstance_terraformed.go new file mode 100755 index 0000000000..b1782c2528 --- /dev/null +++ b/apis/dms/v1beta1/zz_replicationinstance_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReplicationInstance +func (mg *ReplicationInstance) GetTerraformResourceType() string { + return "aws_dms_replication_instance" +} + +// GetConnectionDetailsMapping for this ReplicationInstance +func (tr *ReplicationInstance) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReplicationInstance +func (tr *ReplicationInstance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReplicationInstance +func (tr *ReplicationInstance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReplicationInstance +func (tr *ReplicationInstance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReplicationInstance +func (tr *ReplicationInstance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReplicationInstance +func (tr *ReplicationInstance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReplicationInstance +func (tr *ReplicationInstance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReplicationInstance +func (tr *ReplicationInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReplicationInstance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReplicationInstance) LateInitialize(attrs []byte) (bool, error) { + params := &ReplicationInstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReplicationInstance) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dms/v1beta1/zz_replicationinstance_types.go b/apis/dms/v1beta1/zz_replicationinstance_types.go index 9f89b32d85..dcf6ac61cb 100755 --- a/apis/dms/v1beta1/zz_replicationinstance_types.go +++ b/apis/dms/v1beta1/zz_replicationinstance_types.go @@ -276,13 +276,14 @@ type ReplicationInstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReplicationInstance is the Schema for the ReplicationInstances API. Provides a DMS (Data Migration Service) replication instance resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReplicationInstance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dms/v1beta1/zz_replicationsubnetgroup_terraformed.go b/apis/dms/v1beta1/zz_replicationsubnetgroup_terraformed.go new file mode 100755 index 0000000000..372a709d7c --- /dev/null +++ b/apis/dms/v1beta1/zz_replicationsubnetgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReplicationSubnetGroup +func (mg *ReplicationSubnetGroup) GetTerraformResourceType() string { + return "aws_dms_replication_subnet_group" +} + +// GetConnectionDetailsMapping for this ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReplicationSubnetGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReplicationSubnetGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ReplicationSubnetGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReplicationSubnetGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dms/v1beta1/zz_replicationsubnetgroup_types.go b/apis/dms/v1beta1/zz_replicationsubnetgroup_types.go index ab58603da2..80ab08d47f 100755 --- a/apis/dms/v1beta1/zz_replicationsubnetgroup_types.go +++ b/apis/dms/v1beta1/zz_replicationsubnetgroup_types.go @@ -123,13 +123,14 @@ type ReplicationSubnetGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReplicationSubnetGroup is the Schema for the ReplicationSubnetGroups API. Provides a DMS (Data Migration Service) subnet group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReplicationSubnetGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dms/v1beta1/zz_replicationtask_terraformed.go b/apis/dms/v1beta1/zz_replicationtask_terraformed.go new file mode 100755 index 0000000000..509c26a79d --- /dev/null +++ b/apis/dms/v1beta1/zz_replicationtask_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReplicationTask +func (mg *ReplicationTask) GetTerraformResourceType() string { + return "aws_dms_replication_task" +} + +// GetConnectionDetailsMapping for this ReplicationTask +func (tr *ReplicationTask) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReplicationTask +func (tr *ReplicationTask) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReplicationTask +func (tr *ReplicationTask) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReplicationTask +func (tr *ReplicationTask) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReplicationTask +func (tr *ReplicationTask) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReplicationTask +func (tr *ReplicationTask) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReplicationTask +func (tr *ReplicationTask) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReplicationTask +func (tr *ReplicationTask) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReplicationTask using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReplicationTask) LateInitialize(attrs []byte) (bool, error) { + params := &ReplicationTaskParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReplicationTask) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dms/v1beta1/zz_replicationtask_types.go b/apis/dms/v1beta1/zz_replicationtask_types.go index c5d3d851bf..c0477ebdc4 100755 --- a/apis/dms/v1beta1/zz_replicationtask_types.go +++ b/apis/dms/v1beta1/zz_replicationtask_types.go @@ -230,13 +230,14 @@ type ReplicationTaskStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReplicationTask is the Schema for the ReplicationTasks API. Provides a DMS (Data Migration Service) replication task resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReplicationTask struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dms/v1beta1/zz_s3endpoint_terraformed.go b/apis/dms/v1beta1/zz_s3endpoint_terraformed.go new file mode 100755 index 0000000000..0afb58e8d5 --- /dev/null +++ b/apis/dms/v1beta1/zz_s3endpoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this S3Endpoint +func (mg *S3Endpoint) GetTerraformResourceType() string { + return "aws_dms_s3_endpoint" +} + +// GetConnectionDetailsMapping for this S3Endpoint +func (tr *S3Endpoint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this S3Endpoint +func (tr *S3Endpoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this S3Endpoint +func (tr *S3Endpoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this S3Endpoint +func (tr *S3Endpoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this S3Endpoint +func (tr *S3Endpoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this S3Endpoint +func (tr *S3Endpoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this S3Endpoint +func (tr *S3Endpoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this S3Endpoint +func (tr *S3Endpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this S3Endpoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *S3Endpoint) LateInitialize(attrs []byte) (bool, error) { + params := &S3EndpointParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *S3Endpoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dms/v1beta1/zz_s3endpoint_types.go b/apis/dms/v1beta1/zz_s3endpoint_types.go index fdd1556f32..a890ddb0f5 100755 --- a/apis/dms/v1beta1/zz_s3endpoint_types.go +++ b/apis/dms/v1beta1/zz_s3endpoint_types.go @@ -594,13 +594,14 @@ type S3EndpointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // S3Endpoint is the Schema for the S3Endpoints API. Provides a DMS (Data Migration Service) S3 endpoint resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type S3Endpoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/docdb/v1beta1/zz_cluster_terraformed.go b/apis/docdb/v1beta1/zz_cluster_terraformed.go new file mode 100755 index 0000000000..b84feafabc --- /dev/null +++ b/apis/docdb/v1beta1/zz_cluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cluster +func (mg *Cluster) GetTerraformResourceType() string { + return "aws_docdb_cluster" +} + +// GetConnectionDetailsMapping for this Cluster +func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"master_password": "spec.forProvider.masterPasswordSecretRef"} +} + +// GetObservation of this Cluster +func (tr *Cluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cluster +func (tr *Cluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cluster +func (tr *Cluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cluster +func (tr *Cluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cluster +func (tr *Cluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/docdb/v1beta1/zz_cluster_types.go b/apis/docdb/v1beta1/zz_cluster_types.go index ee956aae79..1231160b9c 100755 --- a/apis/docdb/v1beta1/zz_cluster_types.go +++ b/apis/docdb/v1beta1/zz_cluster_types.go @@ -369,13 +369,14 @@ type ClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cluster is the Schema for the Clusters API. Manages a DocumentDB Aurora Cluster // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/docdb/v1beta1/zz_clusterinstance_terraformed.go b/apis/docdb/v1beta1/zz_clusterinstance_terraformed.go new file mode 100755 index 0000000000..1c0c7a8c81 --- /dev/null +++ b/apis/docdb/v1beta1/zz_clusterinstance_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterInstance +func (mg *ClusterInstance) GetTerraformResourceType() string { + return "aws_docdb_cluster_instance" +} + +// GetConnectionDetailsMapping for this ClusterInstance +func (tr *ClusterInstance) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterInstance +func (tr *ClusterInstance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterInstance +func (tr *ClusterInstance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterInstance +func (tr *ClusterInstance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterInstance +func (tr *ClusterInstance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterInstance +func (tr *ClusterInstance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterInstance +func (tr *ClusterInstance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterInstance +func (tr *ClusterInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterInstance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterInstance) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterInstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterInstance) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/docdb/v1beta1/zz_clusterinstance_types.go b/apis/docdb/v1beta1/zz_clusterinstance_types.go index a67d2d9d75..c099ce7313 100755 --- a/apis/docdb/v1beta1/zz_clusterinstance_types.go +++ b/apis/docdb/v1beta1/zz_clusterinstance_types.go @@ -246,13 +246,14 @@ type ClusterInstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterInstance is the Schema for the ClusterInstances API. Provides an DocumentDB Cluster Resource Instance // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterInstance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/docdb/v1beta1/zz_clusterparametergroup_terraformed.go b/apis/docdb/v1beta1/zz_clusterparametergroup_terraformed.go new file mode 100755 index 0000000000..27e227aa8e --- /dev/null +++ b/apis/docdb/v1beta1/zz_clusterparametergroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterParameterGroup +func (mg *ClusterParameterGroup) GetTerraformResourceType() string { + return "aws_docdb_cluster_parameter_group" +} + +// GetConnectionDetailsMapping for this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterParameterGroup +func (tr *ClusterParameterGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterParameterGroup +func (tr *ClusterParameterGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterParameterGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterParameterGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameterGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterParameterGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/docdb/v1beta1/zz_clusterparametergroup_types.go b/apis/docdb/v1beta1/zz_clusterparametergroup_types.go index c426d49192..a11d7729ff 100755 --- a/apis/docdb/v1beta1/zz_clusterparametergroup_types.go +++ b/apis/docdb/v1beta1/zz_clusterparametergroup_types.go @@ -147,13 +147,14 @@ type ClusterParameterGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterParameterGroup is the Schema for the ClusterParameterGroups API. Manages a DocumentDB Cluster Parameter Group // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterParameterGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/docdb/v1beta1/zz_clustersnapshot_terraformed.go b/apis/docdb/v1beta1/zz_clustersnapshot_terraformed.go new file mode 100755 index 0000000000..826a2103df --- /dev/null +++ b/apis/docdb/v1beta1/zz_clustersnapshot_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterSnapshot +func (mg *ClusterSnapshot) GetTerraformResourceType() string { + return "aws_docdb_cluster_snapshot" +} + +// GetConnectionDetailsMapping for this ClusterSnapshot +func (tr *ClusterSnapshot) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterSnapshot +func (tr *ClusterSnapshot) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterSnapshot +func (tr *ClusterSnapshot) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterSnapshot +func (tr *ClusterSnapshot) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterSnapshot +func (tr *ClusterSnapshot) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterSnapshot +func (tr *ClusterSnapshot) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterSnapshot +func (tr *ClusterSnapshot) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterSnapshot +func (tr *ClusterSnapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterSnapshot using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterSnapshot) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterSnapshotParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterSnapshot) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/docdb/v1beta1/zz_clustersnapshot_types.go b/apis/docdb/v1beta1/zz_clustersnapshot_types.go index cfb87243f2..fcd80a75de 100755 --- a/apis/docdb/v1beta1/zz_clustersnapshot_types.go +++ b/apis/docdb/v1beta1/zz_clustersnapshot_types.go @@ -119,13 +119,14 @@ type ClusterSnapshotStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterSnapshot is the Schema for the ClusterSnapshots API. Manages a DocumentDB database cluster snapshot. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterSnapshot struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/docdb/v1beta1/zz_eventsubscription_terraformed.go b/apis/docdb/v1beta1/zz_eventsubscription_terraformed.go new file mode 100755 index 0000000000..babf3d6747 --- /dev/null +++ b/apis/docdb/v1beta1/zz_eventsubscription_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EventSubscription +func (mg *EventSubscription) GetTerraformResourceType() string { + return "aws_docdb_event_subscription" +} + +// GetConnectionDetailsMapping for this EventSubscription +func (tr *EventSubscription) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EventSubscription +func (tr *EventSubscription) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EventSubscription +func (tr *EventSubscription) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EventSubscription +func (tr *EventSubscription) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EventSubscription +func (tr *EventSubscription) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EventSubscription +func (tr *EventSubscription) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EventSubscription +func (tr *EventSubscription) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EventSubscription +func (tr *EventSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EventSubscription using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EventSubscription) LateInitialize(attrs []byte) (bool, error) { + params := &EventSubscriptionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EventSubscription) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/docdb/v1beta1/zz_eventsubscription_types.go b/apis/docdb/v1beta1/zz_eventsubscription_types.go index 1185d98005..2044380df9 100755 --- a/apis/docdb/v1beta1/zz_eventsubscription_types.go +++ b/apis/docdb/v1beta1/zz_eventsubscription_types.go @@ -157,13 +157,14 @@ type EventSubscriptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EventSubscription is the Schema for the EventSubscriptions API. Provides a DocumentDB event subscription resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EventSubscription struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/docdb/v1beta1/zz_generated.conversion_hubs.go b/apis/docdb/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..f33eb18cbc --- /dev/null +++ b/apis/docdb/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Cluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterInstance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterParameterGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterSnapshot) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EventSubscription) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GlobalCluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SubnetGroup) Hub() {} diff --git a/apis/docdb/v1beta1/zz_generated_terraformed.go b/apis/docdb/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 971fc6e5c9..0000000000 --- a/apis/docdb/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,817 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Cluster -func (mg *Cluster) GetTerraformResourceType() string { - return "aws_docdb_cluster" -} - -// GetConnectionDetailsMapping for this Cluster -func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"master_password": "spec.forProvider.masterPasswordSecretRef"} -} - -// GetObservation of this Cluster -func (tr *Cluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cluster -func (tr *Cluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cluster -func (tr *Cluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cluster -func (tr *Cluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cluster -func (tr *Cluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterInstance -func (mg *ClusterInstance) GetTerraformResourceType() string { - return "aws_docdb_cluster_instance" -} - -// GetConnectionDetailsMapping for this ClusterInstance -func (tr *ClusterInstance) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterInstance -func (tr *ClusterInstance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterInstance -func (tr *ClusterInstance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterInstance -func (tr *ClusterInstance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterInstance -func (tr *ClusterInstance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterInstance -func (tr *ClusterInstance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterInstance -func (tr *ClusterInstance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterInstance -func (tr *ClusterInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterInstance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterInstance) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterInstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterInstance) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterParameterGroup -func (mg *ClusterParameterGroup) GetTerraformResourceType() string { - return "aws_docdb_cluster_parameter_group" -} - -// GetConnectionDetailsMapping for this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterParameterGroup -func (tr *ClusterParameterGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterParameterGroup -func (tr *ClusterParameterGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterParameterGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterParameterGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameterGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterParameterGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterSnapshot -func (mg *ClusterSnapshot) GetTerraformResourceType() string { - return "aws_docdb_cluster_snapshot" -} - -// GetConnectionDetailsMapping for this ClusterSnapshot -func (tr *ClusterSnapshot) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterSnapshot -func (tr *ClusterSnapshot) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterSnapshot -func (tr *ClusterSnapshot) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterSnapshot -func (tr *ClusterSnapshot) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterSnapshot -func (tr *ClusterSnapshot) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterSnapshot -func (tr *ClusterSnapshot) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterSnapshot -func (tr *ClusterSnapshot) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterSnapshot -func (tr *ClusterSnapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterSnapshot using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterSnapshot) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterSnapshotParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterSnapshot) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EventSubscription -func (mg *EventSubscription) GetTerraformResourceType() string { - return "aws_docdb_event_subscription" -} - -// GetConnectionDetailsMapping for this EventSubscription -func (tr *EventSubscription) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EventSubscription -func (tr *EventSubscription) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EventSubscription -func (tr *EventSubscription) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EventSubscription -func (tr *EventSubscription) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EventSubscription -func (tr *EventSubscription) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EventSubscription -func (tr *EventSubscription) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EventSubscription -func (tr *EventSubscription) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EventSubscription -func (tr *EventSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EventSubscription using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EventSubscription) LateInitialize(attrs []byte) (bool, error) { - params := &EventSubscriptionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EventSubscription) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GlobalCluster -func (mg *GlobalCluster) GetTerraformResourceType() string { - return "aws_docdb_global_cluster" -} - -// GetConnectionDetailsMapping for this GlobalCluster -func (tr *GlobalCluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GlobalCluster -func (tr *GlobalCluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GlobalCluster -func (tr *GlobalCluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GlobalCluster -func (tr *GlobalCluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GlobalCluster -func (tr *GlobalCluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GlobalCluster -func (tr *GlobalCluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GlobalCluster -func (tr *GlobalCluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GlobalCluster -func (tr *GlobalCluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GlobalCluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GlobalCluster) LateInitialize(attrs []byte) (bool, error) { - params := &GlobalClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GlobalCluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SubnetGroup -func (mg *SubnetGroup) GetTerraformResourceType() string { - return "aws_docdb_subnet_group" -} - -// GetConnectionDetailsMapping for this SubnetGroup -func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SubnetGroup -func (tr *SubnetGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SubnetGroup -func (tr *SubnetGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SubnetGroup -func (tr *SubnetGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SubnetGroup -func (tr *SubnetGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SubnetGroup -func (tr *SubnetGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SubnetGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { - params := &SubnetGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SubnetGroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/docdb/v1beta1/zz_globalcluster_terraformed.go b/apis/docdb/v1beta1/zz_globalcluster_terraformed.go new file mode 100755 index 0000000000..8c33d71302 --- /dev/null +++ b/apis/docdb/v1beta1/zz_globalcluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GlobalCluster +func (mg *GlobalCluster) GetTerraformResourceType() string { + return "aws_docdb_global_cluster" +} + +// GetConnectionDetailsMapping for this GlobalCluster +func (tr *GlobalCluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GlobalCluster +func (tr *GlobalCluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GlobalCluster +func (tr *GlobalCluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GlobalCluster +func (tr *GlobalCluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GlobalCluster +func (tr *GlobalCluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GlobalCluster +func (tr *GlobalCluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GlobalCluster +func (tr *GlobalCluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GlobalCluster +func (tr *GlobalCluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GlobalCluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GlobalCluster) LateInitialize(attrs []byte) (bool, error) { + params := &GlobalClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GlobalCluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/docdb/v1beta1/zz_globalcluster_types.go b/apis/docdb/v1beta1/zz_globalcluster_types.go index 381004df69..207d89f3a6 100755 --- a/apis/docdb/v1beta1/zz_globalcluster_types.go +++ b/apis/docdb/v1beta1/zz_globalcluster_types.go @@ -174,13 +174,14 @@ type GlobalClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GlobalCluster is the Schema for the GlobalClusters API. Manages a DocumentDB Global Cluster // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GlobalCluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/docdb/v1beta1/zz_subnetgroup_terraformed.go b/apis/docdb/v1beta1/zz_subnetgroup_terraformed.go new file mode 100755 index 0000000000..e4744a2d9e --- /dev/null +++ b/apis/docdb/v1beta1/zz_subnetgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SubnetGroup +func (mg *SubnetGroup) GetTerraformResourceType() string { + return "aws_docdb_subnet_group" +} + +// GetConnectionDetailsMapping for this SubnetGroup +func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SubnetGroup +func (tr *SubnetGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SubnetGroup +func (tr *SubnetGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SubnetGroup +func (tr *SubnetGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SubnetGroup +func (tr *SubnetGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SubnetGroup +func (tr *SubnetGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SubnetGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { + params := &SubnetGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SubnetGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/docdb/v1beta1/zz_subnetgroup_types.go b/apis/docdb/v1beta1/zz_subnetgroup_types.go index adebf66178..19bed909d8 100755 --- a/apis/docdb/v1beta1/zz_subnetgroup_types.go +++ b/apis/docdb/v1beta1/zz_subnetgroup_types.go @@ -119,13 +119,14 @@ type SubnetGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SubnetGroup is the Schema for the SubnetGroups API. Provides an DocumentDB subnet group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SubnetGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ds/v1beta1/zz_conditionalforwarder_terraformed.go b/apis/ds/v1beta1/zz_conditionalforwarder_terraformed.go new file mode 100755 index 0000000000..7b5e3a201c --- /dev/null +++ b/apis/ds/v1beta1/zz_conditionalforwarder_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConditionalForwarder +func (mg *ConditionalForwarder) GetTerraformResourceType() string { + return "aws_directory_service_conditional_forwarder" +} + +// GetConnectionDetailsMapping for this ConditionalForwarder +func (tr *ConditionalForwarder) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ConditionalForwarder +func (tr *ConditionalForwarder) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConditionalForwarder +func (tr *ConditionalForwarder) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConditionalForwarder +func (tr *ConditionalForwarder) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConditionalForwarder +func (tr *ConditionalForwarder) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConditionalForwarder +func (tr *ConditionalForwarder) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConditionalForwarder +func (tr *ConditionalForwarder) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConditionalForwarder +func (tr *ConditionalForwarder) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConditionalForwarder using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConditionalForwarder) LateInitialize(attrs []byte) (bool, error) { + params := &ConditionalForwarderParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConditionalForwarder) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ds/v1beta1/zz_conditionalforwarder_types.go b/apis/ds/v1beta1/zz_conditionalforwarder_types.go index 5241c20ff3..37d2bb6bf1 100755 --- a/apis/ds/v1beta1/zz_conditionalforwarder_types.go +++ b/apis/ds/v1beta1/zz_conditionalforwarder_types.go @@ -91,13 +91,14 @@ type ConditionalForwarderStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConditionalForwarder is the Schema for the ConditionalForwarders API. Provides a conditional forwarder for managed Microsoft AD in AWS Directory Service. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConditionalForwarder struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ds/v1beta1/zz_directory_terraformed.go b/apis/ds/v1beta1/zz_directory_terraformed.go new file mode 100755 index 0000000000..4b4e0d5e42 --- /dev/null +++ b/apis/ds/v1beta1/zz_directory_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Directory +func (mg *Directory) GetTerraformResourceType() string { + return "aws_directory_service_directory" +} + +// GetConnectionDetailsMapping for this Directory +func (tr *Directory) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"password": "spec.forProvider.passwordSecretRef"} +} + +// GetObservation of this Directory +func (tr *Directory) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Directory +func (tr *Directory) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Directory +func (tr *Directory) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Directory +func (tr *Directory) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Directory +func (tr *Directory) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Directory +func (tr *Directory) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Directory +func (tr *Directory) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Directory using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Directory) LateInitialize(attrs []byte) (bool, error) { + params := &DirectoryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Directory) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ds/v1beta1/zz_directory_types.go b/apis/ds/v1beta1/zz_directory_types.go index 76cfd45ce7..e155efb39d 100755 --- a/apis/ds/v1beta1/zz_directory_types.go +++ b/apis/ds/v1beta1/zz_directory_types.go @@ -372,13 +372,14 @@ type DirectoryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Directory is the Schema for the Directorys API. Provides a directory in AWS Directory Service. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Directory struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ds/v1beta1/zz_generated.conversion_hubs.go b/apis/ds/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..2ac4d45133 --- /dev/null +++ b/apis/ds/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ConditionalForwarder) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Directory) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SharedDirectory) Hub() {} diff --git a/apis/ds/v1beta1/zz_generated_terraformed.go b/apis/ds/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 5046b52da1..0000000000 --- a/apis/ds/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this ConditionalForwarder -func (mg *ConditionalForwarder) GetTerraformResourceType() string { - return "aws_directory_service_conditional_forwarder" -} - -// GetConnectionDetailsMapping for this ConditionalForwarder -func (tr *ConditionalForwarder) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ConditionalForwarder -func (tr *ConditionalForwarder) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConditionalForwarder -func (tr *ConditionalForwarder) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConditionalForwarder -func (tr *ConditionalForwarder) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConditionalForwarder -func (tr *ConditionalForwarder) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConditionalForwarder -func (tr *ConditionalForwarder) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConditionalForwarder -func (tr *ConditionalForwarder) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConditionalForwarder -func (tr *ConditionalForwarder) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConditionalForwarder using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConditionalForwarder) LateInitialize(attrs []byte) (bool, error) { - params := &ConditionalForwarderParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConditionalForwarder) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Directory -func (mg *Directory) GetTerraformResourceType() string { - return "aws_directory_service_directory" -} - -// GetConnectionDetailsMapping for this Directory -func (tr *Directory) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"password": "spec.forProvider.passwordSecretRef"} -} - -// GetObservation of this Directory -func (tr *Directory) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Directory -func (tr *Directory) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Directory -func (tr *Directory) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Directory -func (tr *Directory) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Directory -func (tr *Directory) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Directory -func (tr *Directory) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Directory -func (tr *Directory) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Directory using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Directory) LateInitialize(attrs []byte) (bool, error) { - params := &DirectoryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Directory) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SharedDirectory -func (mg *SharedDirectory) GetTerraformResourceType() string { - return "aws_directory_service_shared_directory" -} - -// GetConnectionDetailsMapping for this SharedDirectory -func (tr *SharedDirectory) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"notes": "spec.forProvider.notesSecretRef"} -} - -// GetObservation of this SharedDirectory -func (tr *SharedDirectory) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SharedDirectory -func (tr *SharedDirectory) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SharedDirectory -func (tr *SharedDirectory) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SharedDirectory -func (tr *SharedDirectory) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SharedDirectory -func (tr *SharedDirectory) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SharedDirectory -func (tr *SharedDirectory) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SharedDirectory -func (tr *SharedDirectory) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SharedDirectory using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SharedDirectory) LateInitialize(attrs []byte) (bool, error) { - params := &SharedDirectoryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SharedDirectory) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/ds/v1beta1/zz_shareddirectory_terraformed.go b/apis/ds/v1beta1/zz_shareddirectory_terraformed.go new file mode 100755 index 0000000000..0ea6cbcc52 --- /dev/null +++ b/apis/ds/v1beta1/zz_shareddirectory_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SharedDirectory +func (mg *SharedDirectory) GetTerraformResourceType() string { + return "aws_directory_service_shared_directory" +} + +// GetConnectionDetailsMapping for this SharedDirectory +func (tr *SharedDirectory) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"notes": "spec.forProvider.notesSecretRef"} +} + +// GetObservation of this SharedDirectory +func (tr *SharedDirectory) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SharedDirectory +func (tr *SharedDirectory) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SharedDirectory +func (tr *SharedDirectory) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SharedDirectory +func (tr *SharedDirectory) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SharedDirectory +func (tr *SharedDirectory) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SharedDirectory +func (tr *SharedDirectory) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SharedDirectory +func (tr *SharedDirectory) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SharedDirectory using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SharedDirectory) LateInitialize(attrs []byte) (bool, error) { + params := &SharedDirectoryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SharedDirectory) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ds/v1beta1/zz_shareddirectory_types.go b/apis/ds/v1beta1/zz_shareddirectory_types.go index 510a81da41..afb9480272 100755 --- a/apis/ds/v1beta1/zz_shareddirectory_types.go +++ b/apis/ds/v1beta1/zz_shareddirectory_types.go @@ -144,13 +144,14 @@ type SharedDirectoryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SharedDirectory is the Schema for the SharedDirectorys API. Manages a directory in your account (directory owner) shared with another account (directory consumer). // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SharedDirectory struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dynamodb/v1beta1/zz_contributorinsights_terraformed.go b/apis/dynamodb/v1beta1/zz_contributorinsights_terraformed.go new file mode 100755 index 0000000000..60dd4507f5 --- /dev/null +++ b/apis/dynamodb/v1beta1/zz_contributorinsights_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ContributorInsights +func (mg *ContributorInsights) GetTerraformResourceType() string { + return "aws_dynamodb_contributor_insights" +} + +// GetConnectionDetailsMapping for this ContributorInsights +func (tr *ContributorInsights) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ContributorInsights +func (tr *ContributorInsights) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ContributorInsights +func (tr *ContributorInsights) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ContributorInsights +func (tr *ContributorInsights) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ContributorInsights +func (tr *ContributorInsights) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ContributorInsights +func (tr *ContributorInsights) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ContributorInsights +func (tr *ContributorInsights) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ContributorInsights +func (tr *ContributorInsights) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ContributorInsights using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ContributorInsights) LateInitialize(attrs []byte) (bool, error) { + params := &ContributorInsightsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ContributorInsights) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dynamodb/v1beta1/zz_contributorinsights_types.go b/apis/dynamodb/v1beta1/zz_contributorinsights_types.go index c289a569a9..a188bb59a3 100755 --- a/apis/dynamodb/v1beta1/zz_contributorinsights_types.go +++ b/apis/dynamodb/v1beta1/zz_contributorinsights_types.go @@ -94,13 +94,14 @@ type ContributorInsightsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ContributorInsights is the Schema for the ContributorInsightss API. Provides a DynamoDB contributor insights resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ContributorInsights struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dynamodb/v1beta1/zz_generated.conversion_hubs.go b/apis/dynamodb/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..1f41b8c844 --- /dev/null +++ b/apis/dynamodb/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ContributorInsights) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GlobalTable) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *KinesisStreamingDestination) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Table) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TableItem) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TableReplica) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Tag) Hub() {} diff --git a/apis/dynamodb/v1beta1/zz_generated_terraformed.go b/apis/dynamodb/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index d1e17f716e..0000000000 --- a/apis/dynamodb/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,817 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this ContributorInsights -func (mg *ContributorInsights) GetTerraformResourceType() string { - return "aws_dynamodb_contributor_insights" -} - -// GetConnectionDetailsMapping for this ContributorInsights -func (tr *ContributorInsights) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ContributorInsights -func (tr *ContributorInsights) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ContributorInsights -func (tr *ContributorInsights) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ContributorInsights -func (tr *ContributorInsights) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ContributorInsights -func (tr *ContributorInsights) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ContributorInsights -func (tr *ContributorInsights) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ContributorInsights -func (tr *ContributorInsights) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ContributorInsights -func (tr *ContributorInsights) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ContributorInsights using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ContributorInsights) LateInitialize(attrs []byte) (bool, error) { - params := &ContributorInsightsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ContributorInsights) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GlobalTable -func (mg *GlobalTable) GetTerraformResourceType() string { - return "aws_dynamodb_global_table" -} - -// GetConnectionDetailsMapping for this GlobalTable -func (tr *GlobalTable) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GlobalTable -func (tr *GlobalTable) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GlobalTable -func (tr *GlobalTable) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GlobalTable -func (tr *GlobalTable) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GlobalTable -func (tr *GlobalTable) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GlobalTable -func (tr *GlobalTable) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GlobalTable -func (tr *GlobalTable) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GlobalTable -func (tr *GlobalTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GlobalTable using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GlobalTable) LateInitialize(attrs []byte) (bool, error) { - params := &GlobalTableParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GlobalTable) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this KinesisStreamingDestination -func (mg *KinesisStreamingDestination) GetTerraformResourceType() string { - return "aws_dynamodb_kinesis_streaming_destination" -} - -// GetConnectionDetailsMapping for this KinesisStreamingDestination -func (tr *KinesisStreamingDestination) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this KinesisStreamingDestination -func (tr *KinesisStreamingDestination) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this KinesisStreamingDestination -func (tr *KinesisStreamingDestination) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this KinesisStreamingDestination -func (tr *KinesisStreamingDestination) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this KinesisStreamingDestination -func (tr *KinesisStreamingDestination) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this KinesisStreamingDestination -func (tr *KinesisStreamingDestination) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this KinesisStreamingDestination -func (tr *KinesisStreamingDestination) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this KinesisStreamingDestination -func (tr *KinesisStreamingDestination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this KinesisStreamingDestination using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *KinesisStreamingDestination) LateInitialize(attrs []byte) (bool, error) { - params := &KinesisStreamingDestinationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *KinesisStreamingDestination) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Table -func (mg *Table) GetTerraformResourceType() string { - return "aws_dynamodb_table" -} - -// GetConnectionDetailsMapping for this Table -func (tr *Table) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Table -func (tr *Table) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Table -func (tr *Table) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Table -func (tr *Table) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Table -func (tr *Table) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Table -func (tr *Table) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Table -func (tr *Table) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Table -func (tr *Table) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Table using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Table) LateInitialize(attrs []byte) (bool, error) { - params := &TableParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Table) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this TableItem -func (mg *TableItem) GetTerraformResourceType() string { - return "aws_dynamodb_table_item" -} - -// GetConnectionDetailsMapping for this TableItem -func (tr *TableItem) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TableItem -func (tr *TableItem) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TableItem -func (tr *TableItem) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TableItem -func (tr *TableItem) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TableItem -func (tr *TableItem) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TableItem -func (tr *TableItem) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TableItem -func (tr *TableItem) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TableItem -func (tr *TableItem) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TableItem using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TableItem) LateInitialize(attrs []byte) (bool, error) { - params := &TableItemParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TableItem) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TableReplica -func (mg *TableReplica) GetTerraformResourceType() string { - return "aws_dynamodb_table_replica" -} - -// GetConnectionDetailsMapping for this TableReplica -func (tr *TableReplica) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TableReplica -func (tr *TableReplica) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TableReplica -func (tr *TableReplica) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TableReplica -func (tr *TableReplica) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TableReplica -func (tr *TableReplica) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TableReplica -func (tr *TableReplica) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TableReplica -func (tr *TableReplica) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TableReplica -func (tr *TableReplica) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TableReplica using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TableReplica) LateInitialize(attrs []byte) (bool, error) { - params := &TableReplicaParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TableReplica) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Tag -func (mg *Tag) GetTerraformResourceType() string { - return "aws_dynamodb_tag" -} - -// GetConnectionDetailsMapping for this Tag -func (tr *Tag) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Tag -func (tr *Tag) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Tag -func (tr *Tag) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Tag -func (tr *Tag) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Tag -func (tr *Tag) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Tag -func (tr *Tag) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Tag -func (tr *Tag) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Tag -func (tr *Tag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Tag using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Tag) LateInitialize(attrs []byte) (bool, error) { - params := &TagParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Tag) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/dynamodb/v1beta1/zz_globaltable_terraformed.go b/apis/dynamodb/v1beta1/zz_globaltable_terraformed.go new file mode 100755 index 0000000000..970bb7911a --- /dev/null +++ b/apis/dynamodb/v1beta1/zz_globaltable_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GlobalTable +func (mg *GlobalTable) GetTerraformResourceType() string { + return "aws_dynamodb_global_table" +} + +// GetConnectionDetailsMapping for this GlobalTable +func (tr *GlobalTable) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GlobalTable +func (tr *GlobalTable) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GlobalTable +func (tr *GlobalTable) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GlobalTable +func (tr *GlobalTable) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GlobalTable +func (tr *GlobalTable) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GlobalTable +func (tr *GlobalTable) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GlobalTable +func (tr *GlobalTable) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GlobalTable +func (tr *GlobalTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GlobalTable using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GlobalTable) LateInitialize(attrs []byte) (bool, error) { + params := &GlobalTableParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GlobalTable) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dynamodb/v1beta1/zz_globaltable_types.go b/apis/dynamodb/v1beta1/zz_globaltable_types.go index d36cfa46f8..f4c8a85fe4 100755 --- a/apis/dynamodb/v1beta1/zz_globaltable_types.go +++ b/apis/dynamodb/v1beta1/zz_globaltable_types.go @@ -90,13 +90,14 @@ type GlobalTableStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GlobalTable is the Schema for the GlobalTables API. Manages DynamoDB Global Tables V1 (version 2017.11.29) // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GlobalTable struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dynamodb/v1beta1/zz_kinesisstreamingdestination_terraformed.go b/apis/dynamodb/v1beta1/zz_kinesisstreamingdestination_terraformed.go new file mode 100755 index 0000000000..3ada4b2408 --- /dev/null +++ b/apis/dynamodb/v1beta1/zz_kinesisstreamingdestination_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this KinesisStreamingDestination +func (mg *KinesisStreamingDestination) GetTerraformResourceType() string { + return "aws_dynamodb_kinesis_streaming_destination" +} + +// GetConnectionDetailsMapping for this KinesisStreamingDestination +func (tr *KinesisStreamingDestination) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this KinesisStreamingDestination +func (tr *KinesisStreamingDestination) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this KinesisStreamingDestination +func (tr *KinesisStreamingDestination) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this KinesisStreamingDestination +func (tr *KinesisStreamingDestination) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this KinesisStreamingDestination +func (tr *KinesisStreamingDestination) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this KinesisStreamingDestination +func (tr *KinesisStreamingDestination) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this KinesisStreamingDestination +func (tr *KinesisStreamingDestination) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this KinesisStreamingDestination +func (tr *KinesisStreamingDestination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this KinesisStreamingDestination using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *KinesisStreamingDestination) LateInitialize(attrs []byte) (bool, error) { + params := &KinesisStreamingDestinationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *KinesisStreamingDestination) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dynamodb/v1beta1/zz_kinesisstreamingdestination_types.go b/apis/dynamodb/v1beta1/zz_kinesisstreamingdestination_types.go index bb2b9681df..c8694cf25d 100755 --- a/apis/dynamodb/v1beta1/zz_kinesisstreamingdestination_types.go +++ b/apis/dynamodb/v1beta1/zz_kinesisstreamingdestination_types.go @@ -119,13 +119,14 @@ type KinesisStreamingDestinationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // KinesisStreamingDestination is the Schema for the KinesisStreamingDestinations API. Enables a Kinesis streaming destination for a DynamoDB table // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type KinesisStreamingDestination struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dynamodb/v1beta1/zz_table_terraformed.go b/apis/dynamodb/v1beta1/zz_table_terraformed.go new file mode 100755 index 0000000000..5e46eddc58 --- /dev/null +++ b/apis/dynamodb/v1beta1/zz_table_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Table +func (mg *Table) GetTerraformResourceType() string { + return "aws_dynamodb_table" +} + +// GetConnectionDetailsMapping for this Table +func (tr *Table) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Table +func (tr *Table) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Table +func (tr *Table) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Table +func (tr *Table) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Table +func (tr *Table) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Table +func (tr *Table) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Table +func (tr *Table) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Table +func (tr *Table) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Table using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Table) LateInitialize(attrs []byte) (bool, error) { + params := &TableParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Table) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/dynamodb/v1beta1/zz_table_types.go b/apis/dynamodb/v1beta1/zz_table_types.go index 012f353c95..d045b40ed4 100755 --- a/apis/dynamodb/v1beta1/zz_table_types.go +++ b/apis/dynamodb/v1beta1/zz_table_types.go @@ -575,13 +575,14 @@ type TableStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Table is the Schema for the Tables API. Provides a DynamoDB table resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Table struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dynamodb/v1beta1/zz_tableitem_terraformed.go b/apis/dynamodb/v1beta1/zz_tableitem_terraformed.go new file mode 100755 index 0000000000..fa09814066 --- /dev/null +++ b/apis/dynamodb/v1beta1/zz_tableitem_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TableItem +func (mg *TableItem) GetTerraformResourceType() string { + return "aws_dynamodb_table_item" +} + +// GetConnectionDetailsMapping for this TableItem +func (tr *TableItem) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TableItem +func (tr *TableItem) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TableItem +func (tr *TableItem) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TableItem +func (tr *TableItem) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TableItem +func (tr *TableItem) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TableItem +func (tr *TableItem) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TableItem +func (tr *TableItem) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TableItem +func (tr *TableItem) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TableItem using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TableItem) LateInitialize(attrs []byte) (bool, error) { + params := &TableItemParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TableItem) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dynamodb/v1beta1/zz_tableitem_types.go b/apis/dynamodb/v1beta1/zz_tableitem_types.go index 0659736790..9c9aa23d71 100755 --- a/apis/dynamodb/v1beta1/zz_tableitem_types.go +++ b/apis/dynamodb/v1beta1/zz_tableitem_types.go @@ -115,13 +115,14 @@ type TableItemStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TableItem is the Schema for the TableItems API. Provides a DynamoDB table item resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TableItem struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dynamodb/v1beta1/zz_tablereplica_terraformed.go b/apis/dynamodb/v1beta1/zz_tablereplica_terraformed.go new file mode 100755 index 0000000000..1a2fd3b6d3 --- /dev/null +++ b/apis/dynamodb/v1beta1/zz_tablereplica_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TableReplica +func (mg *TableReplica) GetTerraformResourceType() string { + return "aws_dynamodb_table_replica" +} + +// GetConnectionDetailsMapping for this TableReplica +func (tr *TableReplica) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TableReplica +func (tr *TableReplica) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TableReplica +func (tr *TableReplica) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TableReplica +func (tr *TableReplica) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TableReplica +func (tr *TableReplica) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TableReplica +func (tr *TableReplica) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TableReplica +func (tr *TableReplica) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TableReplica +func (tr *TableReplica) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TableReplica using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TableReplica) LateInitialize(attrs []byte) (bool, error) { + params := &TableReplicaParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TableReplica) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dynamodb/v1beta1/zz_tablereplica_types.go b/apis/dynamodb/v1beta1/zz_tablereplica_types.go index 44cf2cc9e2..16b0e4d341 100755 --- a/apis/dynamodb/v1beta1/zz_tablereplica_types.go +++ b/apis/dynamodb/v1beta1/zz_tablereplica_types.go @@ -156,13 +156,14 @@ type TableReplicaStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TableReplica is the Schema for the TableReplicas API. Provides a DynamoDB table replica resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TableReplica struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/dynamodb/v1beta1/zz_tag_terraformed.go b/apis/dynamodb/v1beta1/zz_tag_terraformed.go new file mode 100755 index 0000000000..6fca298711 --- /dev/null +++ b/apis/dynamodb/v1beta1/zz_tag_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Tag +func (mg *Tag) GetTerraformResourceType() string { + return "aws_dynamodb_tag" +} + +// GetConnectionDetailsMapping for this Tag +func (tr *Tag) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Tag +func (tr *Tag) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Tag +func (tr *Tag) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Tag +func (tr *Tag) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Tag +func (tr *Tag) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Tag +func (tr *Tag) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Tag +func (tr *Tag) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Tag +func (tr *Tag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Tag using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Tag) LateInitialize(attrs []byte) (bool, error) { + params := &TagParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Tag) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dynamodb/v1beta1/zz_tag_types.go b/apis/dynamodb/v1beta1/zz_tag_types.go index 64bc289ec9..914b77dfc5 100755 --- a/apis/dynamodb/v1beta1/zz_tag_types.go +++ b/apis/dynamodb/v1beta1/zz_tag_types.go @@ -82,13 +82,14 @@ type TagStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Tag is the Schema for the Tags API. Manages an individual DynamoDB resource tag // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Tag struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_ami_terraformed.go b/apis/ec2/v1beta1/zz_ami_terraformed.go new file mode 100755 index 0000000000..3654d70ef0 --- /dev/null +++ b/apis/ec2/v1beta1/zz_ami_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AMI +func (mg *AMI) GetTerraformResourceType() string { + return "aws_ami" +} + +// GetConnectionDetailsMapping for this AMI +func (tr *AMI) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AMI +func (tr *AMI) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AMI +func (tr *AMI) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AMI +func (tr *AMI) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AMI +func (tr *AMI) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AMI +func (tr *AMI) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AMI +func (tr *AMI) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AMI +func (tr *AMI) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AMI using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AMI) LateInitialize(attrs []byte) (bool, error) { + params := &AMIParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AMI) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_ami_types.go b/apis/ec2/v1beta1/zz_ami_types.go index 6b5dc010d8..5cc09f8b54 100755 --- a/apis/ec2/v1beta1/zz_ami_types.go +++ b/apis/ec2/v1beta1/zz_ami_types.go @@ -458,13 +458,14 @@ type AMIStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AMI is the Schema for the AMIs API. Creates and manages a custom Amazon Machine Image (AMI). // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AMI struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_amicopy_terraformed.go b/apis/ec2/v1beta1/zz_amicopy_terraformed.go new file mode 100755 index 0000000000..80d7c75c98 --- /dev/null +++ b/apis/ec2/v1beta1/zz_amicopy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AMICopy +func (mg *AMICopy) GetTerraformResourceType() string { + return "aws_ami_copy" +} + +// GetConnectionDetailsMapping for this AMICopy +func (tr *AMICopy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AMICopy +func (tr *AMICopy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AMICopy +func (tr *AMICopy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AMICopy +func (tr *AMICopy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AMICopy +func (tr *AMICopy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AMICopy +func (tr *AMICopy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AMICopy +func (tr *AMICopy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AMICopy +func (tr *AMICopy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AMICopy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AMICopy) LateInitialize(attrs []byte) (bool, error) { + params := &AMICopyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AMICopy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_amicopy_types.go b/apis/ec2/v1beta1/zz_amicopy_types.go index 39d217f870..19dcdf2000 100755 --- a/apis/ec2/v1beta1/zz_amicopy_types.go +++ b/apis/ec2/v1beta1/zz_amicopy_types.go @@ -300,13 +300,14 @@ type AMICopyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AMICopy is the Schema for the AMICopys API. Duplicates an existing Amazon Machine Image (AMI) // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AMICopy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_amilaunchpermission_terraformed.go b/apis/ec2/v1beta1/zz_amilaunchpermission_terraformed.go new file mode 100755 index 0000000000..e97b68b5cb --- /dev/null +++ b/apis/ec2/v1beta1/zz_amilaunchpermission_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AMILaunchPermission +func (mg *AMILaunchPermission) GetTerraformResourceType() string { + return "aws_ami_launch_permission" +} + +// GetConnectionDetailsMapping for this AMILaunchPermission +func (tr *AMILaunchPermission) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AMILaunchPermission +func (tr *AMILaunchPermission) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AMILaunchPermission +func (tr *AMILaunchPermission) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AMILaunchPermission +func (tr *AMILaunchPermission) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AMILaunchPermission +func (tr *AMILaunchPermission) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AMILaunchPermission +func (tr *AMILaunchPermission) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AMILaunchPermission +func (tr *AMILaunchPermission) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AMILaunchPermission +func (tr *AMILaunchPermission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AMILaunchPermission using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AMILaunchPermission) LateInitialize(attrs []byte) (bool, error) { + params := &AMILaunchPermissionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AMILaunchPermission) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_amilaunchpermission_types.go b/apis/ec2/v1beta1/zz_amilaunchpermission_types.go index 444ea9a4ba..8591c47af4 100755 --- a/apis/ec2/v1beta1/zz_amilaunchpermission_types.go +++ b/apis/ec2/v1beta1/zz_amilaunchpermission_types.go @@ -126,13 +126,14 @@ type AMILaunchPermissionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AMILaunchPermission is the Schema for the AMILaunchPermissions API. Adds a launch permission to an Amazon Machine Image (AMI). // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AMILaunchPermission struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_availabilityzonegroup_terraformed.go b/apis/ec2/v1beta1/zz_availabilityzonegroup_terraformed.go new file mode 100755 index 0000000000..73d0d3ba6c --- /dev/null +++ b/apis/ec2/v1beta1/zz_availabilityzonegroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AvailabilityZoneGroup +func (mg *AvailabilityZoneGroup) GetTerraformResourceType() string { + return "aws_ec2_availability_zone_group" +} + +// GetConnectionDetailsMapping for this AvailabilityZoneGroup +func (tr *AvailabilityZoneGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AvailabilityZoneGroup +func (tr *AvailabilityZoneGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AvailabilityZoneGroup +func (tr *AvailabilityZoneGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AvailabilityZoneGroup +func (tr *AvailabilityZoneGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AvailabilityZoneGroup +func (tr *AvailabilityZoneGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AvailabilityZoneGroup +func (tr *AvailabilityZoneGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AvailabilityZoneGroup +func (tr *AvailabilityZoneGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AvailabilityZoneGroup +func (tr *AvailabilityZoneGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AvailabilityZoneGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AvailabilityZoneGroup) LateInitialize(attrs []byte) (bool, error) { + params := &AvailabilityZoneGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AvailabilityZoneGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_availabilityzonegroup_types.go b/apis/ec2/v1beta1/zz_availabilityzonegroup_types.go index 18996d3b4a..17d6feb564 100755 --- a/apis/ec2/v1beta1/zz_availabilityzonegroup_types.go +++ b/apis/ec2/v1beta1/zz_availabilityzonegroup_types.go @@ -68,13 +68,14 @@ type AvailabilityZoneGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AvailabilityZoneGroup is the Schema for the AvailabilityZoneGroups API. Manages an EC2 Availability Zone Group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AvailabilityZoneGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_capacityreservation_terraformed.go b/apis/ec2/v1beta1/zz_capacityreservation_terraformed.go new file mode 100755 index 0000000000..b4bba75fbd --- /dev/null +++ b/apis/ec2/v1beta1/zz_capacityreservation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CapacityReservation +func (mg *CapacityReservation) GetTerraformResourceType() string { + return "aws_ec2_capacity_reservation" +} + +// GetConnectionDetailsMapping for this CapacityReservation +func (tr *CapacityReservation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CapacityReservation +func (tr *CapacityReservation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CapacityReservation +func (tr *CapacityReservation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CapacityReservation +func (tr *CapacityReservation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CapacityReservation +func (tr *CapacityReservation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CapacityReservation +func (tr *CapacityReservation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CapacityReservation +func (tr *CapacityReservation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CapacityReservation +func (tr *CapacityReservation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CapacityReservation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CapacityReservation) LateInitialize(attrs []byte) (bool, error) { + params := &CapacityReservationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CapacityReservation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_capacityreservation_types.go b/apis/ec2/v1beta1/zz_capacityreservation_types.go index 79f4de8a2f..f9918f6d28 100755 --- a/apis/ec2/v1beta1/zz_capacityreservation_types.go +++ b/apis/ec2/v1beta1/zz_capacityreservation_types.go @@ -201,13 +201,14 @@ type CapacityReservationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CapacityReservation is the Schema for the CapacityReservations API. Provides an EC2 Capacity Reservation. This allows you to reserve capacity for your Amazon EC2 instances in a specific Availability Zone for any duration. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CapacityReservation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_carriergateway_terraformed.go b/apis/ec2/v1beta1/zz_carriergateway_terraformed.go new file mode 100755 index 0000000000..a938957dd2 --- /dev/null +++ b/apis/ec2/v1beta1/zz_carriergateway_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CarrierGateway +func (mg *CarrierGateway) GetTerraformResourceType() string { + return "aws_ec2_carrier_gateway" +} + +// GetConnectionDetailsMapping for this CarrierGateway +func (tr *CarrierGateway) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CarrierGateway +func (tr *CarrierGateway) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CarrierGateway +func (tr *CarrierGateway) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CarrierGateway +func (tr *CarrierGateway) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CarrierGateway +func (tr *CarrierGateway) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CarrierGateway +func (tr *CarrierGateway) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CarrierGateway +func (tr *CarrierGateway) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CarrierGateway +func (tr *CarrierGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CarrierGateway using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CarrierGateway) LateInitialize(attrs []byte) (bool, error) { + params := &CarrierGatewayParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CarrierGateway) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_carriergateway_types.go b/apis/ec2/v1beta1/zz_carriergateway_types.go index fe4b8bf086..3ee062d252 100755 --- a/apis/ec2/v1beta1/zz_carriergateway_types.go +++ b/apis/ec2/v1beta1/zz_carriergateway_types.go @@ -109,13 +109,14 @@ type CarrierGatewayStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CarrierGateway is the Schema for the CarrierGateways API. Manages an EC2 Carrier Gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CarrierGateway struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_customergateway_terraformed.go b/apis/ec2/v1beta1/zz_customergateway_terraformed.go new file mode 100755 index 0000000000..ae669b468a --- /dev/null +++ b/apis/ec2/v1beta1/zz_customergateway_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CustomerGateway +func (mg *CustomerGateway) GetTerraformResourceType() string { + return "aws_customer_gateway" +} + +// GetConnectionDetailsMapping for this CustomerGateway +func (tr *CustomerGateway) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CustomerGateway +func (tr *CustomerGateway) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CustomerGateway +func (tr *CustomerGateway) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CustomerGateway +func (tr *CustomerGateway) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CustomerGateway +func (tr *CustomerGateway) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CustomerGateway +func (tr *CustomerGateway) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CustomerGateway +func (tr *CustomerGateway) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CustomerGateway +func (tr *CustomerGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CustomerGateway using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CustomerGateway) LateInitialize(attrs []byte) (bool, error) { + params := &CustomerGatewayParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CustomerGateway) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_customergateway_types.go b/apis/ec2/v1beta1/zz_customergateway_types.go index a2ef34edc7..c1040f0d04 100755 --- a/apis/ec2/v1beta1/zz_customergateway_types.go +++ b/apis/ec2/v1beta1/zz_customergateway_types.go @@ -131,13 +131,14 @@ type CustomerGatewayStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CustomerGateway is the Schema for the CustomerGateways API. Provides a customer gateway inside a VPC. These objects can be connected to VPN gateways via VPN connections, and allow you to establish tunnels between your network and the VPC. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CustomerGateway struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_defaultnetworkacl_terraformed.go b/apis/ec2/v1beta1/zz_defaultnetworkacl_terraformed.go new file mode 100755 index 0000000000..1e325e5466 --- /dev/null +++ b/apis/ec2/v1beta1/zz_defaultnetworkacl_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DefaultNetworkACL +func (mg *DefaultNetworkACL) GetTerraformResourceType() string { + return "aws_default_network_acl" +} + +// GetConnectionDetailsMapping for this DefaultNetworkACL +func (tr *DefaultNetworkACL) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DefaultNetworkACL +func (tr *DefaultNetworkACL) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DefaultNetworkACL +func (tr *DefaultNetworkACL) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DefaultNetworkACL +func (tr *DefaultNetworkACL) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DefaultNetworkACL +func (tr *DefaultNetworkACL) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DefaultNetworkACL +func (tr *DefaultNetworkACL) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DefaultNetworkACL +func (tr *DefaultNetworkACL) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DefaultNetworkACL +func (tr *DefaultNetworkACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DefaultNetworkACL using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DefaultNetworkACL) LateInitialize(attrs []byte) (bool, error) { + params := &DefaultNetworkACLParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DefaultNetworkACL) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_defaultnetworkacl_types.go b/apis/ec2/v1beta1/zz_defaultnetworkacl_types.go index ff9874cb8c..aa9b19a17c 100755 --- a/apis/ec2/v1beta1/zz_defaultnetworkacl_types.go +++ b/apis/ec2/v1beta1/zz_defaultnetworkacl_types.go @@ -387,13 +387,14 @@ type DefaultNetworkACLStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DefaultNetworkACL is the Schema for the DefaultNetworkACLs API. Manage a default network ACL. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DefaultNetworkACL struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_defaultroutetable_terraformed.go b/apis/ec2/v1beta1/zz_defaultroutetable_terraformed.go new file mode 100755 index 0000000000..d5d002787d --- /dev/null +++ b/apis/ec2/v1beta1/zz_defaultroutetable_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DefaultRouteTable +func (mg *DefaultRouteTable) GetTerraformResourceType() string { + return "aws_default_route_table" +} + +// GetConnectionDetailsMapping for this DefaultRouteTable +func (tr *DefaultRouteTable) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DefaultRouteTable +func (tr *DefaultRouteTable) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DefaultRouteTable +func (tr *DefaultRouteTable) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DefaultRouteTable +func (tr *DefaultRouteTable) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DefaultRouteTable +func (tr *DefaultRouteTable) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DefaultRouteTable +func (tr *DefaultRouteTable) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DefaultRouteTable +func (tr *DefaultRouteTable) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DefaultRouteTable +func (tr *DefaultRouteTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DefaultRouteTable using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DefaultRouteTable) LateInitialize(attrs []byte) (bool, error) { + params := &DefaultRouteTableParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DefaultRouteTable) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_defaultroutetable_types.go b/apis/ec2/v1beta1/zz_defaultroutetable_types.go index 849772479a..69fdbae820 100755 --- a/apis/ec2/v1beta1/zz_defaultroutetable_types.go +++ b/apis/ec2/v1beta1/zz_defaultroutetable_types.go @@ -306,13 +306,14 @@ type DefaultRouteTableStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DefaultRouteTable is the Schema for the DefaultRouteTables API. Provides a resource to manage a default route table of a VPC. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DefaultRouteTable struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_defaultsecuritygroup_terraformed.go b/apis/ec2/v1beta1/zz_defaultsecuritygroup_terraformed.go new file mode 100755 index 0000000000..d3516116dd --- /dev/null +++ b/apis/ec2/v1beta1/zz_defaultsecuritygroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DefaultSecurityGroup +func (mg *DefaultSecurityGroup) GetTerraformResourceType() string { + return "aws_default_security_group" +} + +// GetConnectionDetailsMapping for this DefaultSecurityGroup +func (tr *DefaultSecurityGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DefaultSecurityGroup +func (tr *DefaultSecurityGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DefaultSecurityGroup +func (tr *DefaultSecurityGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DefaultSecurityGroup +func (tr *DefaultSecurityGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DefaultSecurityGroup +func (tr *DefaultSecurityGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DefaultSecurityGroup +func (tr *DefaultSecurityGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DefaultSecurityGroup +func (tr *DefaultSecurityGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DefaultSecurityGroup +func (tr *DefaultSecurityGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DefaultSecurityGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DefaultSecurityGroup) LateInitialize(attrs []byte) (bool, error) { + params := &DefaultSecurityGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DefaultSecurityGroup) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ec2/v1beta1/zz_defaultsecuritygroup_types.go b/apis/ec2/v1beta1/zz_defaultsecuritygroup_types.go index ce3c1c371d..b37394e9bd 100755 --- a/apis/ec2/v1beta1/zz_defaultsecuritygroup_types.go +++ b/apis/ec2/v1beta1/zz_defaultsecuritygroup_types.go @@ -346,13 +346,14 @@ type DefaultSecurityGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DefaultSecurityGroup is the Schema for the DefaultSecurityGroups API. Manage a default security group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DefaultSecurityGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_defaultsubnet_terraformed.go b/apis/ec2/v1beta1/zz_defaultsubnet_terraformed.go new file mode 100755 index 0000000000..42ff4ef9a4 --- /dev/null +++ b/apis/ec2/v1beta1/zz_defaultsubnet_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DefaultSubnet +func (mg *DefaultSubnet) GetTerraformResourceType() string { + return "aws_default_subnet" +} + +// GetConnectionDetailsMapping for this DefaultSubnet +func (tr *DefaultSubnet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DefaultSubnet +func (tr *DefaultSubnet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DefaultSubnet +func (tr *DefaultSubnet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DefaultSubnet +func (tr *DefaultSubnet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DefaultSubnet +func (tr *DefaultSubnet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DefaultSubnet +func (tr *DefaultSubnet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DefaultSubnet +func (tr *DefaultSubnet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DefaultSubnet +func (tr *DefaultSubnet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DefaultSubnet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DefaultSubnet) LateInitialize(attrs []byte) (bool, error) { + params := &DefaultSubnetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DefaultSubnet) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ec2/v1beta1/zz_defaultsubnet_types.go b/apis/ec2/v1beta1/zz_defaultsubnet_types.go index 8ee77e9097..d139c5fa7c 100755 --- a/apis/ec2/v1beta1/zz_defaultsubnet_types.go +++ b/apis/ec2/v1beta1/zz_defaultsubnet_types.go @@ -185,13 +185,14 @@ type DefaultSubnetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DefaultSubnet is the Schema for the DefaultSubnets API. Manage a default subnet resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DefaultSubnet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_defaultvpc_terraformed.go b/apis/ec2/v1beta1/zz_defaultvpc_terraformed.go new file mode 100755 index 0000000000..e3b635329b --- /dev/null +++ b/apis/ec2/v1beta1/zz_defaultvpc_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DefaultVPC +func (mg *DefaultVPC) GetTerraformResourceType() string { + return "aws_default_vpc" +} + +// GetConnectionDetailsMapping for this DefaultVPC +func (tr *DefaultVPC) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DefaultVPC +func (tr *DefaultVPC) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DefaultVPC +func (tr *DefaultVPC) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DefaultVPC +func (tr *DefaultVPC) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DefaultVPC +func (tr *DefaultVPC) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DefaultVPC +func (tr *DefaultVPC) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DefaultVPC +func (tr *DefaultVPC) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DefaultVPC +func (tr *DefaultVPC) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DefaultVPC using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DefaultVPC) LateInitialize(attrs []byte) (bool, error) { + params := &DefaultVPCParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DefaultVPC) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ec2/v1beta1/zz_defaultvpc_types.go b/apis/ec2/v1beta1/zz_defaultvpc_types.go index aeef49bc14..405e32af30 100755 --- a/apis/ec2/v1beta1/zz_defaultvpc_types.go +++ b/apis/ec2/v1beta1/zz_defaultvpc_types.go @@ -182,13 +182,14 @@ type DefaultVPCStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DefaultVPC is the Schema for the DefaultVPCs API. Manage a default VPC resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DefaultVPC struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_defaultvpcdhcpoptions_terraformed.go b/apis/ec2/v1beta1/zz_defaultvpcdhcpoptions_terraformed.go new file mode 100755 index 0000000000..d6855b0f62 --- /dev/null +++ b/apis/ec2/v1beta1/zz_defaultvpcdhcpoptions_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DefaultVPCDHCPOptions +func (mg *DefaultVPCDHCPOptions) GetTerraformResourceType() string { + return "aws_default_vpc_dhcp_options" +} + +// GetConnectionDetailsMapping for this DefaultVPCDHCPOptions +func (tr *DefaultVPCDHCPOptions) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DefaultVPCDHCPOptions +func (tr *DefaultVPCDHCPOptions) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DefaultVPCDHCPOptions +func (tr *DefaultVPCDHCPOptions) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DefaultVPCDHCPOptions +func (tr *DefaultVPCDHCPOptions) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DefaultVPCDHCPOptions +func (tr *DefaultVPCDHCPOptions) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DefaultVPCDHCPOptions +func (tr *DefaultVPCDHCPOptions) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DefaultVPCDHCPOptions +func (tr *DefaultVPCDHCPOptions) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DefaultVPCDHCPOptions +func (tr *DefaultVPCDHCPOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DefaultVPCDHCPOptions using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DefaultVPCDHCPOptions) LateInitialize(attrs []byte) (bool, error) { + params := &DefaultVPCDHCPOptionsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DefaultVPCDHCPOptions) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_defaultvpcdhcpoptions_types.go b/apis/ec2/v1beta1/zz_defaultvpcdhcpoptions_types.go index a5609f4e1d..ebb6ef4bc8 100755 --- a/apis/ec2/v1beta1/zz_defaultvpcdhcpoptions_types.go +++ b/apis/ec2/v1beta1/zz_defaultvpcdhcpoptions_types.go @@ -99,13 +99,14 @@ type DefaultVPCDHCPOptionsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DefaultVPCDHCPOptions is the Schema for the DefaultVPCDHCPOptionss API. Manage the default VPC DHCP Options resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DefaultVPCDHCPOptions struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_ebsdefaultkmskey_terraformed.go b/apis/ec2/v1beta1/zz_ebsdefaultkmskey_terraformed.go new file mode 100755 index 0000000000..489ced3c2f --- /dev/null +++ b/apis/ec2/v1beta1/zz_ebsdefaultkmskey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EBSDefaultKMSKey +func (mg *EBSDefaultKMSKey) GetTerraformResourceType() string { + return "aws_ebs_default_kms_key" +} + +// GetConnectionDetailsMapping for this EBSDefaultKMSKey +func (tr *EBSDefaultKMSKey) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EBSDefaultKMSKey +func (tr *EBSDefaultKMSKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EBSDefaultKMSKey +func (tr *EBSDefaultKMSKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EBSDefaultKMSKey +func (tr *EBSDefaultKMSKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EBSDefaultKMSKey +func (tr *EBSDefaultKMSKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EBSDefaultKMSKey +func (tr *EBSDefaultKMSKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EBSDefaultKMSKey +func (tr *EBSDefaultKMSKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EBSDefaultKMSKey +func (tr *EBSDefaultKMSKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EBSDefaultKMSKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EBSDefaultKMSKey) LateInitialize(attrs []byte) (bool, error) { + params := &EBSDefaultKMSKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EBSDefaultKMSKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_ebsdefaultkmskey_types.go b/apis/ec2/v1beta1/zz_ebsdefaultkmskey_types.go index fd43e22a99..d23eb27bbd 100755 --- a/apis/ec2/v1beta1/zz_ebsdefaultkmskey_types.go +++ b/apis/ec2/v1beta1/zz_ebsdefaultkmskey_types.go @@ -86,13 +86,14 @@ type EBSDefaultKMSKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EBSDefaultKMSKey is the Schema for the EBSDefaultKMSKeys API. Manages the default customer master key (CMK) that your AWS account uses to encrypt EBS volumes. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EBSDefaultKMSKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_ebsencryptionbydefault_terraformed.go b/apis/ec2/v1beta1/zz_ebsencryptionbydefault_terraformed.go new file mode 100755 index 0000000000..1322653d7c --- /dev/null +++ b/apis/ec2/v1beta1/zz_ebsencryptionbydefault_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EBSEncryptionByDefault +func (mg *EBSEncryptionByDefault) GetTerraformResourceType() string { + return "aws_ebs_encryption_by_default" +} + +// GetConnectionDetailsMapping for this EBSEncryptionByDefault +func (tr *EBSEncryptionByDefault) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EBSEncryptionByDefault +func (tr *EBSEncryptionByDefault) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EBSEncryptionByDefault +func (tr *EBSEncryptionByDefault) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EBSEncryptionByDefault +func (tr *EBSEncryptionByDefault) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EBSEncryptionByDefault +func (tr *EBSEncryptionByDefault) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EBSEncryptionByDefault +func (tr *EBSEncryptionByDefault) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EBSEncryptionByDefault +func (tr *EBSEncryptionByDefault) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EBSEncryptionByDefault +func (tr *EBSEncryptionByDefault) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EBSEncryptionByDefault using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EBSEncryptionByDefault) LateInitialize(attrs []byte) (bool, error) { + params := &EBSEncryptionByDefaultParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EBSEncryptionByDefault) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_ebsencryptionbydefault_types.go b/apis/ec2/v1beta1/zz_ebsencryptionbydefault_types.go index fd32a5ef90..61b15411f5 100755 --- a/apis/ec2/v1beta1/zz_ebsencryptionbydefault_types.go +++ b/apis/ec2/v1beta1/zz_ebsencryptionbydefault_types.go @@ -67,13 +67,14 @@ type EBSEncryptionByDefaultStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EBSEncryptionByDefault is the Schema for the EBSEncryptionByDefaults API. Manages whether default EBS encryption is enabled for your AWS account in the current AWS region. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EBSEncryptionByDefault struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_ebssnapshot_terraformed.go b/apis/ec2/v1beta1/zz_ebssnapshot_terraformed.go new file mode 100755 index 0000000000..6bb0e0bea9 --- /dev/null +++ b/apis/ec2/v1beta1/zz_ebssnapshot_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EBSSnapshot +func (mg *EBSSnapshot) GetTerraformResourceType() string { + return "aws_ebs_snapshot" +} + +// GetConnectionDetailsMapping for this EBSSnapshot +func (tr *EBSSnapshot) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EBSSnapshot +func (tr *EBSSnapshot) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EBSSnapshot +func (tr *EBSSnapshot) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EBSSnapshot +func (tr *EBSSnapshot) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EBSSnapshot +func (tr *EBSSnapshot) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EBSSnapshot +func (tr *EBSSnapshot) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EBSSnapshot +func (tr *EBSSnapshot) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EBSSnapshot +func (tr *EBSSnapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EBSSnapshot using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EBSSnapshot) LateInitialize(attrs []byte) (bool, error) { + params := &EBSSnapshotParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EBSSnapshot) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_ebssnapshot_types.go b/apis/ec2/v1beta1/zz_ebssnapshot_types.go index 4672e24870..318de676be 100755 --- a/apis/ec2/v1beta1/zz_ebssnapshot_types.go +++ b/apis/ec2/v1beta1/zz_ebssnapshot_types.go @@ -176,13 +176,14 @@ type EBSSnapshotStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EBSSnapshot is the Schema for the EBSSnapshots API. Provides an elastic block storage snapshot resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EBSSnapshot struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_ebssnapshotcopy_terraformed.go b/apis/ec2/v1beta1/zz_ebssnapshotcopy_terraformed.go new file mode 100755 index 0000000000..fc3644f18f --- /dev/null +++ b/apis/ec2/v1beta1/zz_ebssnapshotcopy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EBSSnapshotCopy +func (mg *EBSSnapshotCopy) GetTerraformResourceType() string { + return "aws_ebs_snapshot_copy" +} + +// GetConnectionDetailsMapping for this EBSSnapshotCopy +func (tr *EBSSnapshotCopy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EBSSnapshotCopy +func (tr *EBSSnapshotCopy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EBSSnapshotCopy +func (tr *EBSSnapshotCopy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EBSSnapshotCopy +func (tr *EBSSnapshotCopy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EBSSnapshotCopy +func (tr *EBSSnapshotCopy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EBSSnapshotCopy +func (tr *EBSSnapshotCopy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EBSSnapshotCopy +func (tr *EBSSnapshotCopy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EBSSnapshotCopy +func (tr *EBSSnapshotCopy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EBSSnapshotCopy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EBSSnapshotCopy) LateInitialize(attrs []byte) (bool, error) { + params := &EBSSnapshotCopyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EBSSnapshotCopy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_ebssnapshotcopy_types.go b/apis/ec2/v1beta1/zz_ebssnapshotcopy_types.go index d27928e0f3..eb556023d2 100755 --- a/apis/ec2/v1beta1/zz_ebssnapshotcopy_types.go +++ b/apis/ec2/v1beta1/zz_ebssnapshotcopy_types.go @@ -214,13 +214,14 @@ type EBSSnapshotCopyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EBSSnapshotCopy is the Schema for the EBSSnapshotCopys API. Duplicates an existing Amazon snapshot // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EBSSnapshotCopy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_ebssnapshotimport_terraformed.go b/apis/ec2/v1beta1/zz_ebssnapshotimport_terraformed.go new file mode 100755 index 0000000000..39091fda70 --- /dev/null +++ b/apis/ec2/v1beta1/zz_ebssnapshotimport_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EBSSnapshotImport +func (mg *EBSSnapshotImport) GetTerraformResourceType() string { + return "aws_ebs_snapshot_import" +} + +// GetConnectionDetailsMapping for this EBSSnapshotImport +func (tr *EBSSnapshotImport) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EBSSnapshotImport +func (tr *EBSSnapshotImport) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EBSSnapshotImport +func (tr *EBSSnapshotImport) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EBSSnapshotImport +func (tr *EBSSnapshotImport) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EBSSnapshotImport +func (tr *EBSSnapshotImport) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EBSSnapshotImport +func (tr *EBSSnapshotImport) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EBSSnapshotImport +func (tr *EBSSnapshotImport) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EBSSnapshotImport +func (tr *EBSSnapshotImport) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EBSSnapshotImport using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EBSSnapshotImport) LateInitialize(attrs []byte) (bool, error) { + params := &EBSSnapshotImportParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EBSSnapshotImport) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_ebssnapshotimport_types.go b/apis/ec2/v1beta1/zz_ebssnapshotimport_types.go index d2860f9adb..c30ff69b5e 100755 --- a/apis/ec2/v1beta1/zz_ebssnapshotimport_types.go +++ b/apis/ec2/v1beta1/zz_ebssnapshotimport_types.go @@ -331,13 +331,14 @@ type EBSSnapshotImportStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EBSSnapshotImport is the Schema for the EBSSnapshotImports API. Provides an elastic block storage snapshot import resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EBSSnapshotImport struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_ebsvolume_terraformed.go b/apis/ec2/v1beta1/zz_ebsvolume_terraformed.go new file mode 100755 index 0000000000..a58e726410 --- /dev/null +++ b/apis/ec2/v1beta1/zz_ebsvolume_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EBSVolume +func (mg *EBSVolume) GetTerraformResourceType() string { + return "aws_ebs_volume" +} + +// GetConnectionDetailsMapping for this EBSVolume +func (tr *EBSVolume) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EBSVolume +func (tr *EBSVolume) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EBSVolume +func (tr *EBSVolume) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EBSVolume +func (tr *EBSVolume) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EBSVolume +func (tr *EBSVolume) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EBSVolume +func (tr *EBSVolume) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EBSVolume +func (tr *EBSVolume) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EBSVolume +func (tr *EBSVolume) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EBSVolume using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EBSVolume) LateInitialize(attrs []byte) (bool, error) { + params := &EBSVolumeParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EBSVolume) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_ebsvolume_types.go b/apis/ec2/v1beta1/zz_ebsvolume_types.go index e2ab7e0608..04e1083e6d 100755 --- a/apis/ec2/v1beta1/zz_ebsvolume_types.go +++ b/apis/ec2/v1beta1/zz_ebsvolume_types.go @@ -206,13 +206,14 @@ type EBSVolumeStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EBSVolume is the Schema for the EBSVolumes API. Provides an elastic block storage resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EBSVolume struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_egressonlyinternetgateway_terraformed.go b/apis/ec2/v1beta1/zz_egressonlyinternetgateway_terraformed.go new file mode 100755 index 0000000000..6f4dc74acf --- /dev/null +++ b/apis/ec2/v1beta1/zz_egressonlyinternetgateway_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EgressOnlyInternetGateway +func (mg *EgressOnlyInternetGateway) GetTerraformResourceType() string { + return "aws_egress_only_internet_gateway" +} + +// GetConnectionDetailsMapping for this EgressOnlyInternetGateway +func (tr *EgressOnlyInternetGateway) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EgressOnlyInternetGateway +func (tr *EgressOnlyInternetGateway) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EgressOnlyInternetGateway +func (tr *EgressOnlyInternetGateway) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EgressOnlyInternetGateway +func (tr *EgressOnlyInternetGateway) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EgressOnlyInternetGateway +func (tr *EgressOnlyInternetGateway) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EgressOnlyInternetGateway +func (tr *EgressOnlyInternetGateway) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EgressOnlyInternetGateway +func (tr *EgressOnlyInternetGateway) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EgressOnlyInternetGateway +func (tr *EgressOnlyInternetGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EgressOnlyInternetGateway using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EgressOnlyInternetGateway) LateInitialize(attrs []byte) (bool, error) { + params := &EgressOnlyInternetGatewayParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EgressOnlyInternetGateway) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_egressonlyinternetgateway_types.go b/apis/ec2/v1beta1/zz_egressonlyinternetgateway_types.go index 1235a89346..956e4015e8 100755 --- a/apis/ec2/v1beta1/zz_egressonlyinternetgateway_types.go +++ b/apis/ec2/v1beta1/zz_egressonlyinternetgateway_types.go @@ -103,13 +103,14 @@ type EgressOnlyInternetGatewayStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EgressOnlyInternetGateway is the Schema for the EgressOnlyInternetGateways API. Provides a resource to create an egress-only Internet gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EgressOnlyInternetGateway struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_eip_terraformed.go b/apis/ec2/v1beta1/zz_eip_terraformed.go new file mode 100755 index 0000000000..cfaef1532a --- /dev/null +++ b/apis/ec2/v1beta1/zz_eip_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EIP +func (mg *EIP) GetTerraformResourceType() string { + return "aws_eip" +} + +// GetConnectionDetailsMapping for this EIP +func (tr *EIP) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EIP +func (tr *EIP) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EIP +func (tr *EIP) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EIP +func (tr *EIP) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EIP +func (tr *EIP) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EIP +func (tr *EIP) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EIP +func (tr *EIP) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EIP +func (tr *EIP) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EIP using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EIP) LateInitialize(attrs []byte) (bool, error) { + params := &EIPParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EIP) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_eip_types.go b/apis/ec2/v1beta1/zz_eip_types.go index 35b9518976..404974d4a8 100755 --- a/apis/ec2/v1beta1/zz_eip_types.go +++ b/apis/ec2/v1beta1/zz_eip_types.go @@ -224,13 +224,14 @@ type EIPStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EIP is the Schema for the EIPs API. Provides an Elastic IP resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EIP struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_eipassociation_terraformed.go b/apis/ec2/v1beta1/zz_eipassociation_terraformed.go new file mode 100755 index 0000000000..cb71b78953 --- /dev/null +++ b/apis/ec2/v1beta1/zz_eipassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EIPAssociation +func (mg *EIPAssociation) GetTerraformResourceType() string { + return "aws_eip_association" +} + +// GetConnectionDetailsMapping for this EIPAssociation +func (tr *EIPAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EIPAssociation +func (tr *EIPAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EIPAssociation +func (tr *EIPAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EIPAssociation +func (tr *EIPAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EIPAssociation +func (tr *EIPAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EIPAssociation +func (tr *EIPAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EIPAssociation +func (tr *EIPAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EIPAssociation +func (tr *EIPAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EIPAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EIPAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &EIPAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EIPAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_eipassociation_types.go b/apis/ec2/v1beta1/zz_eipassociation_types.go index dd6d93224c..4e566c8bf5 100755 --- a/apis/ec2/v1beta1/zz_eipassociation_types.go +++ b/apis/ec2/v1beta1/zz_eipassociation_types.go @@ -184,13 +184,14 @@ type EIPAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EIPAssociation is the Schema for the EIPAssociations API. Provides an AWS EIP Association // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EIPAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_flowlog_terraformed.go b/apis/ec2/v1beta1/zz_flowlog_terraformed.go new file mode 100755 index 0000000000..c79b518900 --- /dev/null +++ b/apis/ec2/v1beta1/zz_flowlog_terraformed.go @@ -0,0 +1,136 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FlowLog +func (mg *FlowLog) GetTerraformResourceType() string { + return "aws_flow_log" +} + +// GetConnectionDetailsMapping for this FlowLog +func (tr *FlowLog) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FlowLog +func (tr *FlowLog) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FlowLog +func (tr *FlowLog) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FlowLog +func (tr *FlowLog) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FlowLog +func (tr *FlowLog) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FlowLog +func (tr *FlowLog) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FlowLog +func (tr *FlowLog) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FlowLog +func (tr *FlowLog) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FlowLog using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FlowLog) LateInitialize(attrs []byte) (bool, error) { + params := &FlowLogParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("LogDestination")) + opts = append(opts, resource.WithNameFilter("LogFormat")) + opts = append(opts, resource.WithNameFilter("LogGroupName")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FlowLog) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_flowlog_types.go b/apis/ec2/v1beta1/zz_flowlog_types.go index b855cf4211..f6a89a7e79 100755 --- a/apis/ec2/v1beta1/zz_flowlog_types.go +++ b/apis/ec2/v1beta1/zz_flowlog_types.go @@ -342,13 +342,14 @@ type FlowLogStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FlowLog is the Schema for the FlowLogs API. Provides a VPC/Subnet/ENI Flow Log // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FlowLog struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_generated.conversion_hubs.go b/apis/ec2/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..291965388c --- /dev/null +++ b/apis/ec2/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,311 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AMI) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *AMICopy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *AMILaunchPermission) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CustomerGateway) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DefaultNetworkACL) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DefaultRouteTable) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DefaultSecurityGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DefaultSubnet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DefaultVPC) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DefaultVPCDHCPOptions) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EBSDefaultKMSKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EBSEncryptionByDefault) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EBSSnapshot) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EBSSnapshotCopy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EBSSnapshotImport) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EBSVolume) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *AvailabilityZoneGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CapacityReservation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CarrierGateway) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Host) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InstanceState) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ManagedPrefixList) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ManagedPrefixListEntry) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NetworkInsightsAnalysis) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NetworkInsightsPath) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SerialConsoleAccess) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SubnetCidrReservation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Tag) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TrafficMirrorFilter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TrafficMirrorFilterRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGateway) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayConnect) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayConnectPeer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayMulticastDomain) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayMulticastDomainAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayMulticastGroupMember) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayMulticastGroupSource) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayPeeringAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayPeeringAttachmentAccepter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayPolicyTable) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayPrefixListReference) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayRoute) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayRouteTable) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayRouteTableAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayRouteTablePropagation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayVPCAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayVPCAttachmentAccepter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EgressOnlyInternetGateway) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EIP) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EIPAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FlowLog) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Instance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InternetGateway) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *KeyPair) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LaunchTemplate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MainRouteTableAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NATGateway) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NetworkACL) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NetworkACLRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NetworkInterface) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NetworkInterfaceAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NetworkInterfaceSgAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PlacementGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Route) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RouteTable) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RouteTableAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SecurityGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SecurityGroupRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SnapshotCreateVolumePermission) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SpotDatafeedSubscription) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SpotFleetRequest) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SpotInstanceRequest) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Subnet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VolumeAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPC) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCDHCPOptions) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCDHCPOptionsAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCEndpoint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCEndpointConnectionNotification) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCEndpointRouteTableAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCEndpointSecurityGroupAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCEndpointService) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCEndpointServiceAllowedPrincipal) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCEndpointSubnetAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCIpam) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCIpamPool) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCIpamPoolCidr) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCIpamPoolCidrAllocation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCIpamScope) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCIPv4CidrBlockAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCPeeringConnection) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCPeeringConnectionAccepter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCPeeringConnectionOptions) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SecurityGroupEgressRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SecurityGroupIngressRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPNConnection) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPNConnectionRoute) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPNGateway) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPNGatewayAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPNGatewayRoutePropagation) Hub() {} diff --git a/apis/ec2/v1beta1/zz_generated_terraformed.go b/apis/ec2/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index d3db67a16a..0000000000 --- a/apis/ec2/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,11450 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AMI -func (mg *AMI) GetTerraformResourceType() string { - return "aws_ami" -} - -// GetConnectionDetailsMapping for this AMI -func (tr *AMI) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AMI -func (tr *AMI) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AMI -func (tr *AMI) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AMI -func (tr *AMI) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AMI -func (tr *AMI) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AMI -func (tr *AMI) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AMI -func (tr *AMI) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AMI -func (tr *AMI) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AMI using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AMI) LateInitialize(attrs []byte) (bool, error) { - params := &AMIParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AMI) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this AMICopy -func (mg *AMICopy) GetTerraformResourceType() string { - return "aws_ami_copy" -} - -// GetConnectionDetailsMapping for this AMICopy -func (tr *AMICopy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AMICopy -func (tr *AMICopy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AMICopy -func (tr *AMICopy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AMICopy -func (tr *AMICopy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AMICopy -func (tr *AMICopy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AMICopy -func (tr *AMICopy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AMICopy -func (tr *AMICopy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AMICopy -func (tr *AMICopy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AMICopy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AMICopy) LateInitialize(attrs []byte) (bool, error) { - params := &AMICopyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AMICopy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this AMILaunchPermission -func (mg *AMILaunchPermission) GetTerraformResourceType() string { - return "aws_ami_launch_permission" -} - -// GetConnectionDetailsMapping for this AMILaunchPermission -func (tr *AMILaunchPermission) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AMILaunchPermission -func (tr *AMILaunchPermission) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AMILaunchPermission -func (tr *AMILaunchPermission) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AMILaunchPermission -func (tr *AMILaunchPermission) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AMILaunchPermission -func (tr *AMILaunchPermission) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AMILaunchPermission -func (tr *AMILaunchPermission) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AMILaunchPermission -func (tr *AMILaunchPermission) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AMILaunchPermission -func (tr *AMILaunchPermission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AMILaunchPermission using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AMILaunchPermission) LateInitialize(attrs []byte) (bool, error) { - params := &AMILaunchPermissionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AMILaunchPermission) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CustomerGateway -func (mg *CustomerGateway) GetTerraformResourceType() string { - return "aws_customer_gateway" -} - -// GetConnectionDetailsMapping for this CustomerGateway -func (tr *CustomerGateway) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CustomerGateway -func (tr *CustomerGateway) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CustomerGateway -func (tr *CustomerGateway) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CustomerGateway -func (tr *CustomerGateway) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CustomerGateway -func (tr *CustomerGateway) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CustomerGateway -func (tr *CustomerGateway) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CustomerGateway -func (tr *CustomerGateway) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CustomerGateway -func (tr *CustomerGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CustomerGateway using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CustomerGateway) LateInitialize(attrs []byte) (bool, error) { - params := &CustomerGatewayParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CustomerGateway) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DefaultNetworkACL -func (mg *DefaultNetworkACL) GetTerraformResourceType() string { - return "aws_default_network_acl" -} - -// GetConnectionDetailsMapping for this DefaultNetworkACL -func (tr *DefaultNetworkACL) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DefaultNetworkACL -func (tr *DefaultNetworkACL) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DefaultNetworkACL -func (tr *DefaultNetworkACL) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DefaultNetworkACL -func (tr *DefaultNetworkACL) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DefaultNetworkACL -func (tr *DefaultNetworkACL) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DefaultNetworkACL -func (tr *DefaultNetworkACL) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DefaultNetworkACL -func (tr *DefaultNetworkACL) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DefaultNetworkACL -func (tr *DefaultNetworkACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DefaultNetworkACL using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DefaultNetworkACL) LateInitialize(attrs []byte) (bool, error) { - params := &DefaultNetworkACLParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DefaultNetworkACL) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DefaultRouteTable -func (mg *DefaultRouteTable) GetTerraformResourceType() string { - return "aws_default_route_table" -} - -// GetConnectionDetailsMapping for this DefaultRouteTable -func (tr *DefaultRouteTable) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DefaultRouteTable -func (tr *DefaultRouteTable) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DefaultRouteTable -func (tr *DefaultRouteTable) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DefaultRouteTable -func (tr *DefaultRouteTable) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DefaultRouteTable -func (tr *DefaultRouteTable) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DefaultRouteTable -func (tr *DefaultRouteTable) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DefaultRouteTable -func (tr *DefaultRouteTable) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DefaultRouteTable -func (tr *DefaultRouteTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DefaultRouteTable using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DefaultRouteTable) LateInitialize(attrs []byte) (bool, error) { - params := &DefaultRouteTableParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DefaultRouteTable) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DefaultSecurityGroup -func (mg *DefaultSecurityGroup) GetTerraformResourceType() string { - return "aws_default_security_group" -} - -// GetConnectionDetailsMapping for this DefaultSecurityGroup -func (tr *DefaultSecurityGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DefaultSecurityGroup -func (tr *DefaultSecurityGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DefaultSecurityGroup -func (tr *DefaultSecurityGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DefaultSecurityGroup -func (tr *DefaultSecurityGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DefaultSecurityGroup -func (tr *DefaultSecurityGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DefaultSecurityGroup -func (tr *DefaultSecurityGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DefaultSecurityGroup -func (tr *DefaultSecurityGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DefaultSecurityGroup -func (tr *DefaultSecurityGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DefaultSecurityGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DefaultSecurityGroup) LateInitialize(attrs []byte) (bool, error) { - params := &DefaultSecurityGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DefaultSecurityGroup) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this DefaultSubnet -func (mg *DefaultSubnet) GetTerraformResourceType() string { - return "aws_default_subnet" -} - -// GetConnectionDetailsMapping for this DefaultSubnet -func (tr *DefaultSubnet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DefaultSubnet -func (tr *DefaultSubnet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DefaultSubnet -func (tr *DefaultSubnet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DefaultSubnet -func (tr *DefaultSubnet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DefaultSubnet -func (tr *DefaultSubnet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DefaultSubnet -func (tr *DefaultSubnet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DefaultSubnet -func (tr *DefaultSubnet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DefaultSubnet -func (tr *DefaultSubnet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DefaultSubnet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DefaultSubnet) LateInitialize(attrs []byte) (bool, error) { - params := &DefaultSubnetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DefaultSubnet) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this DefaultVPC -func (mg *DefaultVPC) GetTerraformResourceType() string { - return "aws_default_vpc" -} - -// GetConnectionDetailsMapping for this DefaultVPC -func (tr *DefaultVPC) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DefaultVPC -func (tr *DefaultVPC) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DefaultVPC -func (tr *DefaultVPC) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DefaultVPC -func (tr *DefaultVPC) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DefaultVPC -func (tr *DefaultVPC) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DefaultVPC -func (tr *DefaultVPC) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DefaultVPC -func (tr *DefaultVPC) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DefaultVPC -func (tr *DefaultVPC) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DefaultVPC using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DefaultVPC) LateInitialize(attrs []byte) (bool, error) { - params := &DefaultVPCParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DefaultVPC) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this DefaultVPCDHCPOptions -func (mg *DefaultVPCDHCPOptions) GetTerraformResourceType() string { - return "aws_default_vpc_dhcp_options" -} - -// GetConnectionDetailsMapping for this DefaultVPCDHCPOptions -func (tr *DefaultVPCDHCPOptions) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DefaultVPCDHCPOptions -func (tr *DefaultVPCDHCPOptions) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DefaultVPCDHCPOptions -func (tr *DefaultVPCDHCPOptions) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DefaultVPCDHCPOptions -func (tr *DefaultVPCDHCPOptions) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DefaultVPCDHCPOptions -func (tr *DefaultVPCDHCPOptions) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DefaultVPCDHCPOptions -func (tr *DefaultVPCDHCPOptions) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DefaultVPCDHCPOptions -func (tr *DefaultVPCDHCPOptions) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DefaultVPCDHCPOptions -func (tr *DefaultVPCDHCPOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DefaultVPCDHCPOptions using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DefaultVPCDHCPOptions) LateInitialize(attrs []byte) (bool, error) { - params := &DefaultVPCDHCPOptionsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DefaultVPCDHCPOptions) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EBSDefaultKMSKey -func (mg *EBSDefaultKMSKey) GetTerraformResourceType() string { - return "aws_ebs_default_kms_key" -} - -// GetConnectionDetailsMapping for this EBSDefaultKMSKey -func (tr *EBSDefaultKMSKey) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EBSDefaultKMSKey -func (tr *EBSDefaultKMSKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EBSDefaultKMSKey -func (tr *EBSDefaultKMSKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EBSDefaultKMSKey -func (tr *EBSDefaultKMSKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EBSDefaultKMSKey -func (tr *EBSDefaultKMSKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EBSDefaultKMSKey -func (tr *EBSDefaultKMSKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EBSDefaultKMSKey -func (tr *EBSDefaultKMSKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EBSDefaultKMSKey -func (tr *EBSDefaultKMSKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EBSDefaultKMSKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EBSDefaultKMSKey) LateInitialize(attrs []byte) (bool, error) { - params := &EBSDefaultKMSKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EBSDefaultKMSKey) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EBSEncryptionByDefault -func (mg *EBSEncryptionByDefault) GetTerraformResourceType() string { - return "aws_ebs_encryption_by_default" -} - -// GetConnectionDetailsMapping for this EBSEncryptionByDefault -func (tr *EBSEncryptionByDefault) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EBSEncryptionByDefault -func (tr *EBSEncryptionByDefault) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EBSEncryptionByDefault -func (tr *EBSEncryptionByDefault) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EBSEncryptionByDefault -func (tr *EBSEncryptionByDefault) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EBSEncryptionByDefault -func (tr *EBSEncryptionByDefault) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EBSEncryptionByDefault -func (tr *EBSEncryptionByDefault) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EBSEncryptionByDefault -func (tr *EBSEncryptionByDefault) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EBSEncryptionByDefault -func (tr *EBSEncryptionByDefault) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EBSEncryptionByDefault using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EBSEncryptionByDefault) LateInitialize(attrs []byte) (bool, error) { - params := &EBSEncryptionByDefaultParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EBSEncryptionByDefault) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EBSSnapshot -func (mg *EBSSnapshot) GetTerraformResourceType() string { - return "aws_ebs_snapshot" -} - -// GetConnectionDetailsMapping for this EBSSnapshot -func (tr *EBSSnapshot) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EBSSnapshot -func (tr *EBSSnapshot) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EBSSnapshot -func (tr *EBSSnapshot) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EBSSnapshot -func (tr *EBSSnapshot) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EBSSnapshot -func (tr *EBSSnapshot) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EBSSnapshot -func (tr *EBSSnapshot) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EBSSnapshot -func (tr *EBSSnapshot) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EBSSnapshot -func (tr *EBSSnapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EBSSnapshot using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EBSSnapshot) LateInitialize(attrs []byte) (bool, error) { - params := &EBSSnapshotParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EBSSnapshot) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EBSSnapshotCopy -func (mg *EBSSnapshotCopy) GetTerraformResourceType() string { - return "aws_ebs_snapshot_copy" -} - -// GetConnectionDetailsMapping for this EBSSnapshotCopy -func (tr *EBSSnapshotCopy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EBSSnapshotCopy -func (tr *EBSSnapshotCopy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EBSSnapshotCopy -func (tr *EBSSnapshotCopy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EBSSnapshotCopy -func (tr *EBSSnapshotCopy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EBSSnapshotCopy -func (tr *EBSSnapshotCopy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EBSSnapshotCopy -func (tr *EBSSnapshotCopy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EBSSnapshotCopy -func (tr *EBSSnapshotCopy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EBSSnapshotCopy -func (tr *EBSSnapshotCopy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EBSSnapshotCopy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EBSSnapshotCopy) LateInitialize(attrs []byte) (bool, error) { - params := &EBSSnapshotCopyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EBSSnapshotCopy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EBSSnapshotImport -func (mg *EBSSnapshotImport) GetTerraformResourceType() string { - return "aws_ebs_snapshot_import" -} - -// GetConnectionDetailsMapping for this EBSSnapshotImport -func (tr *EBSSnapshotImport) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EBSSnapshotImport -func (tr *EBSSnapshotImport) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EBSSnapshotImport -func (tr *EBSSnapshotImport) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EBSSnapshotImport -func (tr *EBSSnapshotImport) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EBSSnapshotImport -func (tr *EBSSnapshotImport) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EBSSnapshotImport -func (tr *EBSSnapshotImport) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EBSSnapshotImport -func (tr *EBSSnapshotImport) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EBSSnapshotImport -func (tr *EBSSnapshotImport) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EBSSnapshotImport using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EBSSnapshotImport) LateInitialize(attrs []byte) (bool, error) { - params := &EBSSnapshotImportParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EBSSnapshotImport) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EBSVolume -func (mg *EBSVolume) GetTerraformResourceType() string { - return "aws_ebs_volume" -} - -// GetConnectionDetailsMapping for this EBSVolume -func (tr *EBSVolume) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EBSVolume -func (tr *EBSVolume) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EBSVolume -func (tr *EBSVolume) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EBSVolume -func (tr *EBSVolume) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EBSVolume -func (tr *EBSVolume) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EBSVolume -func (tr *EBSVolume) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EBSVolume -func (tr *EBSVolume) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EBSVolume -func (tr *EBSVolume) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EBSVolume using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EBSVolume) LateInitialize(attrs []byte) (bool, error) { - params := &EBSVolumeParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EBSVolume) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this AvailabilityZoneGroup -func (mg *AvailabilityZoneGroup) GetTerraformResourceType() string { - return "aws_ec2_availability_zone_group" -} - -// GetConnectionDetailsMapping for this AvailabilityZoneGroup -func (tr *AvailabilityZoneGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AvailabilityZoneGroup -func (tr *AvailabilityZoneGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AvailabilityZoneGroup -func (tr *AvailabilityZoneGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AvailabilityZoneGroup -func (tr *AvailabilityZoneGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AvailabilityZoneGroup -func (tr *AvailabilityZoneGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AvailabilityZoneGroup -func (tr *AvailabilityZoneGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AvailabilityZoneGroup -func (tr *AvailabilityZoneGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AvailabilityZoneGroup -func (tr *AvailabilityZoneGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AvailabilityZoneGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AvailabilityZoneGroup) LateInitialize(attrs []byte) (bool, error) { - params := &AvailabilityZoneGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AvailabilityZoneGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CapacityReservation -func (mg *CapacityReservation) GetTerraformResourceType() string { - return "aws_ec2_capacity_reservation" -} - -// GetConnectionDetailsMapping for this CapacityReservation -func (tr *CapacityReservation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CapacityReservation -func (tr *CapacityReservation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CapacityReservation -func (tr *CapacityReservation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CapacityReservation -func (tr *CapacityReservation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CapacityReservation -func (tr *CapacityReservation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CapacityReservation -func (tr *CapacityReservation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CapacityReservation -func (tr *CapacityReservation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CapacityReservation -func (tr *CapacityReservation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CapacityReservation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CapacityReservation) LateInitialize(attrs []byte) (bool, error) { - params := &CapacityReservationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CapacityReservation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CarrierGateway -func (mg *CarrierGateway) GetTerraformResourceType() string { - return "aws_ec2_carrier_gateway" -} - -// GetConnectionDetailsMapping for this CarrierGateway -func (tr *CarrierGateway) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CarrierGateway -func (tr *CarrierGateway) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CarrierGateway -func (tr *CarrierGateway) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CarrierGateway -func (tr *CarrierGateway) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CarrierGateway -func (tr *CarrierGateway) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CarrierGateway -func (tr *CarrierGateway) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CarrierGateway -func (tr *CarrierGateway) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CarrierGateway -func (tr *CarrierGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CarrierGateway using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CarrierGateway) LateInitialize(attrs []byte) (bool, error) { - params := &CarrierGatewayParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CarrierGateway) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Host -func (mg *Host) GetTerraformResourceType() string { - return "aws_ec2_host" -} - -// GetConnectionDetailsMapping for this Host -func (tr *Host) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Host -func (tr *Host) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Host -func (tr *Host) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Host -func (tr *Host) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Host -func (tr *Host) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Host -func (tr *Host) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Host -func (tr *Host) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Host -func (tr *Host) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Host using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Host) LateInitialize(attrs []byte) (bool, error) { - params := &HostParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Host) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InstanceState -func (mg *InstanceState) GetTerraformResourceType() string { - return "aws_ec2_instance_state" -} - -// GetConnectionDetailsMapping for this InstanceState -func (tr *InstanceState) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InstanceState -func (tr *InstanceState) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InstanceState -func (tr *InstanceState) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InstanceState -func (tr *InstanceState) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InstanceState -func (tr *InstanceState) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InstanceState -func (tr *InstanceState) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InstanceState -func (tr *InstanceState) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InstanceState -func (tr *InstanceState) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InstanceState using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InstanceState) LateInitialize(attrs []byte) (bool, error) { - params := &InstanceStateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InstanceState) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ManagedPrefixList -func (mg *ManagedPrefixList) GetTerraformResourceType() string { - return "aws_ec2_managed_prefix_list" -} - -// GetConnectionDetailsMapping for this ManagedPrefixList -func (tr *ManagedPrefixList) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ManagedPrefixList -func (tr *ManagedPrefixList) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ManagedPrefixList -func (tr *ManagedPrefixList) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ManagedPrefixList -func (tr *ManagedPrefixList) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ManagedPrefixList -func (tr *ManagedPrefixList) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ManagedPrefixList -func (tr *ManagedPrefixList) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ManagedPrefixList -func (tr *ManagedPrefixList) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ManagedPrefixList -func (tr *ManagedPrefixList) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ManagedPrefixList using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ManagedPrefixList) LateInitialize(attrs []byte) (bool, error) { - params := &ManagedPrefixListParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ManagedPrefixList) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ManagedPrefixListEntry -func (mg *ManagedPrefixListEntry) GetTerraformResourceType() string { - return "aws_ec2_managed_prefix_list_entry" -} - -// GetConnectionDetailsMapping for this ManagedPrefixListEntry -func (tr *ManagedPrefixListEntry) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ManagedPrefixListEntry -func (tr *ManagedPrefixListEntry) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ManagedPrefixListEntry -func (tr *ManagedPrefixListEntry) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ManagedPrefixListEntry -func (tr *ManagedPrefixListEntry) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ManagedPrefixListEntry -func (tr *ManagedPrefixListEntry) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ManagedPrefixListEntry -func (tr *ManagedPrefixListEntry) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ManagedPrefixListEntry -func (tr *ManagedPrefixListEntry) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ManagedPrefixListEntry -func (tr *ManagedPrefixListEntry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ManagedPrefixListEntry using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ManagedPrefixListEntry) LateInitialize(attrs []byte) (bool, error) { - params := &ManagedPrefixListEntryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ManagedPrefixListEntry) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NetworkInsightsAnalysis -func (mg *NetworkInsightsAnalysis) GetTerraformResourceType() string { - return "aws_ec2_network_insights_analysis" -} - -// GetConnectionDetailsMapping for this NetworkInsightsAnalysis -func (tr *NetworkInsightsAnalysis) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NetworkInsightsAnalysis -func (tr *NetworkInsightsAnalysis) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NetworkInsightsAnalysis -func (tr *NetworkInsightsAnalysis) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NetworkInsightsAnalysis -func (tr *NetworkInsightsAnalysis) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NetworkInsightsAnalysis -func (tr *NetworkInsightsAnalysis) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NetworkInsightsAnalysis -func (tr *NetworkInsightsAnalysis) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NetworkInsightsAnalysis -func (tr *NetworkInsightsAnalysis) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NetworkInsightsAnalysis -func (tr *NetworkInsightsAnalysis) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NetworkInsightsAnalysis using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NetworkInsightsAnalysis) LateInitialize(attrs []byte) (bool, error) { - params := &NetworkInsightsAnalysisParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NetworkInsightsAnalysis) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NetworkInsightsPath -func (mg *NetworkInsightsPath) GetTerraformResourceType() string { - return "aws_ec2_network_insights_path" -} - -// GetConnectionDetailsMapping for this NetworkInsightsPath -func (tr *NetworkInsightsPath) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NetworkInsightsPath -func (tr *NetworkInsightsPath) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NetworkInsightsPath -func (tr *NetworkInsightsPath) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NetworkInsightsPath -func (tr *NetworkInsightsPath) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NetworkInsightsPath -func (tr *NetworkInsightsPath) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NetworkInsightsPath -func (tr *NetworkInsightsPath) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NetworkInsightsPath -func (tr *NetworkInsightsPath) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NetworkInsightsPath -func (tr *NetworkInsightsPath) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NetworkInsightsPath using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NetworkInsightsPath) LateInitialize(attrs []byte) (bool, error) { - params := &NetworkInsightsPathParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NetworkInsightsPath) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SerialConsoleAccess -func (mg *SerialConsoleAccess) GetTerraformResourceType() string { - return "aws_ec2_serial_console_access" -} - -// GetConnectionDetailsMapping for this SerialConsoleAccess -func (tr *SerialConsoleAccess) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SerialConsoleAccess -func (tr *SerialConsoleAccess) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SerialConsoleAccess -func (tr *SerialConsoleAccess) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SerialConsoleAccess -func (tr *SerialConsoleAccess) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SerialConsoleAccess -func (tr *SerialConsoleAccess) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SerialConsoleAccess -func (tr *SerialConsoleAccess) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SerialConsoleAccess -func (tr *SerialConsoleAccess) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SerialConsoleAccess -func (tr *SerialConsoleAccess) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SerialConsoleAccess using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SerialConsoleAccess) LateInitialize(attrs []byte) (bool, error) { - params := &SerialConsoleAccessParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SerialConsoleAccess) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SubnetCidrReservation -func (mg *SubnetCidrReservation) GetTerraformResourceType() string { - return "aws_ec2_subnet_cidr_reservation" -} - -// GetConnectionDetailsMapping for this SubnetCidrReservation -func (tr *SubnetCidrReservation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SubnetCidrReservation -func (tr *SubnetCidrReservation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SubnetCidrReservation -func (tr *SubnetCidrReservation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SubnetCidrReservation -func (tr *SubnetCidrReservation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SubnetCidrReservation -func (tr *SubnetCidrReservation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SubnetCidrReservation -func (tr *SubnetCidrReservation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SubnetCidrReservation -func (tr *SubnetCidrReservation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SubnetCidrReservation -func (tr *SubnetCidrReservation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SubnetCidrReservation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SubnetCidrReservation) LateInitialize(attrs []byte) (bool, error) { - params := &SubnetCidrReservationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SubnetCidrReservation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Tag -func (mg *Tag) GetTerraformResourceType() string { - return "aws_ec2_tag" -} - -// GetConnectionDetailsMapping for this Tag -func (tr *Tag) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Tag -func (tr *Tag) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Tag -func (tr *Tag) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Tag -func (tr *Tag) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Tag -func (tr *Tag) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Tag -func (tr *Tag) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Tag -func (tr *Tag) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Tag -func (tr *Tag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Tag using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Tag) LateInitialize(attrs []byte) (bool, error) { - params := &TagParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Tag) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TrafficMirrorFilter -func (mg *TrafficMirrorFilter) GetTerraformResourceType() string { - return "aws_ec2_traffic_mirror_filter" -} - -// GetConnectionDetailsMapping for this TrafficMirrorFilter -func (tr *TrafficMirrorFilter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TrafficMirrorFilter -func (tr *TrafficMirrorFilter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TrafficMirrorFilter -func (tr *TrafficMirrorFilter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TrafficMirrorFilter -func (tr *TrafficMirrorFilter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TrafficMirrorFilter -func (tr *TrafficMirrorFilter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TrafficMirrorFilter -func (tr *TrafficMirrorFilter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TrafficMirrorFilter -func (tr *TrafficMirrorFilter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TrafficMirrorFilter -func (tr *TrafficMirrorFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TrafficMirrorFilter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TrafficMirrorFilter) LateInitialize(attrs []byte) (bool, error) { - params := &TrafficMirrorFilterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TrafficMirrorFilter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TrafficMirrorFilterRule -func (mg *TrafficMirrorFilterRule) GetTerraformResourceType() string { - return "aws_ec2_traffic_mirror_filter_rule" -} - -// GetConnectionDetailsMapping for this TrafficMirrorFilterRule -func (tr *TrafficMirrorFilterRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TrafficMirrorFilterRule -func (tr *TrafficMirrorFilterRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TrafficMirrorFilterRule -func (tr *TrafficMirrorFilterRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TrafficMirrorFilterRule -func (tr *TrafficMirrorFilterRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TrafficMirrorFilterRule -func (tr *TrafficMirrorFilterRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TrafficMirrorFilterRule -func (tr *TrafficMirrorFilterRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TrafficMirrorFilterRule -func (tr *TrafficMirrorFilterRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TrafficMirrorFilterRule -func (tr *TrafficMirrorFilterRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TrafficMirrorFilterRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TrafficMirrorFilterRule) LateInitialize(attrs []byte) (bool, error) { - params := &TrafficMirrorFilterRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TrafficMirrorFilterRule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGateway -func (mg *TransitGateway) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway" -} - -// GetConnectionDetailsMapping for this TransitGateway -func (tr *TransitGateway) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGateway -func (tr *TransitGateway) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGateway -func (tr *TransitGateway) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGateway -func (tr *TransitGateway) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGateway -func (tr *TransitGateway) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGateway -func (tr *TransitGateway) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGateway -func (tr *TransitGateway) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGateway -func (tr *TransitGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGateway using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGateway) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGateway) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayConnect -func (mg *TransitGatewayConnect) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_connect" -} - -// GetConnectionDetailsMapping for this TransitGatewayConnect -func (tr *TransitGatewayConnect) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayConnect -func (tr *TransitGatewayConnect) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayConnect -func (tr *TransitGatewayConnect) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayConnect -func (tr *TransitGatewayConnect) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayConnect -func (tr *TransitGatewayConnect) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayConnect -func (tr *TransitGatewayConnect) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayConnect -func (tr *TransitGatewayConnect) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayConnect -func (tr *TransitGatewayConnect) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayConnect using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayConnect) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayConnectParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayConnect) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayConnectPeer -func (mg *TransitGatewayConnectPeer) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_connect_peer" -} - -// GetConnectionDetailsMapping for this TransitGatewayConnectPeer -func (tr *TransitGatewayConnectPeer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayConnectPeer -func (tr *TransitGatewayConnectPeer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayConnectPeer -func (tr *TransitGatewayConnectPeer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayConnectPeer -func (tr *TransitGatewayConnectPeer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayConnectPeer -func (tr *TransitGatewayConnectPeer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayConnectPeer -func (tr *TransitGatewayConnectPeer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayConnectPeer -func (tr *TransitGatewayConnectPeer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayConnectPeer -func (tr *TransitGatewayConnectPeer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayConnectPeer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayConnectPeer) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayConnectPeerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayConnectPeer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayMulticastDomain -func (mg *TransitGatewayMulticastDomain) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_multicast_domain" -} - -// GetConnectionDetailsMapping for this TransitGatewayMulticastDomain -func (tr *TransitGatewayMulticastDomain) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayMulticastDomain -func (tr *TransitGatewayMulticastDomain) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayMulticastDomain -func (tr *TransitGatewayMulticastDomain) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayMulticastDomain -func (tr *TransitGatewayMulticastDomain) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayMulticastDomain -func (tr *TransitGatewayMulticastDomain) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayMulticastDomain -func (tr *TransitGatewayMulticastDomain) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayMulticastDomain -func (tr *TransitGatewayMulticastDomain) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayMulticastDomain -func (tr *TransitGatewayMulticastDomain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayMulticastDomain using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayMulticastDomain) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayMulticastDomainParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayMulticastDomain) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayMulticastDomainAssociation -func (mg *TransitGatewayMulticastDomainAssociation) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_multicast_domain_association" -} - -// GetConnectionDetailsMapping for this TransitGatewayMulticastDomainAssociation -func (tr *TransitGatewayMulticastDomainAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayMulticastDomainAssociation -func (tr *TransitGatewayMulticastDomainAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayMulticastDomainAssociation -func (tr *TransitGatewayMulticastDomainAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayMulticastDomainAssociation -func (tr *TransitGatewayMulticastDomainAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayMulticastDomainAssociation -func (tr *TransitGatewayMulticastDomainAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayMulticastDomainAssociation -func (tr *TransitGatewayMulticastDomainAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayMulticastDomainAssociation -func (tr *TransitGatewayMulticastDomainAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayMulticastDomainAssociation -func (tr *TransitGatewayMulticastDomainAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayMulticastDomainAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayMulticastDomainAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayMulticastDomainAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayMulticastDomainAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayMulticastGroupMember -func (mg *TransitGatewayMulticastGroupMember) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_multicast_group_member" -} - -// GetConnectionDetailsMapping for this TransitGatewayMulticastGroupMember -func (tr *TransitGatewayMulticastGroupMember) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayMulticastGroupMember -func (tr *TransitGatewayMulticastGroupMember) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayMulticastGroupMember -func (tr *TransitGatewayMulticastGroupMember) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayMulticastGroupMember -func (tr *TransitGatewayMulticastGroupMember) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayMulticastGroupMember -func (tr *TransitGatewayMulticastGroupMember) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayMulticastGroupMember -func (tr *TransitGatewayMulticastGroupMember) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayMulticastGroupMember -func (tr *TransitGatewayMulticastGroupMember) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayMulticastGroupMember -func (tr *TransitGatewayMulticastGroupMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayMulticastGroupMember using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayMulticastGroupMember) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayMulticastGroupMemberParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayMulticastGroupMember) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayMulticastGroupSource -func (mg *TransitGatewayMulticastGroupSource) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_multicast_group_source" -} - -// GetConnectionDetailsMapping for this TransitGatewayMulticastGroupSource -func (tr *TransitGatewayMulticastGroupSource) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayMulticastGroupSource -func (tr *TransitGatewayMulticastGroupSource) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayMulticastGroupSource -func (tr *TransitGatewayMulticastGroupSource) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayMulticastGroupSource -func (tr *TransitGatewayMulticastGroupSource) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayMulticastGroupSource -func (tr *TransitGatewayMulticastGroupSource) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayMulticastGroupSource -func (tr *TransitGatewayMulticastGroupSource) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayMulticastGroupSource -func (tr *TransitGatewayMulticastGroupSource) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayMulticastGroupSource -func (tr *TransitGatewayMulticastGroupSource) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayMulticastGroupSource using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayMulticastGroupSource) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayMulticastGroupSourceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayMulticastGroupSource) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayPeeringAttachment -func (mg *TransitGatewayPeeringAttachment) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_peering_attachment" -} - -// GetConnectionDetailsMapping for this TransitGatewayPeeringAttachment -func (tr *TransitGatewayPeeringAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayPeeringAttachment -func (tr *TransitGatewayPeeringAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayPeeringAttachment -func (tr *TransitGatewayPeeringAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayPeeringAttachment -func (tr *TransitGatewayPeeringAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayPeeringAttachment -func (tr *TransitGatewayPeeringAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayPeeringAttachment -func (tr *TransitGatewayPeeringAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayPeeringAttachment -func (tr *TransitGatewayPeeringAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayPeeringAttachment -func (tr *TransitGatewayPeeringAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayPeeringAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayPeeringAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayPeeringAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayPeeringAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayPeeringAttachmentAccepter -func (mg *TransitGatewayPeeringAttachmentAccepter) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_peering_attachment_accepter" -} - -// GetConnectionDetailsMapping for this TransitGatewayPeeringAttachmentAccepter -func (tr *TransitGatewayPeeringAttachmentAccepter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayPeeringAttachmentAccepter -func (tr *TransitGatewayPeeringAttachmentAccepter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayPeeringAttachmentAccepter -func (tr *TransitGatewayPeeringAttachmentAccepter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayPeeringAttachmentAccepter -func (tr *TransitGatewayPeeringAttachmentAccepter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayPeeringAttachmentAccepter -func (tr *TransitGatewayPeeringAttachmentAccepter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayPeeringAttachmentAccepter -func (tr *TransitGatewayPeeringAttachmentAccepter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayPeeringAttachmentAccepter -func (tr *TransitGatewayPeeringAttachmentAccepter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayPeeringAttachmentAccepter -func (tr *TransitGatewayPeeringAttachmentAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayPeeringAttachmentAccepter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayPeeringAttachmentAccepter) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayPeeringAttachmentAccepterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayPeeringAttachmentAccepter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayPolicyTable -func (mg *TransitGatewayPolicyTable) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_policy_table" -} - -// GetConnectionDetailsMapping for this TransitGatewayPolicyTable -func (tr *TransitGatewayPolicyTable) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayPolicyTable -func (tr *TransitGatewayPolicyTable) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayPolicyTable -func (tr *TransitGatewayPolicyTable) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayPolicyTable -func (tr *TransitGatewayPolicyTable) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayPolicyTable -func (tr *TransitGatewayPolicyTable) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayPolicyTable -func (tr *TransitGatewayPolicyTable) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayPolicyTable -func (tr *TransitGatewayPolicyTable) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayPolicyTable -func (tr *TransitGatewayPolicyTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayPolicyTable using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayPolicyTable) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayPolicyTableParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayPolicyTable) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayPrefixListReference -func (mg *TransitGatewayPrefixListReference) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_prefix_list_reference" -} - -// GetConnectionDetailsMapping for this TransitGatewayPrefixListReference -func (tr *TransitGatewayPrefixListReference) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayPrefixListReference -func (tr *TransitGatewayPrefixListReference) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayPrefixListReference -func (tr *TransitGatewayPrefixListReference) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayPrefixListReference -func (tr *TransitGatewayPrefixListReference) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayPrefixListReference -func (tr *TransitGatewayPrefixListReference) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayPrefixListReference -func (tr *TransitGatewayPrefixListReference) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayPrefixListReference -func (tr *TransitGatewayPrefixListReference) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayPrefixListReference -func (tr *TransitGatewayPrefixListReference) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayPrefixListReference using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayPrefixListReference) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayPrefixListReferenceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayPrefixListReference) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayRoute -func (mg *TransitGatewayRoute) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_route" -} - -// GetConnectionDetailsMapping for this TransitGatewayRoute -func (tr *TransitGatewayRoute) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayRoute -func (tr *TransitGatewayRoute) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayRoute -func (tr *TransitGatewayRoute) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayRoute -func (tr *TransitGatewayRoute) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayRoute -func (tr *TransitGatewayRoute) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayRoute -func (tr *TransitGatewayRoute) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayRoute -func (tr *TransitGatewayRoute) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayRoute -func (tr *TransitGatewayRoute) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayRoute using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayRoute) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayRouteParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayRoute) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayRouteTable -func (mg *TransitGatewayRouteTable) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_route_table" -} - -// GetConnectionDetailsMapping for this TransitGatewayRouteTable -func (tr *TransitGatewayRouteTable) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayRouteTable -func (tr *TransitGatewayRouteTable) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayRouteTable -func (tr *TransitGatewayRouteTable) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayRouteTable -func (tr *TransitGatewayRouteTable) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayRouteTable -func (tr *TransitGatewayRouteTable) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayRouteTable -func (tr *TransitGatewayRouteTable) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayRouteTable -func (tr *TransitGatewayRouteTable) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayRouteTable -func (tr *TransitGatewayRouteTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayRouteTable using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayRouteTable) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayRouteTableParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayRouteTable) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayRouteTableAssociation -func (mg *TransitGatewayRouteTableAssociation) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_route_table_association" -} - -// GetConnectionDetailsMapping for this TransitGatewayRouteTableAssociation -func (tr *TransitGatewayRouteTableAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayRouteTableAssociation -func (tr *TransitGatewayRouteTableAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayRouteTableAssociation -func (tr *TransitGatewayRouteTableAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayRouteTableAssociation -func (tr *TransitGatewayRouteTableAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayRouteTableAssociation -func (tr *TransitGatewayRouteTableAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayRouteTableAssociation -func (tr *TransitGatewayRouteTableAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayRouteTableAssociation -func (tr *TransitGatewayRouteTableAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayRouteTableAssociation -func (tr *TransitGatewayRouteTableAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayRouteTableAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayRouteTableAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayRouteTableAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayRouteTableAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayRouteTablePropagation -func (mg *TransitGatewayRouteTablePropagation) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_route_table_propagation" -} - -// GetConnectionDetailsMapping for this TransitGatewayRouteTablePropagation -func (tr *TransitGatewayRouteTablePropagation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayRouteTablePropagation -func (tr *TransitGatewayRouteTablePropagation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayRouteTablePropagation -func (tr *TransitGatewayRouteTablePropagation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayRouteTablePropagation -func (tr *TransitGatewayRouteTablePropagation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayRouteTablePropagation -func (tr *TransitGatewayRouteTablePropagation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayRouteTablePropagation -func (tr *TransitGatewayRouteTablePropagation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayRouteTablePropagation -func (tr *TransitGatewayRouteTablePropagation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayRouteTablePropagation -func (tr *TransitGatewayRouteTablePropagation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayRouteTablePropagation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayRouteTablePropagation) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayRouteTablePropagationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayRouteTablePropagation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayVPCAttachment -func (mg *TransitGatewayVPCAttachment) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_vpc_attachment" -} - -// GetConnectionDetailsMapping for this TransitGatewayVPCAttachment -func (tr *TransitGatewayVPCAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayVPCAttachment -func (tr *TransitGatewayVPCAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayVPCAttachment -func (tr *TransitGatewayVPCAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayVPCAttachment -func (tr *TransitGatewayVPCAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayVPCAttachment -func (tr *TransitGatewayVPCAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayVPCAttachment -func (tr *TransitGatewayVPCAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayVPCAttachment -func (tr *TransitGatewayVPCAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayVPCAttachment -func (tr *TransitGatewayVPCAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayVPCAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayVPCAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayVPCAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayVPCAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayVPCAttachmentAccepter -func (mg *TransitGatewayVPCAttachmentAccepter) GetTerraformResourceType() string { - return "aws_ec2_transit_gateway_vpc_attachment_accepter" -} - -// GetConnectionDetailsMapping for this TransitGatewayVPCAttachmentAccepter -func (tr *TransitGatewayVPCAttachmentAccepter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayVPCAttachmentAccepter -func (tr *TransitGatewayVPCAttachmentAccepter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayVPCAttachmentAccepter -func (tr *TransitGatewayVPCAttachmentAccepter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayVPCAttachmentAccepter -func (tr *TransitGatewayVPCAttachmentAccepter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayVPCAttachmentAccepter -func (tr *TransitGatewayVPCAttachmentAccepter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayVPCAttachmentAccepter -func (tr *TransitGatewayVPCAttachmentAccepter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayVPCAttachmentAccepter -func (tr *TransitGatewayVPCAttachmentAccepter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayVPCAttachmentAccepter -func (tr *TransitGatewayVPCAttachmentAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayVPCAttachmentAccepter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayVPCAttachmentAccepter) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayVPCAttachmentAccepterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayVPCAttachmentAccepter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EgressOnlyInternetGateway -func (mg *EgressOnlyInternetGateway) GetTerraformResourceType() string { - return "aws_egress_only_internet_gateway" -} - -// GetConnectionDetailsMapping for this EgressOnlyInternetGateway -func (tr *EgressOnlyInternetGateway) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EgressOnlyInternetGateway -func (tr *EgressOnlyInternetGateway) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EgressOnlyInternetGateway -func (tr *EgressOnlyInternetGateway) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EgressOnlyInternetGateway -func (tr *EgressOnlyInternetGateway) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EgressOnlyInternetGateway -func (tr *EgressOnlyInternetGateway) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EgressOnlyInternetGateway -func (tr *EgressOnlyInternetGateway) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EgressOnlyInternetGateway -func (tr *EgressOnlyInternetGateway) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EgressOnlyInternetGateway -func (tr *EgressOnlyInternetGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EgressOnlyInternetGateway using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EgressOnlyInternetGateway) LateInitialize(attrs []byte) (bool, error) { - params := &EgressOnlyInternetGatewayParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EgressOnlyInternetGateway) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EIP -func (mg *EIP) GetTerraformResourceType() string { - return "aws_eip" -} - -// GetConnectionDetailsMapping for this EIP -func (tr *EIP) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EIP -func (tr *EIP) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EIP -func (tr *EIP) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EIP -func (tr *EIP) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EIP -func (tr *EIP) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EIP -func (tr *EIP) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EIP -func (tr *EIP) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EIP -func (tr *EIP) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EIP using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EIP) LateInitialize(attrs []byte) (bool, error) { - params := &EIPParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EIP) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EIPAssociation -func (mg *EIPAssociation) GetTerraformResourceType() string { - return "aws_eip_association" -} - -// GetConnectionDetailsMapping for this EIPAssociation -func (tr *EIPAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EIPAssociation -func (tr *EIPAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EIPAssociation -func (tr *EIPAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EIPAssociation -func (tr *EIPAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EIPAssociation -func (tr *EIPAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EIPAssociation -func (tr *EIPAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EIPAssociation -func (tr *EIPAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EIPAssociation -func (tr *EIPAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EIPAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EIPAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &EIPAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EIPAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FlowLog -func (mg *FlowLog) GetTerraformResourceType() string { - return "aws_flow_log" -} - -// GetConnectionDetailsMapping for this FlowLog -func (tr *FlowLog) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FlowLog -func (tr *FlowLog) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FlowLog -func (tr *FlowLog) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FlowLog -func (tr *FlowLog) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FlowLog -func (tr *FlowLog) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FlowLog -func (tr *FlowLog) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FlowLog -func (tr *FlowLog) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FlowLog -func (tr *FlowLog) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FlowLog using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FlowLog) LateInitialize(attrs []byte) (bool, error) { - params := &FlowLogParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("LogDestination")) - opts = append(opts, resource.WithNameFilter("LogFormat")) - opts = append(opts, resource.WithNameFilter("LogGroupName")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FlowLog) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Instance -func (mg *Instance) GetTerraformResourceType() string { - return "aws_instance" -} - -// GetConnectionDetailsMapping for this Instance -func (tr *Instance) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Instance -func (tr *Instance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Instance -func (tr *Instance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Instance -func (tr *Instance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Instance -func (tr *Instance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Instance -func (tr *Instance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Instance -func (tr *Instance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Instance -func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Instance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { - params := &InstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("AssociatePublicIPAddress")) - opts = append(opts, resource.WithNameFilter("CPUCoreCount")) - opts = append(opts, resource.WithNameFilter("CPUThreadsPerCore")) - opts = append(opts, resource.WithNameFilter("IPv6AddressCount")) - opts = append(opts, resource.WithNameFilter("IPv6Addresses")) - opts = append(opts, resource.WithNameFilter("NetworkInterface")) - opts = append(opts, resource.WithNameFilter("PrivateIP")) - opts = append(opts, resource.WithNameFilter("SourceDestCheck")) - opts = append(opts, resource.WithNameFilter("SubnetID")) - opts = append(opts, resource.WithNameFilter("VPCSecurityGroupIds")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Instance) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this InternetGateway -func (mg *InternetGateway) GetTerraformResourceType() string { - return "aws_internet_gateway" -} - -// GetConnectionDetailsMapping for this InternetGateway -func (tr *InternetGateway) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InternetGateway -func (tr *InternetGateway) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InternetGateway -func (tr *InternetGateway) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InternetGateway -func (tr *InternetGateway) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InternetGateway -func (tr *InternetGateway) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InternetGateway -func (tr *InternetGateway) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InternetGateway -func (tr *InternetGateway) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InternetGateway -func (tr *InternetGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InternetGateway using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InternetGateway) LateInitialize(attrs []byte) (bool, error) { - params := &InternetGatewayParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InternetGateway) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this KeyPair -func (mg *KeyPair) GetTerraformResourceType() string { - return "aws_key_pair" -} - -// GetConnectionDetailsMapping for this KeyPair -func (tr *KeyPair) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this KeyPair -func (tr *KeyPair) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this KeyPair -func (tr *KeyPair) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this KeyPair -func (tr *KeyPair) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this KeyPair -func (tr *KeyPair) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this KeyPair -func (tr *KeyPair) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this KeyPair -func (tr *KeyPair) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this KeyPair -func (tr *KeyPair) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this KeyPair using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *KeyPair) LateInitialize(attrs []byte) (bool, error) { - params := &KeyPairParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *KeyPair) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this LaunchTemplate -func (mg *LaunchTemplate) GetTerraformResourceType() string { - return "aws_launch_template" -} - -// GetConnectionDetailsMapping for this LaunchTemplate -func (tr *LaunchTemplate) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LaunchTemplate -func (tr *LaunchTemplate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LaunchTemplate -func (tr *LaunchTemplate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LaunchTemplate -func (tr *LaunchTemplate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LaunchTemplate -func (tr *LaunchTemplate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LaunchTemplate -func (tr *LaunchTemplate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LaunchTemplate -func (tr *LaunchTemplate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LaunchTemplate -func (tr *LaunchTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LaunchTemplate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LaunchTemplate) LateInitialize(attrs []byte) (bool, error) { - params := &LaunchTemplateParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LaunchTemplate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MainRouteTableAssociation -func (mg *MainRouteTableAssociation) GetTerraformResourceType() string { - return "aws_main_route_table_association" -} - -// GetConnectionDetailsMapping for this MainRouteTableAssociation -func (tr *MainRouteTableAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MainRouteTableAssociation -func (tr *MainRouteTableAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MainRouteTableAssociation -func (tr *MainRouteTableAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MainRouteTableAssociation -func (tr *MainRouteTableAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MainRouteTableAssociation -func (tr *MainRouteTableAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MainRouteTableAssociation -func (tr *MainRouteTableAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MainRouteTableAssociation -func (tr *MainRouteTableAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MainRouteTableAssociation -func (tr *MainRouteTableAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MainRouteTableAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MainRouteTableAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &MainRouteTableAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MainRouteTableAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NATGateway -func (mg *NATGateway) GetTerraformResourceType() string { - return "aws_nat_gateway" -} - -// GetConnectionDetailsMapping for this NATGateway -func (tr *NATGateway) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NATGateway -func (tr *NATGateway) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NATGateway -func (tr *NATGateway) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NATGateway -func (tr *NATGateway) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NATGateway -func (tr *NATGateway) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NATGateway -func (tr *NATGateway) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NATGateway -func (tr *NATGateway) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NATGateway -func (tr *NATGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NATGateway using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NATGateway) LateInitialize(attrs []byte) (bool, error) { - params := &NATGatewayParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NATGateway) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NetworkACL -func (mg *NetworkACL) GetTerraformResourceType() string { - return "aws_network_acl" -} - -// GetConnectionDetailsMapping for this NetworkACL -func (tr *NetworkACL) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NetworkACL -func (tr *NetworkACL) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NetworkACL -func (tr *NetworkACL) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NetworkACL -func (tr *NetworkACL) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NetworkACL -func (tr *NetworkACL) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NetworkACL -func (tr *NetworkACL) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NetworkACL -func (tr *NetworkACL) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NetworkACL -func (tr *NetworkACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NetworkACL using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NetworkACL) LateInitialize(attrs []byte) (bool, error) { - params := &NetworkACLParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NetworkACL) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NetworkACLRule -func (mg *NetworkACLRule) GetTerraformResourceType() string { - return "aws_network_acl_rule" -} - -// GetConnectionDetailsMapping for this NetworkACLRule -func (tr *NetworkACLRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NetworkACLRule -func (tr *NetworkACLRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NetworkACLRule -func (tr *NetworkACLRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NetworkACLRule -func (tr *NetworkACLRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NetworkACLRule -func (tr *NetworkACLRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NetworkACLRule -func (tr *NetworkACLRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NetworkACLRule -func (tr *NetworkACLRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NetworkACLRule -func (tr *NetworkACLRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NetworkACLRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NetworkACLRule) LateInitialize(attrs []byte) (bool, error) { - params := &NetworkACLRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NetworkACLRule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NetworkInterface -func (mg *NetworkInterface) GetTerraformResourceType() string { - return "aws_network_interface" -} - -// GetConnectionDetailsMapping for this NetworkInterface -func (tr *NetworkInterface) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NetworkInterface -func (tr *NetworkInterface) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NetworkInterface -func (tr *NetworkInterface) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NetworkInterface -func (tr *NetworkInterface) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NetworkInterface -func (tr *NetworkInterface) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NetworkInterface -func (tr *NetworkInterface) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NetworkInterface -func (tr *NetworkInterface) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NetworkInterface -func (tr *NetworkInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NetworkInterface using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NetworkInterface) LateInitialize(attrs []byte) (bool, error) { - params := &NetworkInterfaceParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("InterfaceType")) - opts = append(opts, resource.WithNameFilter("IPv6AddressCount")) - opts = append(opts, resource.WithNameFilter("IPv6Addresses")) - opts = append(opts, resource.WithNameFilter("PrivateIPList")) - opts = append(opts, resource.WithNameFilter("PrivateIps")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NetworkInterface) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NetworkInterfaceAttachment -func (mg *NetworkInterfaceAttachment) GetTerraformResourceType() string { - return "aws_network_interface_attachment" -} - -// GetConnectionDetailsMapping for this NetworkInterfaceAttachment -func (tr *NetworkInterfaceAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NetworkInterfaceAttachment -func (tr *NetworkInterfaceAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NetworkInterfaceAttachment -func (tr *NetworkInterfaceAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NetworkInterfaceAttachment -func (tr *NetworkInterfaceAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NetworkInterfaceAttachment -func (tr *NetworkInterfaceAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NetworkInterfaceAttachment -func (tr *NetworkInterfaceAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NetworkInterfaceAttachment -func (tr *NetworkInterfaceAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NetworkInterfaceAttachment -func (tr *NetworkInterfaceAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NetworkInterfaceAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NetworkInterfaceAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &NetworkInterfaceAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NetworkInterfaceAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NetworkInterfaceSgAttachment -func (mg *NetworkInterfaceSgAttachment) GetTerraformResourceType() string { - return "aws_network_interface_sg_attachment" -} - -// GetConnectionDetailsMapping for this NetworkInterfaceSgAttachment -func (tr *NetworkInterfaceSgAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NetworkInterfaceSgAttachment -func (tr *NetworkInterfaceSgAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NetworkInterfaceSgAttachment -func (tr *NetworkInterfaceSgAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NetworkInterfaceSgAttachment -func (tr *NetworkInterfaceSgAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NetworkInterfaceSgAttachment -func (tr *NetworkInterfaceSgAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NetworkInterfaceSgAttachment -func (tr *NetworkInterfaceSgAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NetworkInterfaceSgAttachment -func (tr *NetworkInterfaceSgAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NetworkInterfaceSgAttachment -func (tr *NetworkInterfaceSgAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NetworkInterfaceSgAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NetworkInterfaceSgAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &NetworkInterfaceSgAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NetworkInterfaceSgAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PlacementGroup -func (mg *PlacementGroup) GetTerraformResourceType() string { - return "aws_placement_group" -} - -// GetConnectionDetailsMapping for this PlacementGroup -func (tr *PlacementGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PlacementGroup -func (tr *PlacementGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PlacementGroup -func (tr *PlacementGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PlacementGroup -func (tr *PlacementGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PlacementGroup -func (tr *PlacementGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PlacementGroup -func (tr *PlacementGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PlacementGroup -func (tr *PlacementGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PlacementGroup -func (tr *PlacementGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PlacementGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PlacementGroup) LateInitialize(attrs []byte) (bool, error) { - params := &PlacementGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PlacementGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Route -func (mg *Route) GetTerraformResourceType() string { - return "aws_route" -} - -// GetConnectionDetailsMapping for this Route -func (tr *Route) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Route -func (tr *Route) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Route -func (tr *Route) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Route -func (tr *Route) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Route -func (tr *Route) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Route -func (tr *Route) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Route -func (tr *Route) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Route -func (tr *Route) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Route using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Route) LateInitialize(attrs []byte) (bool, error) { - params := &RouteParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Route) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RouteTable -func (mg *RouteTable) GetTerraformResourceType() string { - return "aws_route_table" -} - -// GetConnectionDetailsMapping for this RouteTable -func (tr *RouteTable) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RouteTable -func (tr *RouteTable) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RouteTable -func (tr *RouteTable) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RouteTable -func (tr *RouteTable) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RouteTable -func (tr *RouteTable) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RouteTable -func (tr *RouteTable) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RouteTable -func (tr *RouteTable) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RouteTable -func (tr *RouteTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RouteTable using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RouteTable) LateInitialize(attrs []byte) (bool, error) { - params := &RouteTableParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RouteTable) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RouteTableAssociation -func (mg *RouteTableAssociation) GetTerraformResourceType() string { - return "aws_route_table_association" -} - -// GetConnectionDetailsMapping for this RouteTableAssociation -func (tr *RouteTableAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RouteTableAssociation -func (tr *RouteTableAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RouteTableAssociation -func (tr *RouteTableAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RouteTableAssociation -func (tr *RouteTableAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RouteTableAssociation -func (tr *RouteTableAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RouteTableAssociation -func (tr *RouteTableAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RouteTableAssociation -func (tr *RouteTableAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RouteTableAssociation -func (tr *RouteTableAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RouteTableAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RouteTableAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &RouteTableAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RouteTableAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SecurityGroup -func (mg *SecurityGroup) GetTerraformResourceType() string { - return "aws_security_group" -} - -// GetConnectionDetailsMapping for this SecurityGroup -func (tr *SecurityGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SecurityGroup -func (tr *SecurityGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SecurityGroup -func (tr *SecurityGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SecurityGroup -func (tr *SecurityGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SecurityGroup -func (tr *SecurityGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SecurityGroup -func (tr *SecurityGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SecurityGroup -func (tr *SecurityGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SecurityGroup -func (tr *SecurityGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SecurityGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SecurityGroup) LateInitialize(attrs []byte) (bool, error) { - params := &SecurityGroupParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("Name")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SecurityGroup) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this SecurityGroupRule -func (mg *SecurityGroupRule) GetTerraformResourceType() string { - return "aws_security_group_rule" -} - -// GetConnectionDetailsMapping for this SecurityGroupRule -func (tr *SecurityGroupRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SecurityGroupRule -func (tr *SecurityGroupRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SecurityGroupRule -func (tr *SecurityGroupRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SecurityGroupRule -func (tr *SecurityGroupRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SecurityGroupRule -func (tr *SecurityGroupRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SecurityGroupRule -func (tr *SecurityGroupRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SecurityGroupRule -func (tr *SecurityGroupRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SecurityGroupRule -func (tr *SecurityGroupRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SecurityGroupRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SecurityGroupRule) LateInitialize(attrs []byte) (bool, error) { - params := &SecurityGroupRuleParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("CidrBlocks")) - opts = append(opts, resource.WithNameFilter("IPv6CidrBlocks")) - opts = append(opts, resource.WithNameFilter("Self")) - opts = append(opts, resource.WithNameFilter("SourceSecurityGroupID")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SecurityGroupRule) GetTerraformSchemaVersion() int { - return 2 -} - -// GetTerraformResourceType returns Terraform resource type for this SnapshotCreateVolumePermission -func (mg *SnapshotCreateVolumePermission) GetTerraformResourceType() string { - return "aws_snapshot_create_volume_permission" -} - -// GetConnectionDetailsMapping for this SnapshotCreateVolumePermission -func (tr *SnapshotCreateVolumePermission) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SnapshotCreateVolumePermission -func (tr *SnapshotCreateVolumePermission) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SnapshotCreateVolumePermission -func (tr *SnapshotCreateVolumePermission) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SnapshotCreateVolumePermission -func (tr *SnapshotCreateVolumePermission) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SnapshotCreateVolumePermission -func (tr *SnapshotCreateVolumePermission) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SnapshotCreateVolumePermission -func (tr *SnapshotCreateVolumePermission) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SnapshotCreateVolumePermission -func (tr *SnapshotCreateVolumePermission) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SnapshotCreateVolumePermission -func (tr *SnapshotCreateVolumePermission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SnapshotCreateVolumePermission using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SnapshotCreateVolumePermission) LateInitialize(attrs []byte) (bool, error) { - params := &SnapshotCreateVolumePermissionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SnapshotCreateVolumePermission) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SpotDatafeedSubscription -func (mg *SpotDatafeedSubscription) GetTerraformResourceType() string { - return "aws_spot_datafeed_subscription" -} - -// GetConnectionDetailsMapping for this SpotDatafeedSubscription -func (tr *SpotDatafeedSubscription) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SpotDatafeedSubscription -func (tr *SpotDatafeedSubscription) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SpotDatafeedSubscription -func (tr *SpotDatafeedSubscription) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SpotDatafeedSubscription -func (tr *SpotDatafeedSubscription) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SpotDatafeedSubscription -func (tr *SpotDatafeedSubscription) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SpotDatafeedSubscription -func (tr *SpotDatafeedSubscription) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SpotDatafeedSubscription -func (tr *SpotDatafeedSubscription) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SpotDatafeedSubscription -func (tr *SpotDatafeedSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SpotDatafeedSubscription using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SpotDatafeedSubscription) LateInitialize(attrs []byte) (bool, error) { - params := &SpotDatafeedSubscriptionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SpotDatafeedSubscription) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SpotFleetRequest -func (mg *SpotFleetRequest) GetTerraformResourceType() string { - return "aws_spot_fleet_request" -} - -// GetConnectionDetailsMapping for this SpotFleetRequest -func (tr *SpotFleetRequest) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SpotFleetRequest -func (tr *SpotFleetRequest) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SpotFleetRequest -func (tr *SpotFleetRequest) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SpotFleetRequest -func (tr *SpotFleetRequest) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SpotFleetRequest -func (tr *SpotFleetRequest) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SpotFleetRequest -func (tr *SpotFleetRequest) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SpotFleetRequest -func (tr *SpotFleetRequest) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SpotFleetRequest -func (tr *SpotFleetRequest) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SpotFleetRequest using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SpotFleetRequest) LateInitialize(attrs []byte) (bool, error) { - params := &SpotFleetRequestParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SpotFleetRequest) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this SpotInstanceRequest -func (mg *SpotInstanceRequest) GetTerraformResourceType() string { - return "aws_spot_instance_request" -} - -// GetConnectionDetailsMapping for this SpotInstanceRequest -func (tr *SpotInstanceRequest) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SpotInstanceRequest -func (tr *SpotInstanceRequest) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SpotInstanceRequest -func (tr *SpotInstanceRequest) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SpotInstanceRequest -func (tr *SpotInstanceRequest) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SpotInstanceRequest -func (tr *SpotInstanceRequest) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SpotInstanceRequest -func (tr *SpotInstanceRequest) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SpotInstanceRequest -func (tr *SpotInstanceRequest) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SpotInstanceRequest -func (tr *SpotInstanceRequest) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SpotInstanceRequest using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SpotInstanceRequest) LateInitialize(attrs []byte) (bool, error) { - params := &SpotInstanceRequestParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("InstanceInterruptionBehavior")) - opts = append(opts, resource.WithNameFilter("SourceDestCheck")) - opts = append(opts, resource.WithNameFilter("SpotType")) - opts = append(opts, resource.WithNameFilter("ValidFrom")) - opts = append(opts, resource.WithNameFilter("ValidUntil")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SpotInstanceRequest) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Subnet -func (mg *Subnet) GetTerraformResourceType() string { - return "aws_subnet" -} - -// GetConnectionDetailsMapping for this Subnet -func (tr *Subnet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Subnet -func (tr *Subnet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Subnet -func (tr *Subnet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Subnet -func (tr *Subnet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Subnet -func (tr *Subnet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Subnet -func (tr *Subnet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Subnet -func (tr *Subnet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Subnet -func (tr *Subnet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Subnet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Subnet) LateInitialize(attrs []byte) (bool, error) { - params := &SubnetParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("AvailabilityZoneID")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Subnet) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this VolumeAttachment -func (mg *VolumeAttachment) GetTerraformResourceType() string { - return "aws_volume_attachment" -} - -// GetConnectionDetailsMapping for this VolumeAttachment -func (tr *VolumeAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VolumeAttachment -func (tr *VolumeAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VolumeAttachment -func (tr *VolumeAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VolumeAttachment -func (tr *VolumeAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VolumeAttachment -func (tr *VolumeAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VolumeAttachment -func (tr *VolumeAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VolumeAttachment -func (tr *VolumeAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VolumeAttachment -func (tr *VolumeAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VolumeAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VolumeAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &VolumeAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VolumeAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPC -func (mg *VPC) GetTerraformResourceType() string { - return "aws_vpc" -} - -// GetConnectionDetailsMapping for this VPC -func (tr *VPC) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPC -func (tr *VPC) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPC -func (tr *VPC) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPC -func (tr *VPC) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPC -func (tr *VPC) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPC -func (tr *VPC) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPC -func (tr *VPC) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPC -func (tr *VPC) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPC using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPC) LateInitialize(attrs []byte) (bool, error) { - params := &VPCParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("CidrBlock")) - opts = append(opts, resource.WithNameFilter("IPv6CidrBlock")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPC) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCDHCPOptions -func (mg *VPCDHCPOptions) GetTerraformResourceType() string { - return "aws_vpc_dhcp_options" -} - -// GetConnectionDetailsMapping for this VPCDHCPOptions -func (tr *VPCDHCPOptions) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCDHCPOptions -func (tr *VPCDHCPOptions) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCDHCPOptions -func (tr *VPCDHCPOptions) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCDHCPOptions -func (tr *VPCDHCPOptions) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCDHCPOptions -func (tr *VPCDHCPOptions) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCDHCPOptions -func (tr *VPCDHCPOptions) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCDHCPOptions -func (tr *VPCDHCPOptions) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCDHCPOptions -func (tr *VPCDHCPOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCDHCPOptions using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCDHCPOptions) LateInitialize(attrs []byte) (bool, error) { - params := &VPCDHCPOptionsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCDHCPOptions) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCDHCPOptionsAssociation -func (mg *VPCDHCPOptionsAssociation) GetTerraformResourceType() string { - return "aws_vpc_dhcp_options_association" -} - -// GetConnectionDetailsMapping for this VPCDHCPOptionsAssociation -func (tr *VPCDHCPOptionsAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCDHCPOptionsAssociation -func (tr *VPCDHCPOptionsAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCDHCPOptionsAssociation -func (tr *VPCDHCPOptionsAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCDHCPOptionsAssociation -func (tr *VPCDHCPOptionsAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCDHCPOptionsAssociation -func (tr *VPCDHCPOptionsAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCDHCPOptionsAssociation -func (tr *VPCDHCPOptionsAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCDHCPOptionsAssociation -func (tr *VPCDHCPOptionsAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCDHCPOptionsAssociation -func (tr *VPCDHCPOptionsAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCDHCPOptionsAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCDHCPOptionsAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &VPCDHCPOptionsAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCDHCPOptionsAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCEndpoint -func (mg *VPCEndpoint) GetTerraformResourceType() string { - return "aws_vpc_endpoint" -} - -// GetConnectionDetailsMapping for this VPCEndpoint -func (tr *VPCEndpoint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCEndpoint -func (tr *VPCEndpoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCEndpoint -func (tr *VPCEndpoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCEndpoint -func (tr *VPCEndpoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCEndpoint -func (tr *VPCEndpoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCEndpoint -func (tr *VPCEndpoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCEndpoint -func (tr *VPCEndpoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCEndpoint -func (tr *VPCEndpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCEndpoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCEndpoint) LateInitialize(attrs []byte) (bool, error) { - params := &VPCEndpointParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCEndpoint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCEndpointConnectionNotification -func (mg *VPCEndpointConnectionNotification) GetTerraformResourceType() string { - return "aws_vpc_endpoint_connection_notification" -} - -// GetConnectionDetailsMapping for this VPCEndpointConnectionNotification -func (tr *VPCEndpointConnectionNotification) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCEndpointConnectionNotification -func (tr *VPCEndpointConnectionNotification) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCEndpointConnectionNotification -func (tr *VPCEndpointConnectionNotification) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCEndpointConnectionNotification -func (tr *VPCEndpointConnectionNotification) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCEndpointConnectionNotification -func (tr *VPCEndpointConnectionNotification) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCEndpointConnectionNotification -func (tr *VPCEndpointConnectionNotification) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCEndpointConnectionNotification -func (tr *VPCEndpointConnectionNotification) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCEndpointConnectionNotification -func (tr *VPCEndpointConnectionNotification) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCEndpointConnectionNotification using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCEndpointConnectionNotification) LateInitialize(attrs []byte) (bool, error) { - params := &VPCEndpointConnectionNotificationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCEndpointConnectionNotification) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCEndpointRouteTableAssociation -func (mg *VPCEndpointRouteTableAssociation) GetTerraformResourceType() string { - return "aws_vpc_endpoint_route_table_association" -} - -// GetConnectionDetailsMapping for this VPCEndpointRouteTableAssociation -func (tr *VPCEndpointRouteTableAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCEndpointRouteTableAssociation -func (tr *VPCEndpointRouteTableAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCEndpointRouteTableAssociation -func (tr *VPCEndpointRouteTableAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCEndpointRouteTableAssociation -func (tr *VPCEndpointRouteTableAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCEndpointRouteTableAssociation -func (tr *VPCEndpointRouteTableAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCEndpointRouteTableAssociation -func (tr *VPCEndpointRouteTableAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCEndpointRouteTableAssociation -func (tr *VPCEndpointRouteTableAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCEndpointRouteTableAssociation -func (tr *VPCEndpointRouteTableAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCEndpointRouteTableAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCEndpointRouteTableAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &VPCEndpointRouteTableAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCEndpointRouteTableAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCEndpointSecurityGroupAssociation -func (mg *VPCEndpointSecurityGroupAssociation) GetTerraformResourceType() string { - return "aws_vpc_endpoint_security_group_association" -} - -// GetConnectionDetailsMapping for this VPCEndpointSecurityGroupAssociation -func (tr *VPCEndpointSecurityGroupAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCEndpointSecurityGroupAssociation -func (tr *VPCEndpointSecurityGroupAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCEndpointSecurityGroupAssociation -func (tr *VPCEndpointSecurityGroupAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCEndpointSecurityGroupAssociation -func (tr *VPCEndpointSecurityGroupAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCEndpointSecurityGroupAssociation -func (tr *VPCEndpointSecurityGroupAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCEndpointSecurityGroupAssociation -func (tr *VPCEndpointSecurityGroupAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCEndpointSecurityGroupAssociation -func (tr *VPCEndpointSecurityGroupAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCEndpointSecurityGroupAssociation -func (tr *VPCEndpointSecurityGroupAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCEndpointSecurityGroupAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCEndpointSecurityGroupAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &VPCEndpointSecurityGroupAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCEndpointSecurityGroupAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCEndpointService -func (mg *VPCEndpointService) GetTerraformResourceType() string { - return "aws_vpc_endpoint_service" -} - -// GetConnectionDetailsMapping for this VPCEndpointService -func (tr *VPCEndpointService) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCEndpointService -func (tr *VPCEndpointService) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCEndpointService -func (tr *VPCEndpointService) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCEndpointService -func (tr *VPCEndpointService) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCEndpointService -func (tr *VPCEndpointService) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCEndpointService -func (tr *VPCEndpointService) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCEndpointService -func (tr *VPCEndpointService) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCEndpointService -func (tr *VPCEndpointService) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCEndpointService using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCEndpointService) LateInitialize(attrs []byte) (bool, error) { - params := &VPCEndpointServiceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCEndpointService) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCEndpointServiceAllowedPrincipal -func (mg *VPCEndpointServiceAllowedPrincipal) GetTerraformResourceType() string { - return "aws_vpc_endpoint_service_allowed_principal" -} - -// GetConnectionDetailsMapping for this VPCEndpointServiceAllowedPrincipal -func (tr *VPCEndpointServiceAllowedPrincipal) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCEndpointServiceAllowedPrincipal -func (tr *VPCEndpointServiceAllowedPrincipal) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCEndpointServiceAllowedPrincipal -func (tr *VPCEndpointServiceAllowedPrincipal) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCEndpointServiceAllowedPrincipal -func (tr *VPCEndpointServiceAllowedPrincipal) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCEndpointServiceAllowedPrincipal -func (tr *VPCEndpointServiceAllowedPrincipal) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCEndpointServiceAllowedPrincipal -func (tr *VPCEndpointServiceAllowedPrincipal) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCEndpointServiceAllowedPrincipal -func (tr *VPCEndpointServiceAllowedPrincipal) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCEndpointServiceAllowedPrincipal -func (tr *VPCEndpointServiceAllowedPrincipal) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCEndpointServiceAllowedPrincipal using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCEndpointServiceAllowedPrincipal) LateInitialize(attrs []byte) (bool, error) { - params := &VPCEndpointServiceAllowedPrincipalParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCEndpointServiceAllowedPrincipal) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCEndpointSubnetAssociation -func (mg *VPCEndpointSubnetAssociation) GetTerraformResourceType() string { - return "aws_vpc_endpoint_subnet_association" -} - -// GetConnectionDetailsMapping for this VPCEndpointSubnetAssociation -func (tr *VPCEndpointSubnetAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCEndpointSubnetAssociation -func (tr *VPCEndpointSubnetAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCEndpointSubnetAssociation -func (tr *VPCEndpointSubnetAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCEndpointSubnetAssociation -func (tr *VPCEndpointSubnetAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCEndpointSubnetAssociation -func (tr *VPCEndpointSubnetAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCEndpointSubnetAssociation -func (tr *VPCEndpointSubnetAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCEndpointSubnetAssociation -func (tr *VPCEndpointSubnetAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCEndpointSubnetAssociation -func (tr *VPCEndpointSubnetAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCEndpointSubnetAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCEndpointSubnetAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &VPCEndpointSubnetAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCEndpointSubnetAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCIpam -func (mg *VPCIpam) GetTerraformResourceType() string { - return "aws_vpc_ipam" -} - -// GetConnectionDetailsMapping for this VPCIpam -func (tr *VPCIpam) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCIpam -func (tr *VPCIpam) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCIpam -func (tr *VPCIpam) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCIpam -func (tr *VPCIpam) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCIpam -func (tr *VPCIpam) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCIpam -func (tr *VPCIpam) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCIpam -func (tr *VPCIpam) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCIpam -func (tr *VPCIpam) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCIpam using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCIpam) LateInitialize(attrs []byte) (bool, error) { - params := &VPCIpamParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCIpam) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCIpamPool -func (mg *VPCIpamPool) GetTerraformResourceType() string { - return "aws_vpc_ipam_pool" -} - -// GetConnectionDetailsMapping for this VPCIpamPool -func (tr *VPCIpamPool) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCIpamPool -func (tr *VPCIpamPool) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCIpamPool -func (tr *VPCIpamPool) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCIpamPool -func (tr *VPCIpamPool) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCIpamPool -func (tr *VPCIpamPool) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCIpamPool -func (tr *VPCIpamPool) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCIpamPool -func (tr *VPCIpamPool) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCIpamPool -func (tr *VPCIpamPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCIpamPool using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCIpamPool) LateInitialize(attrs []byte) (bool, error) { - params := &VPCIpamPoolParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCIpamPool) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCIpamPoolCidr -func (mg *VPCIpamPoolCidr) GetTerraformResourceType() string { - return "aws_vpc_ipam_pool_cidr" -} - -// GetConnectionDetailsMapping for this VPCIpamPoolCidr -func (tr *VPCIpamPoolCidr) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCIpamPoolCidr -func (tr *VPCIpamPoolCidr) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCIpamPoolCidr -func (tr *VPCIpamPoolCidr) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCIpamPoolCidr -func (tr *VPCIpamPoolCidr) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCIpamPoolCidr -func (tr *VPCIpamPoolCidr) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCIpamPoolCidr -func (tr *VPCIpamPoolCidr) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCIpamPoolCidr -func (tr *VPCIpamPoolCidr) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCIpamPoolCidr -func (tr *VPCIpamPoolCidr) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCIpamPoolCidr using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCIpamPoolCidr) LateInitialize(attrs []byte) (bool, error) { - params := &VPCIpamPoolCidrParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCIpamPoolCidr) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCIpamPoolCidrAllocation -func (mg *VPCIpamPoolCidrAllocation) GetTerraformResourceType() string { - return "aws_vpc_ipam_pool_cidr_allocation" -} - -// GetConnectionDetailsMapping for this VPCIpamPoolCidrAllocation -func (tr *VPCIpamPoolCidrAllocation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCIpamPoolCidrAllocation -func (tr *VPCIpamPoolCidrAllocation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCIpamPoolCidrAllocation -func (tr *VPCIpamPoolCidrAllocation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCIpamPoolCidrAllocation -func (tr *VPCIpamPoolCidrAllocation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCIpamPoolCidrAllocation -func (tr *VPCIpamPoolCidrAllocation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCIpamPoolCidrAllocation -func (tr *VPCIpamPoolCidrAllocation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCIpamPoolCidrAllocation -func (tr *VPCIpamPoolCidrAllocation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCIpamPoolCidrAllocation -func (tr *VPCIpamPoolCidrAllocation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCIpamPoolCidrAllocation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCIpamPoolCidrAllocation) LateInitialize(attrs []byte) (bool, error) { - params := &VPCIpamPoolCidrAllocationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCIpamPoolCidrAllocation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCIpamScope -func (mg *VPCIpamScope) GetTerraformResourceType() string { - return "aws_vpc_ipam_scope" -} - -// GetConnectionDetailsMapping for this VPCIpamScope -func (tr *VPCIpamScope) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCIpamScope -func (tr *VPCIpamScope) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCIpamScope -func (tr *VPCIpamScope) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCIpamScope -func (tr *VPCIpamScope) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCIpamScope -func (tr *VPCIpamScope) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCIpamScope -func (tr *VPCIpamScope) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCIpamScope -func (tr *VPCIpamScope) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCIpamScope -func (tr *VPCIpamScope) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCIpamScope using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCIpamScope) LateInitialize(attrs []byte) (bool, error) { - params := &VPCIpamScopeParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCIpamScope) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCIPv4CidrBlockAssociation -func (mg *VPCIPv4CidrBlockAssociation) GetTerraformResourceType() string { - return "aws_vpc_ipv4_cidr_block_association" -} - -// GetConnectionDetailsMapping for this VPCIPv4CidrBlockAssociation -func (tr *VPCIPv4CidrBlockAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCIPv4CidrBlockAssociation -func (tr *VPCIPv4CidrBlockAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCIPv4CidrBlockAssociation -func (tr *VPCIPv4CidrBlockAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCIPv4CidrBlockAssociation -func (tr *VPCIPv4CidrBlockAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCIPv4CidrBlockAssociation -func (tr *VPCIPv4CidrBlockAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCIPv4CidrBlockAssociation -func (tr *VPCIPv4CidrBlockAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCIPv4CidrBlockAssociation -func (tr *VPCIPv4CidrBlockAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCIPv4CidrBlockAssociation -func (tr *VPCIPv4CidrBlockAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCIPv4CidrBlockAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCIPv4CidrBlockAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &VPCIPv4CidrBlockAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCIPv4CidrBlockAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCPeeringConnection -func (mg *VPCPeeringConnection) GetTerraformResourceType() string { - return "aws_vpc_peering_connection" -} - -// GetConnectionDetailsMapping for this VPCPeeringConnection -func (tr *VPCPeeringConnection) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCPeeringConnection -func (tr *VPCPeeringConnection) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCPeeringConnection -func (tr *VPCPeeringConnection) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCPeeringConnection -func (tr *VPCPeeringConnection) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCPeeringConnection -func (tr *VPCPeeringConnection) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCPeeringConnection -func (tr *VPCPeeringConnection) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCPeeringConnection -func (tr *VPCPeeringConnection) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCPeeringConnection -func (tr *VPCPeeringConnection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCPeeringConnection using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCPeeringConnection) LateInitialize(attrs []byte) (bool, error) { - params := &VPCPeeringConnectionParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCPeeringConnection) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCPeeringConnectionAccepter -func (mg *VPCPeeringConnectionAccepter) GetTerraformResourceType() string { - return "aws_vpc_peering_connection_accepter" -} - -// GetConnectionDetailsMapping for this VPCPeeringConnectionAccepter -func (tr *VPCPeeringConnectionAccepter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCPeeringConnectionAccepter -func (tr *VPCPeeringConnectionAccepter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCPeeringConnectionAccepter -func (tr *VPCPeeringConnectionAccepter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCPeeringConnectionAccepter -func (tr *VPCPeeringConnectionAccepter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCPeeringConnectionAccepter -func (tr *VPCPeeringConnectionAccepter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCPeeringConnectionAccepter -func (tr *VPCPeeringConnectionAccepter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCPeeringConnectionAccepter -func (tr *VPCPeeringConnectionAccepter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCPeeringConnectionAccepter -func (tr *VPCPeeringConnectionAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCPeeringConnectionAccepter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCPeeringConnectionAccepter) LateInitialize(attrs []byte) (bool, error) { - params := &VPCPeeringConnectionAccepterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCPeeringConnectionAccepter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCPeeringConnectionOptions -func (mg *VPCPeeringConnectionOptions) GetTerraformResourceType() string { - return "aws_vpc_peering_connection_options" -} - -// GetConnectionDetailsMapping for this VPCPeeringConnectionOptions -func (tr *VPCPeeringConnectionOptions) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCPeeringConnectionOptions -func (tr *VPCPeeringConnectionOptions) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCPeeringConnectionOptions -func (tr *VPCPeeringConnectionOptions) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCPeeringConnectionOptions -func (tr *VPCPeeringConnectionOptions) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCPeeringConnectionOptions -func (tr *VPCPeeringConnectionOptions) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCPeeringConnectionOptions -func (tr *VPCPeeringConnectionOptions) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCPeeringConnectionOptions -func (tr *VPCPeeringConnectionOptions) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCPeeringConnectionOptions -func (tr *VPCPeeringConnectionOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCPeeringConnectionOptions using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCPeeringConnectionOptions) LateInitialize(attrs []byte) (bool, error) { - params := &VPCPeeringConnectionOptionsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCPeeringConnectionOptions) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SecurityGroupEgressRule -func (mg *SecurityGroupEgressRule) GetTerraformResourceType() string { - return "aws_vpc_security_group_egress_rule" -} - -// GetConnectionDetailsMapping for this SecurityGroupEgressRule -func (tr *SecurityGroupEgressRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SecurityGroupEgressRule -func (tr *SecurityGroupEgressRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SecurityGroupEgressRule -func (tr *SecurityGroupEgressRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SecurityGroupEgressRule -func (tr *SecurityGroupEgressRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SecurityGroupEgressRule -func (tr *SecurityGroupEgressRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SecurityGroupEgressRule -func (tr *SecurityGroupEgressRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SecurityGroupEgressRule -func (tr *SecurityGroupEgressRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SecurityGroupEgressRule -func (tr *SecurityGroupEgressRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SecurityGroupEgressRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SecurityGroupEgressRule) LateInitialize(attrs []byte) (bool, error) { - params := &SecurityGroupEgressRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SecurityGroupEgressRule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SecurityGroupIngressRule -func (mg *SecurityGroupIngressRule) GetTerraformResourceType() string { - return "aws_vpc_security_group_ingress_rule" -} - -// GetConnectionDetailsMapping for this SecurityGroupIngressRule -func (tr *SecurityGroupIngressRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SecurityGroupIngressRule -func (tr *SecurityGroupIngressRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SecurityGroupIngressRule -func (tr *SecurityGroupIngressRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SecurityGroupIngressRule -func (tr *SecurityGroupIngressRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SecurityGroupIngressRule -func (tr *SecurityGroupIngressRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SecurityGroupIngressRule -func (tr *SecurityGroupIngressRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SecurityGroupIngressRule -func (tr *SecurityGroupIngressRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SecurityGroupIngressRule -func (tr *SecurityGroupIngressRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SecurityGroupIngressRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SecurityGroupIngressRule) LateInitialize(attrs []byte) (bool, error) { - params := &SecurityGroupIngressRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SecurityGroupIngressRule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPNConnection -func (mg *VPNConnection) GetTerraformResourceType() string { - return "aws_vpn_connection" -} - -// GetConnectionDetailsMapping for this VPNConnection -func (tr *VPNConnection) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"customer_gateway_configuration": "status.atProvider.customerGatewayConfiguration", "tunnel1_preshared_key": "spec.forProvider.tunnel1PresharedKeySecretRef", "tunnel2_preshared_key": "spec.forProvider.tunnel2PresharedKeySecretRef"} -} - -// GetObservation of this VPNConnection -func (tr *VPNConnection) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPNConnection -func (tr *VPNConnection) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPNConnection -func (tr *VPNConnection) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPNConnection -func (tr *VPNConnection) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPNConnection -func (tr *VPNConnection) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPNConnection -func (tr *VPNConnection) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPNConnection -func (tr *VPNConnection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPNConnection using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPNConnection) LateInitialize(attrs []byte) (bool, error) { - params := &VPNConnectionParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPNConnection) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPNConnectionRoute -func (mg *VPNConnectionRoute) GetTerraformResourceType() string { - return "aws_vpn_connection_route" -} - -// GetConnectionDetailsMapping for this VPNConnectionRoute -func (tr *VPNConnectionRoute) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPNConnectionRoute -func (tr *VPNConnectionRoute) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPNConnectionRoute -func (tr *VPNConnectionRoute) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPNConnectionRoute -func (tr *VPNConnectionRoute) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPNConnectionRoute -func (tr *VPNConnectionRoute) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPNConnectionRoute -func (tr *VPNConnectionRoute) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPNConnectionRoute -func (tr *VPNConnectionRoute) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPNConnectionRoute -func (tr *VPNConnectionRoute) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPNConnectionRoute using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPNConnectionRoute) LateInitialize(attrs []byte) (bool, error) { - params := &VPNConnectionRouteParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPNConnectionRoute) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPNGateway -func (mg *VPNGateway) GetTerraformResourceType() string { - return "aws_vpn_gateway" -} - -// GetConnectionDetailsMapping for this VPNGateway -func (tr *VPNGateway) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPNGateway -func (tr *VPNGateway) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPNGateway -func (tr *VPNGateway) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPNGateway -func (tr *VPNGateway) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPNGateway -func (tr *VPNGateway) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPNGateway -func (tr *VPNGateway) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPNGateway -func (tr *VPNGateway) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPNGateway -func (tr *VPNGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPNGateway using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPNGateway) LateInitialize(attrs []byte) (bool, error) { - params := &VPNGatewayParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPNGateway) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPNGatewayAttachment -func (mg *VPNGatewayAttachment) GetTerraformResourceType() string { - return "aws_vpn_gateway_attachment" -} - -// GetConnectionDetailsMapping for this VPNGatewayAttachment -func (tr *VPNGatewayAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPNGatewayAttachment -func (tr *VPNGatewayAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPNGatewayAttachment -func (tr *VPNGatewayAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPNGatewayAttachment -func (tr *VPNGatewayAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPNGatewayAttachment -func (tr *VPNGatewayAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPNGatewayAttachment -func (tr *VPNGatewayAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPNGatewayAttachment -func (tr *VPNGatewayAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPNGatewayAttachment -func (tr *VPNGatewayAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPNGatewayAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPNGatewayAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &VPNGatewayAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPNGatewayAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPNGatewayRoutePropagation -func (mg *VPNGatewayRoutePropagation) GetTerraformResourceType() string { - return "aws_vpn_gateway_route_propagation" -} - -// GetConnectionDetailsMapping for this VPNGatewayRoutePropagation -func (tr *VPNGatewayRoutePropagation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPNGatewayRoutePropagation -func (tr *VPNGatewayRoutePropagation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPNGatewayRoutePropagation -func (tr *VPNGatewayRoutePropagation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPNGatewayRoutePropagation -func (tr *VPNGatewayRoutePropagation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPNGatewayRoutePropagation -func (tr *VPNGatewayRoutePropagation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPNGatewayRoutePropagation -func (tr *VPNGatewayRoutePropagation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPNGatewayRoutePropagation -func (tr *VPNGatewayRoutePropagation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPNGatewayRoutePropagation -func (tr *VPNGatewayRoutePropagation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPNGatewayRoutePropagation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPNGatewayRoutePropagation) LateInitialize(attrs []byte) (bool, error) { - params := &VPNGatewayRoutePropagationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPNGatewayRoutePropagation) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/ec2/v1beta1/zz_host_terraformed.go b/apis/ec2/v1beta1/zz_host_terraformed.go new file mode 100755 index 0000000000..8c642ea3a1 --- /dev/null +++ b/apis/ec2/v1beta1/zz_host_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Host +func (mg *Host) GetTerraformResourceType() string { + return "aws_ec2_host" +} + +// GetConnectionDetailsMapping for this Host +func (tr *Host) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Host +func (tr *Host) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Host +func (tr *Host) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Host +func (tr *Host) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Host +func (tr *Host) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Host +func (tr *Host) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Host +func (tr *Host) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Host +func (tr *Host) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Host using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Host) LateInitialize(attrs []byte) (bool, error) { + params := &HostParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Host) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_host_types.go b/apis/ec2/v1beta1/zz_host_types.go index 39ab244e23..1150c56436 100755 --- a/apis/ec2/v1beta1/zz_host_types.go +++ b/apis/ec2/v1beta1/zz_host_types.go @@ -141,13 +141,14 @@ type HostStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Host is the Schema for the Hosts API. Provides an EC2 Host resource. This allows Dedicated Hosts to be allocated, modified, and released. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Host struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_instance_terraformed.go b/apis/ec2/v1beta1/zz_instance_terraformed.go new file mode 100755 index 0000000000..a3d0199ac9 --- /dev/null +++ b/apis/ec2/v1beta1/zz_instance_terraformed.go @@ -0,0 +1,143 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Instance +func (mg *Instance) GetTerraformResourceType() string { + return "aws_instance" +} + +// GetConnectionDetailsMapping for this Instance +func (tr *Instance) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Instance +func (tr *Instance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Instance +func (tr *Instance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Instance +func (tr *Instance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Instance +func (tr *Instance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Instance +func (tr *Instance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Instance +func (tr *Instance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Instance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { + params := &InstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("AssociatePublicIPAddress")) + opts = append(opts, resource.WithNameFilter("CPUCoreCount")) + opts = append(opts, resource.WithNameFilter("CPUThreadsPerCore")) + opts = append(opts, resource.WithNameFilter("IPv6AddressCount")) + opts = append(opts, resource.WithNameFilter("IPv6Addresses")) + opts = append(opts, resource.WithNameFilter("NetworkInterface")) + opts = append(opts, resource.WithNameFilter("PrivateIP")) + opts = append(opts, resource.WithNameFilter("SourceDestCheck")) + opts = append(opts, resource.WithNameFilter("SubnetID")) + opts = append(opts, resource.WithNameFilter("VPCSecurityGroupIds")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Instance) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ec2/v1beta1/zz_instance_types.go b/apis/ec2/v1beta1/zz_instance_types.go index 9416605fc3..3b1b64d540 100755 --- a/apis/ec2/v1beta1/zz_instance_types.go +++ b/apis/ec2/v1beta1/zz_instance_types.go @@ -1218,13 +1218,14 @@ type InstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Instance is the Schema for the Instances API. Provides an EC2 instance resource. This allows instances to be created, updated, and deleted. Instances also support provisioning. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Instance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_instancestate_terraformed.go b/apis/ec2/v1beta1/zz_instancestate_terraformed.go new file mode 100755 index 0000000000..5af44ca17a --- /dev/null +++ b/apis/ec2/v1beta1/zz_instancestate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InstanceState +func (mg *InstanceState) GetTerraformResourceType() string { + return "aws_ec2_instance_state" +} + +// GetConnectionDetailsMapping for this InstanceState +func (tr *InstanceState) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InstanceState +func (tr *InstanceState) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InstanceState +func (tr *InstanceState) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InstanceState +func (tr *InstanceState) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InstanceState +func (tr *InstanceState) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InstanceState +func (tr *InstanceState) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InstanceState +func (tr *InstanceState) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InstanceState +func (tr *InstanceState) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InstanceState using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InstanceState) LateInitialize(attrs []byte) (bool, error) { + params := &InstanceStateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InstanceState) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_instancestate_types.go b/apis/ec2/v1beta1/zz_instancestate_types.go index c8775af209..756ffe6d50 100755 --- a/apis/ec2/v1beta1/zz_instancestate_types.go +++ b/apis/ec2/v1beta1/zz_instancestate_types.go @@ -108,13 +108,14 @@ type InstanceStateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InstanceState is the Schema for the InstanceStates API. Provides an EC2 instance state resource. This allows managing an instance power state. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InstanceState struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_internetgateway_terraformed.go b/apis/ec2/v1beta1/zz_internetgateway_terraformed.go new file mode 100755 index 0000000000..d4fa3b6d56 --- /dev/null +++ b/apis/ec2/v1beta1/zz_internetgateway_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InternetGateway +func (mg *InternetGateway) GetTerraformResourceType() string { + return "aws_internet_gateway" +} + +// GetConnectionDetailsMapping for this InternetGateway +func (tr *InternetGateway) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InternetGateway +func (tr *InternetGateway) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InternetGateway +func (tr *InternetGateway) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InternetGateway +func (tr *InternetGateway) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InternetGateway +func (tr *InternetGateway) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InternetGateway +func (tr *InternetGateway) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InternetGateway +func (tr *InternetGateway) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InternetGateway +func (tr *InternetGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InternetGateway using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InternetGateway) LateInitialize(attrs []byte) (bool, error) { + params := &InternetGatewayParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InternetGateway) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_internetgateway_types.go b/apis/ec2/v1beta1/zz_internetgateway_types.go index f2afd495e0..29e0243796 100755 --- a/apis/ec2/v1beta1/zz_internetgateway_types.go +++ b/apis/ec2/v1beta1/zz_internetgateway_types.go @@ -109,13 +109,14 @@ type InternetGatewayStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InternetGateway is the Schema for the InternetGateways API. Provides a resource to create a VPC Internet Gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InternetGateway struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_keypair_terraformed.go b/apis/ec2/v1beta1/zz_keypair_terraformed.go new file mode 100755 index 0000000000..7f90942540 --- /dev/null +++ b/apis/ec2/v1beta1/zz_keypair_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this KeyPair +func (mg *KeyPair) GetTerraformResourceType() string { + return "aws_key_pair" +} + +// GetConnectionDetailsMapping for this KeyPair +func (tr *KeyPair) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this KeyPair +func (tr *KeyPair) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this KeyPair +func (tr *KeyPair) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this KeyPair +func (tr *KeyPair) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this KeyPair +func (tr *KeyPair) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this KeyPair +func (tr *KeyPair) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this KeyPair +func (tr *KeyPair) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this KeyPair +func (tr *KeyPair) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this KeyPair using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *KeyPair) LateInitialize(attrs []byte) (bool, error) { + params := &KeyPairParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *KeyPair) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ec2/v1beta1/zz_keypair_types.go b/apis/ec2/v1beta1/zz_keypair_types.go index f43130bd89..54c5654d6b 100755 --- a/apis/ec2/v1beta1/zz_keypair_types.go +++ b/apis/ec2/v1beta1/zz_keypair_types.go @@ -97,13 +97,14 @@ type KeyPairStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // KeyPair is the Schema for the KeyPairs API. Provides a Key Pair resource. Currently this supports importing an existing key pair but not creating a new key pair. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type KeyPair struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_launchtemplate_terraformed.go b/apis/ec2/v1beta1/zz_launchtemplate_terraformed.go new file mode 100755 index 0000000000..a074aec08e --- /dev/null +++ b/apis/ec2/v1beta1/zz_launchtemplate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LaunchTemplate +func (mg *LaunchTemplate) GetTerraformResourceType() string { + return "aws_launch_template" +} + +// GetConnectionDetailsMapping for this LaunchTemplate +func (tr *LaunchTemplate) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LaunchTemplate +func (tr *LaunchTemplate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LaunchTemplate +func (tr *LaunchTemplate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LaunchTemplate +func (tr *LaunchTemplate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LaunchTemplate +func (tr *LaunchTemplate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LaunchTemplate +func (tr *LaunchTemplate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LaunchTemplate +func (tr *LaunchTemplate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LaunchTemplate +func (tr *LaunchTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LaunchTemplate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LaunchTemplate) LateInitialize(attrs []byte) (bool, error) { + params := &LaunchTemplateParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LaunchTemplate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_launchtemplate_types.go b/apis/ec2/v1beta1/zz_launchtemplate_types.go index 364fbc48bb..455c31219a 100755 --- a/apis/ec2/v1beta1/zz_launchtemplate_types.go +++ b/apis/ec2/v1beta1/zz_launchtemplate_types.go @@ -2133,13 +2133,14 @@ type LaunchTemplateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LaunchTemplate is the Schema for the LaunchTemplates API. Provides an EC2 launch template resource. Can be used to create instances or auto scaling groups. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LaunchTemplate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_mainroutetableassociation_terraformed.go b/apis/ec2/v1beta1/zz_mainroutetableassociation_terraformed.go new file mode 100755 index 0000000000..0ec782e1e0 --- /dev/null +++ b/apis/ec2/v1beta1/zz_mainroutetableassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MainRouteTableAssociation +func (mg *MainRouteTableAssociation) GetTerraformResourceType() string { + return "aws_main_route_table_association" +} + +// GetConnectionDetailsMapping for this MainRouteTableAssociation +func (tr *MainRouteTableAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MainRouteTableAssociation +func (tr *MainRouteTableAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MainRouteTableAssociation +func (tr *MainRouteTableAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MainRouteTableAssociation +func (tr *MainRouteTableAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MainRouteTableAssociation +func (tr *MainRouteTableAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MainRouteTableAssociation +func (tr *MainRouteTableAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MainRouteTableAssociation +func (tr *MainRouteTableAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MainRouteTableAssociation +func (tr *MainRouteTableAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MainRouteTableAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MainRouteTableAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &MainRouteTableAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MainRouteTableAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_mainroutetableassociation_types.go b/apis/ec2/v1beta1/zz_mainroutetableassociation_types.go index 0e73882542..33b64893bc 100755 --- a/apis/ec2/v1beta1/zz_mainroutetableassociation_types.go +++ b/apis/ec2/v1beta1/zz_mainroutetableassociation_types.go @@ -120,13 +120,14 @@ type MainRouteTableAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MainRouteTableAssociation is the Schema for the MainRouteTableAssociations API. Provides a resource for managing the main routing table of a VPC. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MainRouteTableAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_managedprefixlist_terraformed.go b/apis/ec2/v1beta1/zz_managedprefixlist_terraformed.go new file mode 100755 index 0000000000..bfc3ea826b --- /dev/null +++ b/apis/ec2/v1beta1/zz_managedprefixlist_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ManagedPrefixList +func (mg *ManagedPrefixList) GetTerraformResourceType() string { + return "aws_ec2_managed_prefix_list" +} + +// GetConnectionDetailsMapping for this ManagedPrefixList +func (tr *ManagedPrefixList) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ManagedPrefixList +func (tr *ManagedPrefixList) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ManagedPrefixList +func (tr *ManagedPrefixList) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ManagedPrefixList +func (tr *ManagedPrefixList) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ManagedPrefixList +func (tr *ManagedPrefixList) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ManagedPrefixList +func (tr *ManagedPrefixList) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ManagedPrefixList +func (tr *ManagedPrefixList) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ManagedPrefixList +func (tr *ManagedPrefixList) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ManagedPrefixList using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ManagedPrefixList) LateInitialize(attrs []byte) (bool, error) { + params := &ManagedPrefixListParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ManagedPrefixList) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_managedprefixlist_types.go b/apis/ec2/v1beta1/zz_managedprefixlist_types.go index a78e02dc0d..244fb8aac2 100755 --- a/apis/ec2/v1beta1/zz_managedprefixlist_types.go +++ b/apis/ec2/v1beta1/zz_managedprefixlist_types.go @@ -173,13 +173,14 @@ type ManagedPrefixListStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ManagedPrefixList is the Schema for the ManagedPrefixLists API. Provides a managed prefix list resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ManagedPrefixList struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_managedprefixlistentry_terraformed.go b/apis/ec2/v1beta1/zz_managedprefixlistentry_terraformed.go new file mode 100755 index 0000000000..d3a48c8a80 --- /dev/null +++ b/apis/ec2/v1beta1/zz_managedprefixlistentry_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ManagedPrefixListEntry +func (mg *ManagedPrefixListEntry) GetTerraformResourceType() string { + return "aws_ec2_managed_prefix_list_entry" +} + +// GetConnectionDetailsMapping for this ManagedPrefixListEntry +func (tr *ManagedPrefixListEntry) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ManagedPrefixListEntry +func (tr *ManagedPrefixListEntry) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ManagedPrefixListEntry +func (tr *ManagedPrefixListEntry) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ManagedPrefixListEntry +func (tr *ManagedPrefixListEntry) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ManagedPrefixListEntry +func (tr *ManagedPrefixListEntry) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ManagedPrefixListEntry +func (tr *ManagedPrefixListEntry) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ManagedPrefixListEntry +func (tr *ManagedPrefixListEntry) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ManagedPrefixListEntry +func (tr *ManagedPrefixListEntry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ManagedPrefixListEntry using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ManagedPrefixListEntry) LateInitialize(attrs []byte) (bool, error) { + params := &ManagedPrefixListEntryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ManagedPrefixListEntry) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_managedprefixlistentry_types.go b/apis/ec2/v1beta1/zz_managedprefixlistentry_types.go index 518e78c46f..c0b82aad4a 100755 --- a/apis/ec2/v1beta1/zz_managedprefixlistentry_types.go +++ b/apis/ec2/v1beta1/zz_managedprefixlistentry_types.go @@ -128,13 +128,14 @@ type ManagedPrefixListEntryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ManagedPrefixListEntry is the Schema for the ManagedPrefixListEntrys API. Provides a managed prefix list entry resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ManagedPrefixListEntry struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_natgateway_terraformed.go b/apis/ec2/v1beta1/zz_natgateway_terraformed.go new file mode 100755 index 0000000000..39e578e37f --- /dev/null +++ b/apis/ec2/v1beta1/zz_natgateway_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NATGateway +func (mg *NATGateway) GetTerraformResourceType() string { + return "aws_nat_gateway" +} + +// GetConnectionDetailsMapping for this NATGateway +func (tr *NATGateway) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NATGateway +func (tr *NATGateway) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NATGateway +func (tr *NATGateway) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NATGateway +func (tr *NATGateway) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NATGateway +func (tr *NATGateway) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NATGateway +func (tr *NATGateway) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NATGateway +func (tr *NATGateway) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NATGateway +func (tr *NATGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NATGateway using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NATGateway) LateInitialize(attrs []byte) (bool, error) { + params := &NATGatewayParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NATGateway) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_natgateway_types.go b/apis/ec2/v1beta1/zz_natgateway_types.go index 52e3ca0b62..8763374a0f 100755 --- a/apis/ec2/v1beta1/zz_natgateway_types.go +++ b/apis/ec2/v1beta1/zz_natgateway_types.go @@ -162,13 +162,14 @@ type NATGatewayStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NATGateway is the Schema for the NATGateways API. Provides a resource to create a VPC NAT Gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NATGateway struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_networkacl_terraformed.go b/apis/ec2/v1beta1/zz_networkacl_terraformed.go new file mode 100755 index 0000000000..00276bcdb1 --- /dev/null +++ b/apis/ec2/v1beta1/zz_networkacl_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NetworkACL +func (mg *NetworkACL) GetTerraformResourceType() string { + return "aws_network_acl" +} + +// GetConnectionDetailsMapping for this NetworkACL +func (tr *NetworkACL) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NetworkACL +func (tr *NetworkACL) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NetworkACL +func (tr *NetworkACL) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NetworkACL +func (tr *NetworkACL) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NetworkACL +func (tr *NetworkACL) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NetworkACL +func (tr *NetworkACL) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NetworkACL +func (tr *NetworkACL) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NetworkACL +func (tr *NetworkACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NetworkACL using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NetworkACL) LateInitialize(attrs []byte) (bool, error) { + params := &NetworkACLParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NetworkACL) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_networkacl_types.go b/apis/ec2/v1beta1/zz_networkacl_types.go index 6dba884235..538df69e7a 100755 --- a/apis/ec2/v1beta1/zz_networkacl_types.go +++ b/apis/ec2/v1beta1/zz_networkacl_types.go @@ -228,13 +228,14 @@ type NetworkACLStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NetworkACL is the Schema for the NetworkACLs API. Provides an network ACL resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NetworkACL struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_networkaclrule_terraformed.go b/apis/ec2/v1beta1/zz_networkaclrule_terraformed.go new file mode 100755 index 0000000000..e64263764b --- /dev/null +++ b/apis/ec2/v1beta1/zz_networkaclrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NetworkACLRule +func (mg *NetworkACLRule) GetTerraformResourceType() string { + return "aws_network_acl_rule" +} + +// GetConnectionDetailsMapping for this NetworkACLRule +func (tr *NetworkACLRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NetworkACLRule +func (tr *NetworkACLRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NetworkACLRule +func (tr *NetworkACLRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NetworkACLRule +func (tr *NetworkACLRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NetworkACLRule +func (tr *NetworkACLRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NetworkACLRule +func (tr *NetworkACLRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NetworkACLRule +func (tr *NetworkACLRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NetworkACLRule +func (tr *NetworkACLRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NetworkACLRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NetworkACLRule) LateInitialize(attrs []byte) (bool, error) { + params := &NetworkACLRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NetworkACLRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_networkaclrule_types.go b/apis/ec2/v1beta1/zz_networkaclrule_types.go index a7af66ef14..5e86ffca8b 100755 --- a/apis/ec2/v1beta1/zz_networkaclrule_types.go +++ b/apis/ec2/v1beta1/zz_networkaclrule_types.go @@ -188,13 +188,14 @@ type NetworkACLRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NetworkACLRule is the Schema for the NetworkACLRules API. Provides an network ACL Rule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NetworkACLRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_networkinsightsanalysis_terraformed.go b/apis/ec2/v1beta1/zz_networkinsightsanalysis_terraformed.go new file mode 100755 index 0000000000..b64627b867 --- /dev/null +++ b/apis/ec2/v1beta1/zz_networkinsightsanalysis_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NetworkInsightsAnalysis +func (mg *NetworkInsightsAnalysis) GetTerraformResourceType() string { + return "aws_ec2_network_insights_analysis" +} + +// GetConnectionDetailsMapping for this NetworkInsightsAnalysis +func (tr *NetworkInsightsAnalysis) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NetworkInsightsAnalysis +func (tr *NetworkInsightsAnalysis) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NetworkInsightsAnalysis +func (tr *NetworkInsightsAnalysis) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NetworkInsightsAnalysis +func (tr *NetworkInsightsAnalysis) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NetworkInsightsAnalysis +func (tr *NetworkInsightsAnalysis) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NetworkInsightsAnalysis +func (tr *NetworkInsightsAnalysis) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NetworkInsightsAnalysis +func (tr *NetworkInsightsAnalysis) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NetworkInsightsAnalysis +func (tr *NetworkInsightsAnalysis) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NetworkInsightsAnalysis using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NetworkInsightsAnalysis) LateInitialize(attrs []byte) (bool, error) { + params := &NetworkInsightsAnalysisParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NetworkInsightsAnalysis) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_networkinsightsanalysis_types.go b/apis/ec2/v1beta1/zz_networkinsightsanalysis_types.go index cf38a9dd6d..3b56b58706 100755 --- a/apis/ec2/v1beta1/zz_networkinsightsanalysis_types.go +++ b/apis/ec2/v1beta1/zz_networkinsightsanalysis_types.go @@ -1702,13 +1702,14 @@ type NetworkInsightsAnalysisStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NetworkInsightsAnalysis is the Schema for the NetworkInsightsAnalysiss API. Provides a Network Insights Analysis resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NetworkInsightsAnalysis struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_networkinsightspath_terraformed.go b/apis/ec2/v1beta1/zz_networkinsightspath_terraformed.go new file mode 100755 index 0000000000..a08aad5ea1 --- /dev/null +++ b/apis/ec2/v1beta1/zz_networkinsightspath_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NetworkInsightsPath +func (mg *NetworkInsightsPath) GetTerraformResourceType() string { + return "aws_ec2_network_insights_path" +} + +// GetConnectionDetailsMapping for this NetworkInsightsPath +func (tr *NetworkInsightsPath) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NetworkInsightsPath +func (tr *NetworkInsightsPath) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NetworkInsightsPath +func (tr *NetworkInsightsPath) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NetworkInsightsPath +func (tr *NetworkInsightsPath) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NetworkInsightsPath +func (tr *NetworkInsightsPath) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NetworkInsightsPath +func (tr *NetworkInsightsPath) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NetworkInsightsPath +func (tr *NetworkInsightsPath) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NetworkInsightsPath +func (tr *NetworkInsightsPath) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NetworkInsightsPath using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NetworkInsightsPath) LateInitialize(attrs []byte) (bool, error) { + params := &NetworkInsightsPathParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NetworkInsightsPath) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_networkinsightspath_types.go b/apis/ec2/v1beta1/zz_networkinsightspath_types.go index 6f4b38b114..46293b9678 100755 --- a/apis/ec2/v1beta1/zz_networkinsightspath_types.go +++ b/apis/ec2/v1beta1/zz_networkinsightspath_types.go @@ -178,13 +178,14 @@ type NetworkInsightsPathStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NetworkInsightsPath is the Schema for the NetworkInsightsPaths API. Provides a Network Insights Path resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NetworkInsightsPath struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_networkinterface_terraformed.go b/apis/ec2/v1beta1/zz_networkinterface_terraformed.go new file mode 100755 index 0000000000..7777cb1ab8 --- /dev/null +++ b/apis/ec2/v1beta1/zz_networkinterface_terraformed.go @@ -0,0 +1,138 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NetworkInterface +func (mg *NetworkInterface) GetTerraformResourceType() string { + return "aws_network_interface" +} + +// GetConnectionDetailsMapping for this NetworkInterface +func (tr *NetworkInterface) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NetworkInterface +func (tr *NetworkInterface) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NetworkInterface +func (tr *NetworkInterface) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NetworkInterface +func (tr *NetworkInterface) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NetworkInterface +func (tr *NetworkInterface) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NetworkInterface +func (tr *NetworkInterface) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NetworkInterface +func (tr *NetworkInterface) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NetworkInterface +func (tr *NetworkInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NetworkInterface using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NetworkInterface) LateInitialize(attrs []byte) (bool, error) { + params := &NetworkInterfaceParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("InterfaceType")) + opts = append(opts, resource.WithNameFilter("IPv6AddressCount")) + opts = append(opts, resource.WithNameFilter("IPv6Addresses")) + opts = append(opts, resource.WithNameFilter("PrivateIPList")) + opts = append(opts, resource.WithNameFilter("PrivateIps")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NetworkInterface) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_networkinterface_types.go b/apis/ec2/v1beta1/zz_networkinterface_types.go index 4a748b3948..d97ce4aecb 100755 --- a/apis/ec2/v1beta1/zz_networkinterface_types.go +++ b/apis/ec2/v1beta1/zz_networkinterface_types.go @@ -343,13 +343,14 @@ type NetworkInterfaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NetworkInterface is the Schema for the NetworkInterfaces API. Provides an Elastic network interface (ENI) resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NetworkInterface struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_networkinterfaceattachment_terraformed.go b/apis/ec2/v1beta1/zz_networkinterfaceattachment_terraformed.go new file mode 100755 index 0000000000..6b1597800c --- /dev/null +++ b/apis/ec2/v1beta1/zz_networkinterfaceattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NetworkInterfaceAttachment +func (mg *NetworkInterfaceAttachment) GetTerraformResourceType() string { + return "aws_network_interface_attachment" +} + +// GetConnectionDetailsMapping for this NetworkInterfaceAttachment +func (tr *NetworkInterfaceAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NetworkInterfaceAttachment +func (tr *NetworkInterfaceAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NetworkInterfaceAttachment +func (tr *NetworkInterfaceAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NetworkInterfaceAttachment +func (tr *NetworkInterfaceAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NetworkInterfaceAttachment +func (tr *NetworkInterfaceAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NetworkInterfaceAttachment +func (tr *NetworkInterfaceAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NetworkInterfaceAttachment +func (tr *NetworkInterfaceAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NetworkInterfaceAttachment +func (tr *NetworkInterfaceAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NetworkInterfaceAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NetworkInterfaceAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &NetworkInterfaceAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NetworkInterfaceAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_networkinterfaceattachment_types.go b/apis/ec2/v1beta1/zz_networkinterfaceattachment_types.go index 2c3ef70f4f..9b0c5b03ac 100755 --- a/apis/ec2/v1beta1/zz_networkinterfaceattachment_types.go +++ b/apis/ec2/v1beta1/zz_networkinterfaceattachment_types.go @@ -133,13 +133,14 @@ type NetworkInterfaceAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NetworkInterfaceAttachment is the Schema for the NetworkInterfaceAttachments API. Attach an Elastic network interface (ENI) resource with EC2 instance. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NetworkInterfaceAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_networkinterfacesgattachment_terraformed.go b/apis/ec2/v1beta1/zz_networkinterfacesgattachment_terraformed.go new file mode 100755 index 0000000000..b429672d80 --- /dev/null +++ b/apis/ec2/v1beta1/zz_networkinterfacesgattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NetworkInterfaceSgAttachment +func (mg *NetworkInterfaceSgAttachment) GetTerraformResourceType() string { + return "aws_network_interface_sg_attachment" +} + +// GetConnectionDetailsMapping for this NetworkInterfaceSgAttachment +func (tr *NetworkInterfaceSgAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NetworkInterfaceSgAttachment +func (tr *NetworkInterfaceSgAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NetworkInterfaceSgAttachment +func (tr *NetworkInterfaceSgAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NetworkInterfaceSgAttachment +func (tr *NetworkInterfaceSgAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NetworkInterfaceSgAttachment +func (tr *NetworkInterfaceSgAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NetworkInterfaceSgAttachment +func (tr *NetworkInterfaceSgAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NetworkInterfaceSgAttachment +func (tr *NetworkInterfaceSgAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NetworkInterfaceSgAttachment +func (tr *NetworkInterfaceSgAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NetworkInterfaceSgAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NetworkInterfaceSgAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &NetworkInterfaceSgAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NetworkInterfaceSgAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_networkinterfacesgattachment_types.go b/apis/ec2/v1beta1/zz_networkinterfacesgattachment_types.go index 39bfc1a131..310f45daff 100755 --- a/apis/ec2/v1beta1/zz_networkinterfacesgattachment_types.go +++ b/apis/ec2/v1beta1/zz_networkinterfacesgattachment_types.go @@ -114,13 +114,14 @@ type NetworkInterfaceSgAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NetworkInterfaceSgAttachment is the Schema for the NetworkInterfaceSgAttachments API. Associates a security group with a network interface. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NetworkInterfaceSgAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_placementgroup_terraformed.go b/apis/ec2/v1beta1/zz_placementgroup_terraformed.go new file mode 100755 index 0000000000..34d71ab3eb --- /dev/null +++ b/apis/ec2/v1beta1/zz_placementgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PlacementGroup +func (mg *PlacementGroup) GetTerraformResourceType() string { + return "aws_placement_group" +} + +// GetConnectionDetailsMapping for this PlacementGroup +func (tr *PlacementGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PlacementGroup +func (tr *PlacementGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PlacementGroup +func (tr *PlacementGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PlacementGroup +func (tr *PlacementGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PlacementGroup +func (tr *PlacementGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PlacementGroup +func (tr *PlacementGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PlacementGroup +func (tr *PlacementGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PlacementGroup +func (tr *PlacementGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PlacementGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PlacementGroup) LateInitialize(attrs []byte) (bool, error) { + params := &PlacementGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PlacementGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_placementgroup_types.go b/apis/ec2/v1beta1/zz_placementgroup_types.go index 11196b09b1..3b1193b54d 100755 --- a/apis/ec2/v1beta1/zz_placementgroup_types.go +++ b/apis/ec2/v1beta1/zz_placementgroup_types.go @@ -120,13 +120,14 @@ type PlacementGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PlacementGroup is the Schema for the PlacementGroups API. Provides an EC2 placement group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PlacementGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_route_terraformed.go b/apis/ec2/v1beta1/zz_route_terraformed.go new file mode 100755 index 0000000000..19222f1dc5 --- /dev/null +++ b/apis/ec2/v1beta1/zz_route_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Route +func (mg *Route) GetTerraformResourceType() string { + return "aws_route" +} + +// GetConnectionDetailsMapping for this Route +func (tr *Route) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Route +func (tr *Route) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Route +func (tr *Route) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Route +func (tr *Route) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Route +func (tr *Route) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Route +func (tr *Route) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Route +func (tr *Route) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Route +func (tr *Route) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Route using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Route) LateInitialize(attrs []byte) (bool, error) { + params := &RouteParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Route) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_route_types.go b/apis/ec2/v1beta1/zz_route_types.go index 460432de00..9f375545f3 100755 --- a/apis/ec2/v1beta1/zz_route_types.go +++ b/apis/ec2/v1beta1/zz_route_types.go @@ -399,13 +399,14 @@ type RouteStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Route is the Schema for the Routes API. Provides a resource to create a routing entry in a VPC routing table. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Route struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_routetable_terraformed.go b/apis/ec2/v1beta1/zz_routetable_terraformed.go new file mode 100755 index 0000000000..3bdc105572 --- /dev/null +++ b/apis/ec2/v1beta1/zz_routetable_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RouteTable +func (mg *RouteTable) GetTerraformResourceType() string { + return "aws_route_table" +} + +// GetConnectionDetailsMapping for this RouteTable +func (tr *RouteTable) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RouteTable +func (tr *RouteTable) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RouteTable +func (tr *RouteTable) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RouteTable +func (tr *RouteTable) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RouteTable +func (tr *RouteTable) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RouteTable +func (tr *RouteTable) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RouteTable +func (tr *RouteTable) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RouteTable +func (tr *RouteTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RouteTable using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RouteTable) LateInitialize(attrs []byte) (bool, error) { + params := &RouteTableParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RouteTable) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_routetable_types.go b/apis/ec2/v1beta1/zz_routetable_types.go index 2ebba5ed64..f5ca758edd 100755 --- a/apis/ec2/v1beta1/zz_routetable_types.go +++ b/apis/ec2/v1beta1/zz_routetable_types.go @@ -168,13 +168,14 @@ type RouteTableStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RouteTable is the Schema for the RouteTables API. Provides a resource to create a VPC routing table. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RouteTable struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_routetableassociation_terraformed.go b/apis/ec2/v1beta1/zz_routetableassociation_terraformed.go new file mode 100755 index 0000000000..b9dcfffec2 --- /dev/null +++ b/apis/ec2/v1beta1/zz_routetableassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RouteTableAssociation +func (mg *RouteTableAssociation) GetTerraformResourceType() string { + return "aws_route_table_association" +} + +// GetConnectionDetailsMapping for this RouteTableAssociation +func (tr *RouteTableAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RouteTableAssociation +func (tr *RouteTableAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RouteTableAssociation +func (tr *RouteTableAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RouteTableAssociation +func (tr *RouteTableAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RouteTableAssociation +func (tr *RouteTableAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RouteTableAssociation +func (tr *RouteTableAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RouteTableAssociation +func (tr *RouteTableAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RouteTableAssociation +func (tr *RouteTableAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RouteTableAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RouteTableAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &RouteTableAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RouteTableAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_routetableassociation_types.go b/apis/ec2/v1beta1/zz_routetableassociation_types.go index 4481a053d8..78bf360d05 100755 --- a/apis/ec2/v1beta1/zz_routetableassociation_types.go +++ b/apis/ec2/v1beta1/zz_routetableassociation_types.go @@ -144,13 +144,14 @@ type RouteTableAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RouteTableAssociation is the Schema for the RouteTableAssociations API. Provides a resource to create an association between a route table and a subnet or a route table and an internet gateway or virtual private gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RouteTableAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_securitygroup_terraformed.go b/apis/ec2/v1beta1/zz_securitygroup_terraformed.go new file mode 100755 index 0000000000..4c39056681 --- /dev/null +++ b/apis/ec2/v1beta1/zz_securitygroup_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SecurityGroup +func (mg *SecurityGroup) GetTerraformResourceType() string { + return "aws_security_group" +} + +// GetConnectionDetailsMapping for this SecurityGroup +func (tr *SecurityGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SecurityGroup +func (tr *SecurityGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SecurityGroup +func (tr *SecurityGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SecurityGroup +func (tr *SecurityGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SecurityGroup +func (tr *SecurityGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SecurityGroup +func (tr *SecurityGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SecurityGroup +func (tr *SecurityGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SecurityGroup +func (tr *SecurityGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SecurityGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SecurityGroup) LateInitialize(attrs []byte) (bool, error) { + params := &SecurityGroupParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("Name")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SecurityGroup) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ec2/v1beta1/zz_securitygroup_types.go b/apis/ec2/v1beta1/zz_securitygroup_types.go index 3c0847b68a..f935810cba 100755 --- a/apis/ec2/v1beta1/zz_securitygroup_types.go +++ b/apis/ec2/v1beta1/zz_securitygroup_types.go @@ -219,13 +219,14 @@ type SecurityGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SecurityGroup is the Schema for the SecurityGroups API. Provides a security group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SecurityGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_securitygroupegressrule_terraformed.go b/apis/ec2/v1beta1/zz_securitygroupegressrule_terraformed.go new file mode 100755 index 0000000000..e337b3748e --- /dev/null +++ b/apis/ec2/v1beta1/zz_securitygroupegressrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SecurityGroupEgressRule +func (mg *SecurityGroupEgressRule) GetTerraformResourceType() string { + return "aws_vpc_security_group_egress_rule" +} + +// GetConnectionDetailsMapping for this SecurityGroupEgressRule +func (tr *SecurityGroupEgressRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SecurityGroupEgressRule +func (tr *SecurityGroupEgressRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SecurityGroupEgressRule +func (tr *SecurityGroupEgressRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SecurityGroupEgressRule +func (tr *SecurityGroupEgressRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SecurityGroupEgressRule +func (tr *SecurityGroupEgressRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SecurityGroupEgressRule +func (tr *SecurityGroupEgressRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SecurityGroupEgressRule +func (tr *SecurityGroupEgressRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SecurityGroupEgressRule +func (tr *SecurityGroupEgressRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SecurityGroupEgressRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SecurityGroupEgressRule) LateInitialize(attrs []byte) (bool, error) { + params := &SecurityGroupEgressRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SecurityGroupEgressRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_securitygroupegressrule_types.go b/apis/ec2/v1beta1/zz_securitygroupegressrule_types.go index 15d658ffdd..c225355d22 100755 --- a/apis/ec2/v1beta1/zz_securitygroupegressrule_types.go +++ b/apis/ec2/v1beta1/zz_securitygroupegressrule_types.go @@ -224,13 +224,14 @@ type SecurityGroupEgressRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SecurityGroupEgressRule is the Schema for the SecurityGroupEgressRules API. Provides a VPC security group egress rule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SecurityGroupEgressRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_securitygroupingressrule_terraformed.go b/apis/ec2/v1beta1/zz_securitygroupingressrule_terraformed.go new file mode 100755 index 0000000000..b575fed3f5 --- /dev/null +++ b/apis/ec2/v1beta1/zz_securitygroupingressrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SecurityGroupIngressRule +func (mg *SecurityGroupIngressRule) GetTerraformResourceType() string { + return "aws_vpc_security_group_ingress_rule" +} + +// GetConnectionDetailsMapping for this SecurityGroupIngressRule +func (tr *SecurityGroupIngressRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SecurityGroupIngressRule +func (tr *SecurityGroupIngressRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SecurityGroupIngressRule +func (tr *SecurityGroupIngressRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SecurityGroupIngressRule +func (tr *SecurityGroupIngressRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SecurityGroupIngressRule +func (tr *SecurityGroupIngressRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SecurityGroupIngressRule +func (tr *SecurityGroupIngressRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SecurityGroupIngressRule +func (tr *SecurityGroupIngressRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SecurityGroupIngressRule +func (tr *SecurityGroupIngressRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SecurityGroupIngressRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SecurityGroupIngressRule) LateInitialize(attrs []byte) (bool, error) { + params := &SecurityGroupIngressRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SecurityGroupIngressRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_securitygroupingressrule_types.go b/apis/ec2/v1beta1/zz_securitygroupingressrule_types.go index bae57a1264..4ef3154263 100755 --- a/apis/ec2/v1beta1/zz_securitygroupingressrule_types.go +++ b/apis/ec2/v1beta1/zz_securitygroupingressrule_types.go @@ -224,13 +224,14 @@ type SecurityGroupIngressRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SecurityGroupIngressRule is the Schema for the SecurityGroupIngressRules API. Provides a VPC security group ingress rule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SecurityGroupIngressRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_securitygrouprule_terraformed.go b/apis/ec2/v1beta1/zz_securitygrouprule_terraformed.go new file mode 100755 index 0000000000..ebc25c5431 --- /dev/null +++ b/apis/ec2/v1beta1/zz_securitygrouprule_terraformed.go @@ -0,0 +1,137 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SecurityGroupRule +func (mg *SecurityGroupRule) GetTerraformResourceType() string { + return "aws_security_group_rule" +} + +// GetConnectionDetailsMapping for this SecurityGroupRule +func (tr *SecurityGroupRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SecurityGroupRule +func (tr *SecurityGroupRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SecurityGroupRule +func (tr *SecurityGroupRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SecurityGroupRule +func (tr *SecurityGroupRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SecurityGroupRule +func (tr *SecurityGroupRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SecurityGroupRule +func (tr *SecurityGroupRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SecurityGroupRule +func (tr *SecurityGroupRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SecurityGroupRule +func (tr *SecurityGroupRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SecurityGroupRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SecurityGroupRule) LateInitialize(attrs []byte) (bool, error) { + params := &SecurityGroupRuleParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("CidrBlocks")) + opts = append(opts, resource.WithNameFilter("IPv6CidrBlocks")) + opts = append(opts, resource.WithNameFilter("Self")) + opts = append(opts, resource.WithNameFilter("SourceSecurityGroupID")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SecurityGroupRule) GetTerraformSchemaVersion() int { + return 2 +} diff --git a/apis/ec2/v1beta1/zz_securitygrouprule_types.go b/apis/ec2/v1beta1/zz_securitygrouprule_types.go index 6d39767503..a42b03b21a 100755 --- a/apis/ec2/v1beta1/zz_securitygrouprule_types.go +++ b/apis/ec2/v1beta1/zz_securitygrouprule_types.go @@ -232,13 +232,14 @@ type SecurityGroupRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SecurityGroupRule is the Schema for the SecurityGroupRules API. Provides an security group rule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SecurityGroupRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_serialconsoleaccess_terraformed.go b/apis/ec2/v1beta1/zz_serialconsoleaccess_terraformed.go new file mode 100755 index 0000000000..cdf4a16a93 --- /dev/null +++ b/apis/ec2/v1beta1/zz_serialconsoleaccess_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SerialConsoleAccess +func (mg *SerialConsoleAccess) GetTerraformResourceType() string { + return "aws_ec2_serial_console_access" +} + +// GetConnectionDetailsMapping for this SerialConsoleAccess +func (tr *SerialConsoleAccess) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SerialConsoleAccess +func (tr *SerialConsoleAccess) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SerialConsoleAccess +func (tr *SerialConsoleAccess) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SerialConsoleAccess +func (tr *SerialConsoleAccess) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SerialConsoleAccess +func (tr *SerialConsoleAccess) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SerialConsoleAccess +func (tr *SerialConsoleAccess) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SerialConsoleAccess +func (tr *SerialConsoleAccess) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SerialConsoleAccess +func (tr *SerialConsoleAccess) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SerialConsoleAccess using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SerialConsoleAccess) LateInitialize(attrs []byte) (bool, error) { + params := &SerialConsoleAccessParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SerialConsoleAccess) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_serialconsoleaccess_types.go b/apis/ec2/v1beta1/zz_serialconsoleaccess_types.go index 0cdd42a6b8..007b3665c0 100755 --- a/apis/ec2/v1beta1/zz_serialconsoleaccess_types.go +++ b/apis/ec2/v1beta1/zz_serialconsoleaccess_types.go @@ -67,13 +67,14 @@ type SerialConsoleAccessStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SerialConsoleAccess is the Schema for the SerialConsoleAccesss API. Manages whether serial console access is enabled for your AWS account in the current AWS region. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SerialConsoleAccess struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_snapshotcreatevolumepermission_terraformed.go b/apis/ec2/v1beta1/zz_snapshotcreatevolumepermission_terraformed.go new file mode 100755 index 0000000000..d80edc9cd3 --- /dev/null +++ b/apis/ec2/v1beta1/zz_snapshotcreatevolumepermission_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SnapshotCreateVolumePermission +func (mg *SnapshotCreateVolumePermission) GetTerraformResourceType() string { + return "aws_snapshot_create_volume_permission" +} + +// GetConnectionDetailsMapping for this SnapshotCreateVolumePermission +func (tr *SnapshotCreateVolumePermission) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SnapshotCreateVolumePermission +func (tr *SnapshotCreateVolumePermission) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SnapshotCreateVolumePermission +func (tr *SnapshotCreateVolumePermission) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SnapshotCreateVolumePermission +func (tr *SnapshotCreateVolumePermission) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SnapshotCreateVolumePermission +func (tr *SnapshotCreateVolumePermission) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SnapshotCreateVolumePermission +func (tr *SnapshotCreateVolumePermission) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SnapshotCreateVolumePermission +func (tr *SnapshotCreateVolumePermission) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SnapshotCreateVolumePermission +func (tr *SnapshotCreateVolumePermission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SnapshotCreateVolumePermission using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SnapshotCreateVolumePermission) LateInitialize(attrs []byte) (bool, error) { + params := &SnapshotCreateVolumePermissionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SnapshotCreateVolumePermission) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_snapshotcreatevolumepermission_types.go b/apis/ec2/v1beta1/zz_snapshotcreatevolumepermission_types.go index 0d07770894..2ebdc26d57 100755 --- a/apis/ec2/v1beta1/zz_snapshotcreatevolumepermission_types.go +++ b/apis/ec2/v1beta1/zz_snapshotcreatevolumepermission_types.go @@ -98,13 +98,14 @@ type SnapshotCreateVolumePermissionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SnapshotCreateVolumePermission is the Schema for the SnapshotCreateVolumePermissions API. Adds create volume permission to an EBS Snapshot // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SnapshotCreateVolumePermission struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_spotdatafeedsubscription_terraformed.go b/apis/ec2/v1beta1/zz_spotdatafeedsubscription_terraformed.go new file mode 100755 index 0000000000..ef6255be31 --- /dev/null +++ b/apis/ec2/v1beta1/zz_spotdatafeedsubscription_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SpotDatafeedSubscription +func (mg *SpotDatafeedSubscription) GetTerraformResourceType() string { + return "aws_spot_datafeed_subscription" +} + +// GetConnectionDetailsMapping for this SpotDatafeedSubscription +func (tr *SpotDatafeedSubscription) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SpotDatafeedSubscription +func (tr *SpotDatafeedSubscription) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SpotDatafeedSubscription +func (tr *SpotDatafeedSubscription) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SpotDatafeedSubscription +func (tr *SpotDatafeedSubscription) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SpotDatafeedSubscription +func (tr *SpotDatafeedSubscription) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SpotDatafeedSubscription +func (tr *SpotDatafeedSubscription) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SpotDatafeedSubscription +func (tr *SpotDatafeedSubscription) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SpotDatafeedSubscription +func (tr *SpotDatafeedSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SpotDatafeedSubscription using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SpotDatafeedSubscription) LateInitialize(attrs []byte) (bool, error) { + params := &SpotDatafeedSubscriptionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SpotDatafeedSubscription) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_spotdatafeedsubscription_types.go b/apis/ec2/v1beta1/zz_spotdatafeedsubscription_types.go index 6864aaa81c..a5033001c4 100755 --- a/apis/ec2/v1beta1/zz_spotdatafeedsubscription_types.go +++ b/apis/ec2/v1beta1/zz_spotdatafeedsubscription_types.go @@ -77,13 +77,14 @@ type SpotDatafeedSubscriptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SpotDatafeedSubscription is the Schema for the SpotDatafeedSubscriptions API. Provides a Spot Datafeed Subscription resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SpotDatafeedSubscription struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_spotfleetrequest_terraformed.go b/apis/ec2/v1beta1/zz_spotfleetrequest_terraformed.go new file mode 100755 index 0000000000..b9c5c9d492 --- /dev/null +++ b/apis/ec2/v1beta1/zz_spotfleetrequest_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SpotFleetRequest +func (mg *SpotFleetRequest) GetTerraformResourceType() string { + return "aws_spot_fleet_request" +} + +// GetConnectionDetailsMapping for this SpotFleetRequest +func (tr *SpotFleetRequest) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SpotFleetRequest +func (tr *SpotFleetRequest) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SpotFleetRequest +func (tr *SpotFleetRequest) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SpotFleetRequest +func (tr *SpotFleetRequest) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SpotFleetRequest +func (tr *SpotFleetRequest) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SpotFleetRequest +func (tr *SpotFleetRequest) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SpotFleetRequest +func (tr *SpotFleetRequest) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SpotFleetRequest +func (tr *SpotFleetRequest) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SpotFleetRequest using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SpotFleetRequest) LateInitialize(attrs []byte) (bool, error) { + params := &SpotFleetRequestParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SpotFleetRequest) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ec2/v1beta1/zz_spotfleetrequest_types.go b/apis/ec2/v1beta1/zz_spotfleetrequest_types.go index 352bc9e4c0..d5086a9a67 100755 --- a/apis/ec2/v1beta1/zz_spotfleetrequest_types.go +++ b/apis/ec2/v1beta1/zz_spotfleetrequest_types.go @@ -1496,13 +1496,14 @@ type SpotFleetRequestStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SpotFleetRequest is the Schema for the SpotFleetRequests API. Provides a Spot Fleet Request resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SpotFleetRequest struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_spotinstancerequest_terraformed.go b/apis/ec2/v1beta1/zz_spotinstancerequest_terraformed.go new file mode 100755 index 0000000000..7969e75970 --- /dev/null +++ b/apis/ec2/v1beta1/zz_spotinstancerequest_terraformed.go @@ -0,0 +1,138 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SpotInstanceRequest +func (mg *SpotInstanceRequest) GetTerraformResourceType() string { + return "aws_spot_instance_request" +} + +// GetConnectionDetailsMapping for this SpotInstanceRequest +func (tr *SpotInstanceRequest) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SpotInstanceRequest +func (tr *SpotInstanceRequest) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SpotInstanceRequest +func (tr *SpotInstanceRequest) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SpotInstanceRequest +func (tr *SpotInstanceRequest) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SpotInstanceRequest +func (tr *SpotInstanceRequest) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SpotInstanceRequest +func (tr *SpotInstanceRequest) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SpotInstanceRequest +func (tr *SpotInstanceRequest) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SpotInstanceRequest +func (tr *SpotInstanceRequest) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SpotInstanceRequest using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SpotInstanceRequest) LateInitialize(attrs []byte) (bool, error) { + params := &SpotInstanceRequestParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("InstanceInterruptionBehavior")) + opts = append(opts, resource.WithNameFilter("SourceDestCheck")) + opts = append(opts, resource.WithNameFilter("SpotType")) + opts = append(opts, resource.WithNameFilter("ValidFrom")) + opts = append(opts, resource.WithNameFilter("ValidUntil")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SpotInstanceRequest) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_spotinstancerequest_types.go b/apis/ec2/v1beta1/zz_spotinstancerequest_types.go index 49a1adecb3..e3aa9496a8 100755 --- a/apis/ec2/v1beta1/zz_spotinstancerequest_types.go +++ b/apis/ec2/v1beta1/zz_spotinstancerequest_types.go @@ -1022,13 +1022,14 @@ type SpotInstanceRequestStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SpotInstanceRequest is the Schema for the SpotInstanceRequests API. Provides a Spot Instance Request resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SpotInstanceRequest struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_subnet_terraformed.go b/apis/ec2/v1beta1/zz_subnet_terraformed.go new file mode 100755 index 0000000000..b69d5eabe1 --- /dev/null +++ b/apis/ec2/v1beta1/zz_subnet_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Subnet +func (mg *Subnet) GetTerraformResourceType() string { + return "aws_subnet" +} + +// GetConnectionDetailsMapping for this Subnet +func (tr *Subnet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Subnet +func (tr *Subnet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Subnet +func (tr *Subnet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Subnet +func (tr *Subnet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Subnet +func (tr *Subnet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Subnet +func (tr *Subnet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Subnet +func (tr *Subnet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Subnet +func (tr *Subnet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Subnet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Subnet) LateInitialize(attrs []byte) (bool, error) { + params := &SubnetParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("AvailabilityZoneID")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Subnet) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ec2/v1beta1/zz_subnet_types.go b/apis/ec2/v1beta1/zz_subnet_types.go index d907349768..8698177754 100755 --- a/apis/ec2/v1beta1/zz_subnet_types.go +++ b/apis/ec2/v1beta1/zz_subnet_types.go @@ -277,13 +277,14 @@ type SubnetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Subnet is the Schema for the Subnets API. Provides an VPC subnet resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Subnet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_subnetcidrreservation_terraformed.go b/apis/ec2/v1beta1/zz_subnetcidrreservation_terraformed.go new file mode 100755 index 0000000000..ebd3a6b7a7 --- /dev/null +++ b/apis/ec2/v1beta1/zz_subnetcidrreservation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SubnetCidrReservation +func (mg *SubnetCidrReservation) GetTerraformResourceType() string { + return "aws_ec2_subnet_cidr_reservation" +} + +// GetConnectionDetailsMapping for this SubnetCidrReservation +func (tr *SubnetCidrReservation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SubnetCidrReservation +func (tr *SubnetCidrReservation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SubnetCidrReservation +func (tr *SubnetCidrReservation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SubnetCidrReservation +func (tr *SubnetCidrReservation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SubnetCidrReservation +func (tr *SubnetCidrReservation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SubnetCidrReservation +func (tr *SubnetCidrReservation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SubnetCidrReservation +func (tr *SubnetCidrReservation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SubnetCidrReservation +func (tr *SubnetCidrReservation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SubnetCidrReservation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SubnetCidrReservation) LateInitialize(attrs []byte) (bool, error) { + params := &SubnetCidrReservationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SubnetCidrReservation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_subnetcidrreservation_types.go b/apis/ec2/v1beta1/zz_subnetcidrreservation_types.go index f5141ae32b..026fc3b294 100755 --- a/apis/ec2/v1beta1/zz_subnetcidrreservation_types.go +++ b/apis/ec2/v1beta1/zz_subnetcidrreservation_types.go @@ -119,13 +119,14 @@ type SubnetCidrReservationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SubnetCidrReservation is the Schema for the SubnetCidrReservations API. Provides a subnet CIDR reservation resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SubnetCidrReservation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_tag_terraformed.go b/apis/ec2/v1beta1/zz_tag_terraformed.go new file mode 100755 index 0000000000..0676f382de --- /dev/null +++ b/apis/ec2/v1beta1/zz_tag_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Tag +func (mg *Tag) GetTerraformResourceType() string { + return "aws_ec2_tag" +} + +// GetConnectionDetailsMapping for this Tag +func (tr *Tag) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Tag +func (tr *Tag) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Tag +func (tr *Tag) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Tag +func (tr *Tag) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Tag +func (tr *Tag) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Tag +func (tr *Tag) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Tag +func (tr *Tag) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Tag +func (tr *Tag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Tag using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Tag) LateInitialize(attrs []byte) (bool, error) { + params := &TagParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Tag) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_tag_types.go b/apis/ec2/v1beta1/zz_tag_types.go index 13b81c2c6b..58f8458b10 100755 --- a/apis/ec2/v1beta1/zz_tag_types.go +++ b/apis/ec2/v1beta1/zz_tag_types.go @@ -82,13 +82,14 @@ type TagStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Tag is the Schema for the Tags API. Manages an individual EC2 resource tag // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Tag struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_trafficmirrorfilter_terraformed.go b/apis/ec2/v1beta1/zz_trafficmirrorfilter_terraformed.go new file mode 100755 index 0000000000..34ec773e77 --- /dev/null +++ b/apis/ec2/v1beta1/zz_trafficmirrorfilter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TrafficMirrorFilter +func (mg *TrafficMirrorFilter) GetTerraformResourceType() string { + return "aws_ec2_traffic_mirror_filter" +} + +// GetConnectionDetailsMapping for this TrafficMirrorFilter +func (tr *TrafficMirrorFilter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TrafficMirrorFilter +func (tr *TrafficMirrorFilter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TrafficMirrorFilter +func (tr *TrafficMirrorFilter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TrafficMirrorFilter +func (tr *TrafficMirrorFilter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TrafficMirrorFilter +func (tr *TrafficMirrorFilter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TrafficMirrorFilter +func (tr *TrafficMirrorFilter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TrafficMirrorFilter +func (tr *TrafficMirrorFilter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TrafficMirrorFilter +func (tr *TrafficMirrorFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TrafficMirrorFilter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TrafficMirrorFilter) LateInitialize(attrs []byte) (bool, error) { + params := &TrafficMirrorFilterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TrafficMirrorFilter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_trafficmirrorfilter_types.go b/apis/ec2/v1beta1/zz_trafficmirrorfilter_types.go index 5bc7a51b27..fa3fe0fb55 100755 --- a/apis/ec2/v1beta1/zz_trafficmirrorfilter_types.go +++ b/apis/ec2/v1beta1/zz_trafficmirrorfilter_types.go @@ -101,13 +101,14 @@ type TrafficMirrorFilterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TrafficMirrorFilter is the Schema for the TrafficMirrorFilters API. Provides an Traffic mirror filter // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TrafficMirrorFilter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_trafficmirrorfilterrule_terraformed.go b/apis/ec2/v1beta1/zz_trafficmirrorfilterrule_terraformed.go new file mode 100755 index 0000000000..847f31f4e4 --- /dev/null +++ b/apis/ec2/v1beta1/zz_trafficmirrorfilterrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TrafficMirrorFilterRule +func (mg *TrafficMirrorFilterRule) GetTerraformResourceType() string { + return "aws_ec2_traffic_mirror_filter_rule" +} + +// GetConnectionDetailsMapping for this TrafficMirrorFilterRule +func (tr *TrafficMirrorFilterRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TrafficMirrorFilterRule +func (tr *TrafficMirrorFilterRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TrafficMirrorFilterRule +func (tr *TrafficMirrorFilterRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TrafficMirrorFilterRule +func (tr *TrafficMirrorFilterRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TrafficMirrorFilterRule +func (tr *TrafficMirrorFilterRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TrafficMirrorFilterRule +func (tr *TrafficMirrorFilterRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TrafficMirrorFilterRule +func (tr *TrafficMirrorFilterRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TrafficMirrorFilterRule +func (tr *TrafficMirrorFilterRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TrafficMirrorFilterRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TrafficMirrorFilterRule) LateInitialize(attrs []byte) (bool, error) { + params := &TrafficMirrorFilterRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TrafficMirrorFilterRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_trafficmirrorfilterrule_types.go b/apis/ec2/v1beta1/zz_trafficmirrorfilterrule_types.go index e0b4d112ad..e70359689b 100755 --- a/apis/ec2/v1beta1/zz_trafficmirrorfilterrule_types.go +++ b/apis/ec2/v1beta1/zz_trafficmirrorfilterrule_types.go @@ -239,13 +239,14 @@ type TrafficMirrorFilterRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TrafficMirrorFilterRule is the Schema for the TrafficMirrorFilterRules API. Provides an Traffic mirror filter rule // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TrafficMirrorFilterRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgateway_terraformed.go b/apis/ec2/v1beta1/zz_transitgateway_terraformed.go new file mode 100755 index 0000000000..65a016b1e5 --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgateway_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGateway +func (mg *TransitGateway) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway" +} + +// GetConnectionDetailsMapping for this TransitGateway +func (tr *TransitGateway) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGateway +func (tr *TransitGateway) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGateway +func (tr *TransitGateway) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGateway +func (tr *TransitGateway) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGateway +func (tr *TransitGateway) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGateway +func (tr *TransitGateway) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGateway +func (tr *TransitGateway) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGateway +func (tr *TransitGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGateway using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGateway) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGateway) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgateway_types.go b/apis/ec2/v1beta1/zz_transitgateway_types.go index 3fd30e851b..2d8d796013 100755 --- a/apis/ec2/v1beta1/zz_transitgateway_types.go +++ b/apis/ec2/v1beta1/zz_transitgateway_types.go @@ -180,13 +180,14 @@ type TransitGatewayStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGateway is the Schema for the TransitGateways API. Manages an EC2 Transit Gateway // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGateway struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewayconnect_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewayconnect_terraformed.go new file mode 100755 index 0000000000..f7ce1676dc --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewayconnect_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayConnect +func (mg *TransitGatewayConnect) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_connect" +} + +// GetConnectionDetailsMapping for this TransitGatewayConnect +func (tr *TransitGatewayConnect) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayConnect +func (tr *TransitGatewayConnect) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayConnect +func (tr *TransitGatewayConnect) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayConnect +func (tr *TransitGatewayConnect) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayConnect +func (tr *TransitGatewayConnect) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayConnect +func (tr *TransitGatewayConnect) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayConnect +func (tr *TransitGatewayConnect) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayConnect +func (tr *TransitGatewayConnect) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayConnect using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayConnect) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayConnectParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayConnect) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewayconnect_types.go b/apis/ec2/v1beta1/zz_transitgatewayconnect_types.go index 5af4ec3bc1..ad8941f7e4 100755 --- a/apis/ec2/v1beta1/zz_transitgatewayconnect_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewayconnect_types.go @@ -165,13 +165,14 @@ type TransitGatewayConnectStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayConnect is the Schema for the TransitGatewayConnects API. Manages an EC2 Transit Gateway Connect // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayConnect struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewayconnectpeer_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewayconnectpeer_terraformed.go new file mode 100755 index 0000000000..b38637a5d6 --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewayconnectpeer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayConnectPeer +func (mg *TransitGatewayConnectPeer) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_connect_peer" +} + +// GetConnectionDetailsMapping for this TransitGatewayConnectPeer +func (tr *TransitGatewayConnectPeer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayConnectPeer +func (tr *TransitGatewayConnectPeer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayConnectPeer +func (tr *TransitGatewayConnectPeer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayConnectPeer +func (tr *TransitGatewayConnectPeer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayConnectPeer +func (tr *TransitGatewayConnectPeer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayConnectPeer +func (tr *TransitGatewayConnectPeer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayConnectPeer +func (tr *TransitGatewayConnectPeer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayConnectPeer +func (tr *TransitGatewayConnectPeer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayConnectPeer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayConnectPeer) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayConnectPeerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayConnectPeer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewayconnectpeer_types.go b/apis/ec2/v1beta1/zz_transitgatewayconnectpeer_types.go index ffaeda7feb..d08abbf11d 100755 --- a/apis/ec2/v1beta1/zz_transitgatewayconnectpeer_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewayconnectpeer_types.go @@ -151,13 +151,14 @@ type TransitGatewayConnectPeerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayConnectPeer is the Schema for the TransitGatewayConnectPeers API. Manages an EC2 Transit Gateway Connect Peer // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayConnectPeer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewaymulticastdomain_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewaymulticastdomain_terraformed.go new file mode 100755 index 0000000000..80cd882a8d --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewaymulticastdomain_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayMulticastDomain +func (mg *TransitGatewayMulticastDomain) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_multicast_domain" +} + +// GetConnectionDetailsMapping for this TransitGatewayMulticastDomain +func (tr *TransitGatewayMulticastDomain) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayMulticastDomain +func (tr *TransitGatewayMulticastDomain) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayMulticastDomain +func (tr *TransitGatewayMulticastDomain) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayMulticastDomain +func (tr *TransitGatewayMulticastDomain) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayMulticastDomain +func (tr *TransitGatewayMulticastDomain) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayMulticastDomain +func (tr *TransitGatewayMulticastDomain) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayMulticastDomain +func (tr *TransitGatewayMulticastDomain) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayMulticastDomain +func (tr *TransitGatewayMulticastDomain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayMulticastDomain using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayMulticastDomain) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayMulticastDomainParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayMulticastDomain) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewaymulticastdomain_types.go b/apis/ec2/v1beta1/zz_transitgatewaymulticastdomain_types.go index 67abefd662..59d7c49815 100755 --- a/apis/ec2/v1beta1/zz_transitgatewaymulticastdomain_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewaymulticastdomain_types.go @@ -139,13 +139,14 @@ type TransitGatewayMulticastDomainStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayMulticastDomain is the Schema for the TransitGatewayMulticastDomains API. Manages an EC2 Transit Gateway Multicast Domain // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayMulticastDomain struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewaymulticastdomainassociation_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewaymulticastdomainassociation_terraformed.go new file mode 100755 index 0000000000..2e5b70a3dd --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewaymulticastdomainassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayMulticastDomainAssociation +func (mg *TransitGatewayMulticastDomainAssociation) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_multicast_domain_association" +} + +// GetConnectionDetailsMapping for this TransitGatewayMulticastDomainAssociation +func (tr *TransitGatewayMulticastDomainAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayMulticastDomainAssociation +func (tr *TransitGatewayMulticastDomainAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayMulticastDomainAssociation +func (tr *TransitGatewayMulticastDomainAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayMulticastDomainAssociation +func (tr *TransitGatewayMulticastDomainAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayMulticastDomainAssociation +func (tr *TransitGatewayMulticastDomainAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayMulticastDomainAssociation +func (tr *TransitGatewayMulticastDomainAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayMulticastDomainAssociation +func (tr *TransitGatewayMulticastDomainAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayMulticastDomainAssociation +func (tr *TransitGatewayMulticastDomainAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayMulticastDomainAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayMulticastDomainAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayMulticastDomainAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayMulticastDomainAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewaymulticastdomainassociation_types.go b/apis/ec2/v1beta1/zz_transitgatewaymulticastdomainassociation_types.go index eb8eaad2c2..56b318255a 100755 --- a/apis/ec2/v1beta1/zz_transitgatewaymulticastdomainassociation_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewaymulticastdomainassociation_types.go @@ -146,13 +146,14 @@ type TransitGatewayMulticastDomainAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayMulticastDomainAssociation is the Schema for the TransitGatewayMulticastDomainAssociations API. Manages an EC2 Transit Gateway Multicast Domain Association // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayMulticastDomainAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupmember_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupmember_terraformed.go new file mode 100755 index 0000000000..b91adcf113 --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupmember_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayMulticastGroupMember +func (mg *TransitGatewayMulticastGroupMember) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_multicast_group_member" +} + +// GetConnectionDetailsMapping for this TransitGatewayMulticastGroupMember +func (tr *TransitGatewayMulticastGroupMember) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayMulticastGroupMember +func (tr *TransitGatewayMulticastGroupMember) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayMulticastGroupMember +func (tr *TransitGatewayMulticastGroupMember) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayMulticastGroupMember +func (tr *TransitGatewayMulticastGroupMember) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayMulticastGroupMember +func (tr *TransitGatewayMulticastGroupMember) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayMulticastGroupMember +func (tr *TransitGatewayMulticastGroupMember) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayMulticastGroupMember +func (tr *TransitGatewayMulticastGroupMember) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayMulticastGroupMember +func (tr *TransitGatewayMulticastGroupMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayMulticastGroupMember using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayMulticastGroupMember) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayMulticastGroupMemberParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayMulticastGroupMember) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupmember_types.go b/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupmember_types.go index a7fe4edea9..c633b35463 100755 --- a/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupmember_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupmember_types.go @@ -128,13 +128,14 @@ type TransitGatewayMulticastGroupMemberStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayMulticastGroupMember is the Schema for the TransitGatewayMulticastGroupMembers API. Manages an EC2 Transit Gateway Multicast Group Member // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayMulticastGroupMember struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupsource_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupsource_terraformed.go new file mode 100755 index 0000000000..02f0fe61fd --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupsource_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayMulticastGroupSource +func (mg *TransitGatewayMulticastGroupSource) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_multicast_group_source" +} + +// GetConnectionDetailsMapping for this TransitGatewayMulticastGroupSource +func (tr *TransitGatewayMulticastGroupSource) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayMulticastGroupSource +func (tr *TransitGatewayMulticastGroupSource) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayMulticastGroupSource +func (tr *TransitGatewayMulticastGroupSource) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayMulticastGroupSource +func (tr *TransitGatewayMulticastGroupSource) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayMulticastGroupSource +func (tr *TransitGatewayMulticastGroupSource) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayMulticastGroupSource +func (tr *TransitGatewayMulticastGroupSource) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayMulticastGroupSource +func (tr *TransitGatewayMulticastGroupSource) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayMulticastGroupSource +func (tr *TransitGatewayMulticastGroupSource) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayMulticastGroupSource using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayMulticastGroupSource) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayMulticastGroupSourceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayMulticastGroupSource) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupsource_types.go b/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupsource_types.go index ca2e7abde3..06dcc03f5a 100755 --- a/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupsource_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewaymulticastgroupsource_types.go @@ -128,13 +128,14 @@ type TransitGatewayMulticastGroupSourceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayMulticastGroupSource is the Schema for the TransitGatewayMulticastGroupSources API. Manages an EC2 Transit Gateway Multicast Group Source // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayMulticastGroupSource struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewaypeeringattachment_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewaypeeringattachment_terraformed.go new file mode 100755 index 0000000000..dbd3c80cb6 --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewaypeeringattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayPeeringAttachment +func (mg *TransitGatewayPeeringAttachment) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_peering_attachment" +} + +// GetConnectionDetailsMapping for this TransitGatewayPeeringAttachment +func (tr *TransitGatewayPeeringAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayPeeringAttachment +func (tr *TransitGatewayPeeringAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayPeeringAttachment +func (tr *TransitGatewayPeeringAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayPeeringAttachment +func (tr *TransitGatewayPeeringAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayPeeringAttachment +func (tr *TransitGatewayPeeringAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayPeeringAttachment +func (tr *TransitGatewayPeeringAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayPeeringAttachment +func (tr *TransitGatewayPeeringAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayPeeringAttachment +func (tr *TransitGatewayPeeringAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayPeeringAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayPeeringAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayPeeringAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayPeeringAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewaypeeringattachment_types.go b/apis/ec2/v1beta1/zz_transitgatewaypeeringattachment_types.go index 23b7e2d082..f1c619543f 100755 --- a/apis/ec2/v1beta1/zz_transitgatewaypeeringattachment_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewaypeeringattachment_types.go @@ -155,13 +155,14 @@ type TransitGatewayPeeringAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayPeeringAttachment is the Schema for the TransitGatewayPeeringAttachments API. Manages an EC2 Transit Gateway Peering Attachment // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayPeeringAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewaypeeringattachmentaccepter_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewaypeeringattachmentaccepter_terraformed.go new file mode 100755 index 0000000000..5239b6490d --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewaypeeringattachmentaccepter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayPeeringAttachmentAccepter +func (mg *TransitGatewayPeeringAttachmentAccepter) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_peering_attachment_accepter" +} + +// GetConnectionDetailsMapping for this TransitGatewayPeeringAttachmentAccepter +func (tr *TransitGatewayPeeringAttachmentAccepter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayPeeringAttachmentAccepter +func (tr *TransitGatewayPeeringAttachmentAccepter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayPeeringAttachmentAccepter +func (tr *TransitGatewayPeeringAttachmentAccepter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayPeeringAttachmentAccepter +func (tr *TransitGatewayPeeringAttachmentAccepter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayPeeringAttachmentAccepter +func (tr *TransitGatewayPeeringAttachmentAccepter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayPeeringAttachmentAccepter +func (tr *TransitGatewayPeeringAttachmentAccepter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayPeeringAttachmentAccepter +func (tr *TransitGatewayPeeringAttachmentAccepter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayPeeringAttachmentAccepter +func (tr *TransitGatewayPeeringAttachmentAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayPeeringAttachmentAccepter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayPeeringAttachmentAccepter) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayPeeringAttachmentAccepterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayPeeringAttachmentAccepter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewaypeeringattachmentaccepter_types.go b/apis/ec2/v1beta1/zz_transitgatewaypeeringattachmentaccepter_types.go index dee67f6884..b039740dc4 100755 --- a/apis/ec2/v1beta1/zz_transitgatewaypeeringattachmentaccepter_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewaypeeringattachmentaccepter_types.go @@ -116,13 +116,14 @@ type TransitGatewayPeeringAttachmentAccepterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayPeeringAttachmentAccepter is the Schema for the TransitGatewayPeeringAttachmentAccepters API. Manages the accepter's side of an EC2 Transit Gateway peering Attachment // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayPeeringAttachmentAccepter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewaypolicytable_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewaypolicytable_terraformed.go new file mode 100755 index 0000000000..6b7fff3e2a --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewaypolicytable_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayPolicyTable +func (mg *TransitGatewayPolicyTable) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_policy_table" +} + +// GetConnectionDetailsMapping for this TransitGatewayPolicyTable +func (tr *TransitGatewayPolicyTable) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayPolicyTable +func (tr *TransitGatewayPolicyTable) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayPolicyTable +func (tr *TransitGatewayPolicyTable) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayPolicyTable +func (tr *TransitGatewayPolicyTable) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayPolicyTable +func (tr *TransitGatewayPolicyTable) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayPolicyTable +func (tr *TransitGatewayPolicyTable) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayPolicyTable +func (tr *TransitGatewayPolicyTable) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayPolicyTable +func (tr *TransitGatewayPolicyTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayPolicyTable using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayPolicyTable) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayPolicyTableParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayPolicyTable) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewaypolicytable_types.go b/apis/ec2/v1beta1/zz_transitgatewaypolicytable_types.go index 18b326fd85..cfbe58bc5b 100755 --- a/apis/ec2/v1beta1/zz_transitgatewaypolicytable_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewaypolicytable_types.go @@ -111,13 +111,14 @@ type TransitGatewayPolicyTableStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayPolicyTable is the Schema for the TransitGatewayPolicyTables API. Manages an EC2 Transit Gateway Policy Table // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayPolicyTable struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewayprefixlistreference_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewayprefixlistreference_terraformed.go new file mode 100755 index 0000000000..f66686513d --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewayprefixlistreference_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayPrefixListReference +func (mg *TransitGatewayPrefixListReference) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_prefix_list_reference" +} + +// GetConnectionDetailsMapping for this TransitGatewayPrefixListReference +func (tr *TransitGatewayPrefixListReference) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayPrefixListReference +func (tr *TransitGatewayPrefixListReference) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayPrefixListReference +func (tr *TransitGatewayPrefixListReference) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayPrefixListReference +func (tr *TransitGatewayPrefixListReference) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayPrefixListReference +func (tr *TransitGatewayPrefixListReference) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayPrefixListReference +func (tr *TransitGatewayPrefixListReference) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayPrefixListReference +func (tr *TransitGatewayPrefixListReference) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayPrefixListReference +func (tr *TransitGatewayPrefixListReference) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayPrefixListReference using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayPrefixListReference) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayPrefixListReferenceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayPrefixListReference) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewayprefixlistreference_types.go b/apis/ec2/v1beta1/zz_transitgatewayprefixlistreference_types.go index 17f94a0f69..3aef4772a4 100755 --- a/apis/ec2/v1beta1/zz_transitgatewayprefixlistreference_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewayprefixlistreference_types.go @@ -161,13 +161,14 @@ type TransitGatewayPrefixListReferenceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayPrefixListReference is the Schema for the TransitGatewayPrefixListReferences API. Manages an EC2 Transit Gateway Prefix List Reference // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayPrefixListReference struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewayroute_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewayroute_terraformed.go new file mode 100755 index 0000000000..7dfea3b049 --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewayroute_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayRoute +func (mg *TransitGatewayRoute) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_route" +} + +// GetConnectionDetailsMapping for this TransitGatewayRoute +func (tr *TransitGatewayRoute) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayRoute +func (tr *TransitGatewayRoute) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayRoute +func (tr *TransitGatewayRoute) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayRoute +func (tr *TransitGatewayRoute) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayRoute +func (tr *TransitGatewayRoute) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayRoute +func (tr *TransitGatewayRoute) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayRoute +func (tr *TransitGatewayRoute) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayRoute +func (tr *TransitGatewayRoute) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayRoute using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayRoute) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayRouteParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayRoute) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewayroute_types.go b/apis/ec2/v1beta1/zz_transitgatewayroute_types.go index bc0cfded28..19e97d7633 100755 --- a/apis/ec2/v1beta1/zz_transitgatewayroute_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewayroute_types.go @@ -134,13 +134,14 @@ type TransitGatewayRouteStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayRoute is the Schema for the TransitGatewayRoutes API. Manages an EC2 Transit Gateway Route // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayRoute struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewayroutetable_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewayroutetable_terraformed.go new file mode 100755 index 0000000000..ba4d3bae9b --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewayroutetable_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayRouteTable +func (mg *TransitGatewayRouteTable) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_route_table" +} + +// GetConnectionDetailsMapping for this TransitGatewayRouteTable +func (tr *TransitGatewayRouteTable) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayRouteTable +func (tr *TransitGatewayRouteTable) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayRouteTable +func (tr *TransitGatewayRouteTable) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayRouteTable +func (tr *TransitGatewayRouteTable) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayRouteTable +func (tr *TransitGatewayRouteTable) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayRouteTable +func (tr *TransitGatewayRouteTable) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayRouteTable +func (tr *TransitGatewayRouteTable) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayRouteTable +func (tr *TransitGatewayRouteTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayRouteTable using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayRouteTable) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayRouteTableParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayRouteTable) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewayroutetable_types.go b/apis/ec2/v1beta1/zz_transitgatewayroutetable_types.go index 5d9baab35e..df39d91a1c 100755 --- a/apis/ec2/v1beta1/zz_transitgatewayroutetable_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewayroutetable_types.go @@ -112,13 +112,14 @@ type TransitGatewayRouteTableStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayRouteTable is the Schema for the TransitGatewayRouteTables API. Manages an EC2 Transit Gateway Route Table // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayRouteTable struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewayroutetableassociation_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewayroutetableassociation_terraformed.go new file mode 100755 index 0000000000..79aa291f72 --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewayroutetableassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayRouteTableAssociation +func (mg *TransitGatewayRouteTableAssociation) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_route_table_association" +} + +// GetConnectionDetailsMapping for this TransitGatewayRouteTableAssociation +func (tr *TransitGatewayRouteTableAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayRouteTableAssociation +func (tr *TransitGatewayRouteTableAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayRouteTableAssociation +func (tr *TransitGatewayRouteTableAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayRouteTableAssociation +func (tr *TransitGatewayRouteTableAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayRouteTableAssociation +func (tr *TransitGatewayRouteTableAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayRouteTableAssociation +func (tr *TransitGatewayRouteTableAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayRouteTableAssociation +func (tr *TransitGatewayRouteTableAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayRouteTableAssociation +func (tr *TransitGatewayRouteTableAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayRouteTableAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayRouteTableAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayRouteTableAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayRouteTableAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewayroutetableassociation_types.go b/apis/ec2/v1beta1/zz_transitgatewayroutetableassociation_types.go index a625a783e1..f8483fc8c1 100755 --- a/apis/ec2/v1beta1/zz_transitgatewayroutetableassociation_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewayroutetableassociation_types.go @@ -120,13 +120,14 @@ type TransitGatewayRouteTableAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayRouteTableAssociation is the Schema for the TransitGatewayRouteTableAssociations API. Manages an EC2 Transit Gateway Route Table association // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayRouteTableAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewayroutetablepropagation_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewayroutetablepropagation_terraformed.go new file mode 100755 index 0000000000..2a746ce0f3 --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewayroutetablepropagation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayRouteTablePropagation +func (mg *TransitGatewayRouteTablePropagation) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_route_table_propagation" +} + +// GetConnectionDetailsMapping for this TransitGatewayRouteTablePropagation +func (tr *TransitGatewayRouteTablePropagation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayRouteTablePropagation +func (tr *TransitGatewayRouteTablePropagation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayRouteTablePropagation +func (tr *TransitGatewayRouteTablePropagation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayRouteTablePropagation +func (tr *TransitGatewayRouteTablePropagation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayRouteTablePropagation +func (tr *TransitGatewayRouteTablePropagation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayRouteTablePropagation +func (tr *TransitGatewayRouteTablePropagation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayRouteTablePropagation +func (tr *TransitGatewayRouteTablePropagation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayRouteTablePropagation +func (tr *TransitGatewayRouteTablePropagation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayRouteTablePropagation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayRouteTablePropagation) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayRouteTablePropagationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayRouteTablePropagation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewayroutetablepropagation_types.go b/apis/ec2/v1beta1/zz_transitgatewayroutetablepropagation_types.go index 8ea262f62d..66f58e5896 100755 --- a/apis/ec2/v1beta1/zz_transitgatewayroutetablepropagation_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewayroutetablepropagation_types.go @@ -120,13 +120,14 @@ type TransitGatewayRouteTablePropagationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayRouteTablePropagation is the Schema for the TransitGatewayRouteTablePropagations API. Manages an EC2 Transit Gateway Route Table propagation // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayRouteTablePropagation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewayvpcattachment_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewayvpcattachment_terraformed.go new file mode 100755 index 0000000000..98e014bff8 --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewayvpcattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayVPCAttachment +func (mg *TransitGatewayVPCAttachment) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_vpc_attachment" +} + +// GetConnectionDetailsMapping for this TransitGatewayVPCAttachment +func (tr *TransitGatewayVPCAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayVPCAttachment +func (tr *TransitGatewayVPCAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayVPCAttachment +func (tr *TransitGatewayVPCAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayVPCAttachment +func (tr *TransitGatewayVPCAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayVPCAttachment +func (tr *TransitGatewayVPCAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayVPCAttachment +func (tr *TransitGatewayVPCAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayVPCAttachment +func (tr *TransitGatewayVPCAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayVPCAttachment +func (tr *TransitGatewayVPCAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayVPCAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayVPCAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayVPCAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayVPCAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewayvpcattachment_types.go b/apis/ec2/v1beta1/zz_transitgatewayvpcattachment_types.go index 3a03b56cf7..1b84c19446 100755 --- a/apis/ec2/v1beta1/zz_transitgatewayvpcattachment_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewayvpcattachment_types.go @@ -219,13 +219,14 @@ type TransitGatewayVPCAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayVPCAttachment is the Schema for the TransitGatewayVPCAttachments API. Manages an EC2 Transit Gateway VPC Attachment // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayVPCAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_transitgatewayvpcattachmentaccepter_terraformed.go b/apis/ec2/v1beta1/zz_transitgatewayvpcattachmentaccepter_terraformed.go new file mode 100755 index 0000000000..4086ccffa4 --- /dev/null +++ b/apis/ec2/v1beta1/zz_transitgatewayvpcattachmentaccepter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayVPCAttachmentAccepter +func (mg *TransitGatewayVPCAttachmentAccepter) GetTerraformResourceType() string { + return "aws_ec2_transit_gateway_vpc_attachment_accepter" +} + +// GetConnectionDetailsMapping for this TransitGatewayVPCAttachmentAccepter +func (tr *TransitGatewayVPCAttachmentAccepter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayVPCAttachmentAccepter +func (tr *TransitGatewayVPCAttachmentAccepter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayVPCAttachmentAccepter +func (tr *TransitGatewayVPCAttachmentAccepter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayVPCAttachmentAccepter +func (tr *TransitGatewayVPCAttachmentAccepter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayVPCAttachmentAccepter +func (tr *TransitGatewayVPCAttachmentAccepter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayVPCAttachmentAccepter +func (tr *TransitGatewayVPCAttachmentAccepter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayVPCAttachmentAccepter +func (tr *TransitGatewayVPCAttachmentAccepter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayVPCAttachmentAccepter +func (tr *TransitGatewayVPCAttachmentAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayVPCAttachmentAccepter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayVPCAttachmentAccepter) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayVPCAttachmentAccepterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayVPCAttachmentAccepter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_transitgatewayvpcattachmentaccepter_types.go b/apis/ec2/v1beta1/zz_transitgatewayvpcattachmentaccepter_types.go index 2a7a48add7..d9dbd38e89 100755 --- a/apis/ec2/v1beta1/zz_transitgatewayvpcattachmentaccepter_types.go +++ b/apis/ec2/v1beta1/zz_transitgatewayvpcattachmentaccepter_types.go @@ -145,13 +145,14 @@ type TransitGatewayVPCAttachmentAccepterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayVPCAttachmentAccepter is the Schema for the TransitGatewayVPCAttachmentAccepters API. Manages the accepter's side of an EC2 Transit Gateway VPC Attachment // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayVPCAttachmentAccepter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_volumeattachment_terraformed.go b/apis/ec2/v1beta1/zz_volumeattachment_terraformed.go new file mode 100755 index 0000000000..70ff702e8e --- /dev/null +++ b/apis/ec2/v1beta1/zz_volumeattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VolumeAttachment +func (mg *VolumeAttachment) GetTerraformResourceType() string { + return "aws_volume_attachment" +} + +// GetConnectionDetailsMapping for this VolumeAttachment +func (tr *VolumeAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VolumeAttachment +func (tr *VolumeAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VolumeAttachment +func (tr *VolumeAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VolumeAttachment +func (tr *VolumeAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VolumeAttachment +func (tr *VolumeAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VolumeAttachment +func (tr *VolumeAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VolumeAttachment +func (tr *VolumeAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VolumeAttachment +func (tr *VolumeAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VolumeAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VolumeAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &VolumeAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VolumeAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_volumeattachment_types.go b/apis/ec2/v1beta1/zz_volumeattachment_types.go index 0b0547118c..240258253c 100755 --- a/apis/ec2/v1beta1/zz_volumeattachment_types.go +++ b/apis/ec2/v1beta1/zz_volumeattachment_types.go @@ -178,13 +178,14 @@ type VolumeAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VolumeAttachment is the Schema for the VolumeAttachments API. Provides an AWS EBS Volume Attachment // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VolumeAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpc_terraformed.go b/apis/ec2/v1beta1/zz_vpc_terraformed.go new file mode 100755 index 0000000000..7282612eec --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpc_terraformed.go @@ -0,0 +1,135 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPC +func (mg *VPC) GetTerraformResourceType() string { + return "aws_vpc" +} + +// GetConnectionDetailsMapping for this VPC +func (tr *VPC) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPC +func (tr *VPC) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPC +func (tr *VPC) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPC +func (tr *VPC) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPC +func (tr *VPC) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPC +func (tr *VPC) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPC +func (tr *VPC) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPC +func (tr *VPC) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPC using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPC) LateInitialize(attrs []byte) (bool, error) { + params := &VPCParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("CidrBlock")) + opts = append(opts, resource.WithNameFilter("IPv6CidrBlock")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPC) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ec2/v1beta1/zz_vpc_types.go b/apis/ec2/v1beta1/zz_vpc_types.go index 03bf0c7818..a67944a86b 100755 --- a/apis/ec2/v1beta1/zz_vpc_types.go +++ b/apis/ec2/v1beta1/zz_vpc_types.go @@ -270,13 +270,14 @@ type VPCStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPC is the Schema for the VPCs API. Provides a VPC resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPC struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcdhcpoptions_terraformed.go b/apis/ec2/v1beta1/zz_vpcdhcpoptions_terraformed.go new file mode 100755 index 0000000000..0177478b2b --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcdhcpoptions_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCDHCPOptions +func (mg *VPCDHCPOptions) GetTerraformResourceType() string { + return "aws_vpc_dhcp_options" +} + +// GetConnectionDetailsMapping for this VPCDHCPOptions +func (tr *VPCDHCPOptions) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCDHCPOptions +func (tr *VPCDHCPOptions) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCDHCPOptions +func (tr *VPCDHCPOptions) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCDHCPOptions +func (tr *VPCDHCPOptions) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCDHCPOptions +func (tr *VPCDHCPOptions) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCDHCPOptions +func (tr *VPCDHCPOptions) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCDHCPOptions +func (tr *VPCDHCPOptions) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCDHCPOptions +func (tr *VPCDHCPOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCDHCPOptions using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCDHCPOptions) LateInitialize(attrs []byte) (bool, error) { + params := &VPCDHCPOptionsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCDHCPOptions) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcdhcpoptions_types.go b/apis/ec2/v1beta1/zz_vpcdhcpoptions_types.go index 49203f659d..0384c2809d 100755 --- a/apis/ec2/v1beta1/zz_vpcdhcpoptions_types.go +++ b/apis/ec2/v1beta1/zz_vpcdhcpoptions_types.go @@ -131,13 +131,14 @@ type VPCDHCPOptionsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCDHCPOptions is the Schema for the VPCDHCPOptionss API. Provides a VPC DHCP Options resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCDHCPOptions struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcdhcpoptionsassociation_terraformed.go b/apis/ec2/v1beta1/zz_vpcdhcpoptionsassociation_terraformed.go new file mode 100755 index 0000000000..e0df4b4f23 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcdhcpoptionsassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCDHCPOptionsAssociation +func (mg *VPCDHCPOptionsAssociation) GetTerraformResourceType() string { + return "aws_vpc_dhcp_options_association" +} + +// GetConnectionDetailsMapping for this VPCDHCPOptionsAssociation +func (tr *VPCDHCPOptionsAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCDHCPOptionsAssociation +func (tr *VPCDHCPOptionsAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCDHCPOptionsAssociation +func (tr *VPCDHCPOptionsAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCDHCPOptionsAssociation +func (tr *VPCDHCPOptionsAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCDHCPOptionsAssociation +func (tr *VPCDHCPOptionsAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCDHCPOptionsAssociation +func (tr *VPCDHCPOptionsAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCDHCPOptionsAssociation +func (tr *VPCDHCPOptionsAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCDHCPOptionsAssociation +func (tr *VPCDHCPOptionsAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCDHCPOptionsAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCDHCPOptionsAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &VPCDHCPOptionsAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCDHCPOptionsAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcdhcpoptionsassociation_types.go b/apis/ec2/v1beta1/zz_vpcdhcpoptionsassociation_types.go index 085703f820..e6f54509da 100755 --- a/apis/ec2/v1beta1/zz_vpcdhcpoptionsassociation_types.go +++ b/apis/ec2/v1beta1/zz_vpcdhcpoptionsassociation_types.go @@ -116,13 +116,14 @@ type VPCDHCPOptionsAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCDHCPOptionsAssociation is the Schema for the VPCDHCPOptionsAssociations API. Provides a VPC DHCP Options Association resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCDHCPOptionsAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcendpoint_terraformed.go b/apis/ec2/v1beta1/zz_vpcendpoint_terraformed.go new file mode 100755 index 0000000000..22bf08382c --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcendpoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCEndpoint +func (mg *VPCEndpoint) GetTerraformResourceType() string { + return "aws_vpc_endpoint" +} + +// GetConnectionDetailsMapping for this VPCEndpoint +func (tr *VPCEndpoint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCEndpoint +func (tr *VPCEndpoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCEndpoint +func (tr *VPCEndpoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCEndpoint +func (tr *VPCEndpoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCEndpoint +func (tr *VPCEndpoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCEndpoint +func (tr *VPCEndpoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCEndpoint +func (tr *VPCEndpoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCEndpoint +func (tr *VPCEndpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCEndpoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCEndpoint) LateInitialize(attrs []byte) (bool, error) { + params := &VPCEndpointParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCEndpoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcendpoint_types.go b/apis/ec2/v1beta1/zz_vpcendpoint_types.go index 731776ceca..dab0e69d2b 100755 --- a/apis/ec2/v1beta1/zz_vpcendpoint_types.go +++ b/apis/ec2/v1beta1/zz_vpcendpoint_types.go @@ -268,13 +268,14 @@ type VPCEndpointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCEndpoint is the Schema for the VPCEndpoints API. Provides a VPC Endpoint resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCEndpoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcendpointconnectionnotification_terraformed.go b/apis/ec2/v1beta1/zz_vpcendpointconnectionnotification_terraformed.go new file mode 100755 index 0000000000..4225b14ac2 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcendpointconnectionnotification_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCEndpointConnectionNotification +func (mg *VPCEndpointConnectionNotification) GetTerraformResourceType() string { + return "aws_vpc_endpoint_connection_notification" +} + +// GetConnectionDetailsMapping for this VPCEndpointConnectionNotification +func (tr *VPCEndpointConnectionNotification) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCEndpointConnectionNotification +func (tr *VPCEndpointConnectionNotification) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCEndpointConnectionNotification +func (tr *VPCEndpointConnectionNotification) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCEndpointConnectionNotification +func (tr *VPCEndpointConnectionNotification) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCEndpointConnectionNotification +func (tr *VPCEndpointConnectionNotification) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCEndpointConnectionNotification +func (tr *VPCEndpointConnectionNotification) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCEndpointConnectionNotification +func (tr *VPCEndpointConnectionNotification) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCEndpointConnectionNotification +func (tr *VPCEndpointConnectionNotification) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCEndpointConnectionNotification using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCEndpointConnectionNotification) LateInitialize(attrs []byte) (bool, error) { + params := &VPCEndpointConnectionNotificationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCEndpointConnectionNotification) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcendpointconnectionnotification_types.go b/apis/ec2/v1beta1/zz_vpcendpointconnectionnotification_types.go index 3ba4afeca2..35cccd5552 100755 --- a/apis/ec2/v1beta1/zz_vpcendpointconnectionnotification_types.go +++ b/apis/ec2/v1beta1/zz_vpcendpointconnectionnotification_types.go @@ -147,13 +147,14 @@ type VPCEndpointConnectionNotificationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCEndpointConnectionNotification is the Schema for the VPCEndpointConnectionNotifications API. Provides a VPC Endpoint connection notification resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCEndpointConnectionNotification struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcendpointroutetableassociation_terraformed.go b/apis/ec2/v1beta1/zz_vpcendpointroutetableassociation_terraformed.go new file mode 100755 index 0000000000..af8bad39cc --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcendpointroutetableassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCEndpointRouteTableAssociation +func (mg *VPCEndpointRouteTableAssociation) GetTerraformResourceType() string { + return "aws_vpc_endpoint_route_table_association" +} + +// GetConnectionDetailsMapping for this VPCEndpointRouteTableAssociation +func (tr *VPCEndpointRouteTableAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCEndpointRouteTableAssociation +func (tr *VPCEndpointRouteTableAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCEndpointRouteTableAssociation +func (tr *VPCEndpointRouteTableAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCEndpointRouteTableAssociation +func (tr *VPCEndpointRouteTableAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCEndpointRouteTableAssociation +func (tr *VPCEndpointRouteTableAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCEndpointRouteTableAssociation +func (tr *VPCEndpointRouteTableAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCEndpointRouteTableAssociation +func (tr *VPCEndpointRouteTableAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCEndpointRouteTableAssociation +func (tr *VPCEndpointRouteTableAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCEndpointRouteTableAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCEndpointRouteTableAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &VPCEndpointRouteTableAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCEndpointRouteTableAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcendpointroutetableassociation_types.go b/apis/ec2/v1beta1/zz_vpcendpointroutetableassociation_types.go index 5649100a19..98b7d66f2f 100755 --- a/apis/ec2/v1beta1/zz_vpcendpointroutetableassociation_types.go +++ b/apis/ec2/v1beta1/zz_vpcendpointroutetableassociation_types.go @@ -118,13 +118,14 @@ type VPCEndpointRouteTableAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCEndpointRouteTableAssociation is the Schema for the VPCEndpointRouteTableAssociations API. Manages a VPC Endpoint Route Table Association // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCEndpointRouteTableAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcendpointsecuritygroupassociation_terraformed.go b/apis/ec2/v1beta1/zz_vpcendpointsecuritygroupassociation_terraformed.go new file mode 100755 index 0000000000..aa69c788ca --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcendpointsecuritygroupassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCEndpointSecurityGroupAssociation +func (mg *VPCEndpointSecurityGroupAssociation) GetTerraformResourceType() string { + return "aws_vpc_endpoint_security_group_association" +} + +// GetConnectionDetailsMapping for this VPCEndpointSecurityGroupAssociation +func (tr *VPCEndpointSecurityGroupAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCEndpointSecurityGroupAssociation +func (tr *VPCEndpointSecurityGroupAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCEndpointSecurityGroupAssociation +func (tr *VPCEndpointSecurityGroupAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCEndpointSecurityGroupAssociation +func (tr *VPCEndpointSecurityGroupAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCEndpointSecurityGroupAssociation +func (tr *VPCEndpointSecurityGroupAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCEndpointSecurityGroupAssociation +func (tr *VPCEndpointSecurityGroupAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCEndpointSecurityGroupAssociation +func (tr *VPCEndpointSecurityGroupAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCEndpointSecurityGroupAssociation +func (tr *VPCEndpointSecurityGroupAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCEndpointSecurityGroupAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCEndpointSecurityGroupAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &VPCEndpointSecurityGroupAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCEndpointSecurityGroupAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcendpointsecuritygroupassociation_types.go b/apis/ec2/v1beta1/zz_vpcendpointsecuritygroupassociation_types.go index 0fec563a01..61084e86a5 100755 --- a/apis/ec2/v1beta1/zz_vpcendpointsecuritygroupassociation_types.go +++ b/apis/ec2/v1beta1/zz_vpcendpointsecuritygroupassociation_types.go @@ -126,13 +126,14 @@ type VPCEndpointSecurityGroupAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCEndpointSecurityGroupAssociation is the Schema for the VPCEndpointSecurityGroupAssociations API. Provides a resource to create an association between a VPC endpoint and a security group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCEndpointSecurityGroupAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcendpointservice_terraformed.go b/apis/ec2/v1beta1/zz_vpcendpointservice_terraformed.go new file mode 100755 index 0000000000..e16179ee0f --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcendpointservice_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCEndpointService +func (mg *VPCEndpointService) GetTerraformResourceType() string { + return "aws_vpc_endpoint_service" +} + +// GetConnectionDetailsMapping for this VPCEndpointService +func (tr *VPCEndpointService) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCEndpointService +func (tr *VPCEndpointService) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCEndpointService +func (tr *VPCEndpointService) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCEndpointService +func (tr *VPCEndpointService) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCEndpointService +func (tr *VPCEndpointService) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCEndpointService +func (tr *VPCEndpointService) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCEndpointService +func (tr *VPCEndpointService) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCEndpointService +func (tr *VPCEndpointService) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCEndpointService using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCEndpointService) LateInitialize(attrs []byte) (bool, error) { + params := &VPCEndpointServiceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCEndpointService) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcendpointservice_types.go b/apis/ec2/v1beta1/zz_vpcendpointservice_types.go index 118b8f6659..9f9fc1e12d 100755 --- a/apis/ec2/v1beta1/zz_vpcendpointservice_types.go +++ b/apis/ec2/v1beta1/zz_vpcendpointservice_types.go @@ -185,13 +185,14 @@ type VPCEndpointServiceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCEndpointService is the Schema for the VPCEndpointServices API. Provides a VPC Endpoint Service resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCEndpointService struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcendpointserviceallowedprincipal_terraformed.go b/apis/ec2/v1beta1/zz_vpcendpointserviceallowedprincipal_terraformed.go new file mode 100755 index 0000000000..4c7e6ab6c3 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcendpointserviceallowedprincipal_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCEndpointServiceAllowedPrincipal +func (mg *VPCEndpointServiceAllowedPrincipal) GetTerraformResourceType() string { + return "aws_vpc_endpoint_service_allowed_principal" +} + +// GetConnectionDetailsMapping for this VPCEndpointServiceAllowedPrincipal +func (tr *VPCEndpointServiceAllowedPrincipal) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCEndpointServiceAllowedPrincipal +func (tr *VPCEndpointServiceAllowedPrincipal) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCEndpointServiceAllowedPrincipal +func (tr *VPCEndpointServiceAllowedPrincipal) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCEndpointServiceAllowedPrincipal +func (tr *VPCEndpointServiceAllowedPrincipal) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCEndpointServiceAllowedPrincipal +func (tr *VPCEndpointServiceAllowedPrincipal) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCEndpointServiceAllowedPrincipal +func (tr *VPCEndpointServiceAllowedPrincipal) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCEndpointServiceAllowedPrincipal +func (tr *VPCEndpointServiceAllowedPrincipal) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCEndpointServiceAllowedPrincipal +func (tr *VPCEndpointServiceAllowedPrincipal) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCEndpointServiceAllowedPrincipal using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCEndpointServiceAllowedPrincipal) LateInitialize(attrs []byte) (bool, error) { + params := &VPCEndpointServiceAllowedPrincipalParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCEndpointServiceAllowedPrincipal) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcendpointserviceallowedprincipal_types.go b/apis/ec2/v1beta1/zz_vpcendpointserviceallowedprincipal_types.go index 0f76c92715..dc01cb0198 100755 --- a/apis/ec2/v1beta1/zz_vpcendpointserviceallowedprincipal_types.go +++ b/apis/ec2/v1beta1/zz_vpcendpointserviceallowedprincipal_types.go @@ -98,13 +98,14 @@ type VPCEndpointServiceAllowedPrincipalStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCEndpointServiceAllowedPrincipal is the Schema for the VPCEndpointServiceAllowedPrincipals API. Provides a resource to allow a principal to discover a VPC endpoint service. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCEndpointServiceAllowedPrincipal struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcendpointsubnetassociation_terraformed.go b/apis/ec2/v1beta1/zz_vpcendpointsubnetassociation_terraformed.go new file mode 100755 index 0000000000..3391d43241 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcendpointsubnetassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCEndpointSubnetAssociation +func (mg *VPCEndpointSubnetAssociation) GetTerraformResourceType() string { + return "aws_vpc_endpoint_subnet_association" +} + +// GetConnectionDetailsMapping for this VPCEndpointSubnetAssociation +func (tr *VPCEndpointSubnetAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCEndpointSubnetAssociation +func (tr *VPCEndpointSubnetAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCEndpointSubnetAssociation +func (tr *VPCEndpointSubnetAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCEndpointSubnetAssociation +func (tr *VPCEndpointSubnetAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCEndpointSubnetAssociation +func (tr *VPCEndpointSubnetAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCEndpointSubnetAssociation +func (tr *VPCEndpointSubnetAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCEndpointSubnetAssociation +func (tr *VPCEndpointSubnetAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCEndpointSubnetAssociation +func (tr *VPCEndpointSubnetAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCEndpointSubnetAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCEndpointSubnetAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &VPCEndpointSubnetAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCEndpointSubnetAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcendpointsubnetassociation_types.go b/apis/ec2/v1beta1/zz_vpcendpointsubnetassociation_types.go index 10622aa500..1ca3b5e58d 100755 --- a/apis/ec2/v1beta1/zz_vpcendpointsubnetassociation_types.go +++ b/apis/ec2/v1beta1/zz_vpcendpointsubnetassociation_types.go @@ -116,13 +116,14 @@ type VPCEndpointSubnetAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCEndpointSubnetAssociation is the Schema for the VPCEndpointSubnetAssociations API. Provides a resource to create an association between a VPC endpoint and a subnet. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCEndpointSubnetAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcipam_terraformed.go b/apis/ec2/v1beta1/zz_vpcipam_terraformed.go new file mode 100755 index 0000000000..dc2937da61 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcipam_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCIpam +func (mg *VPCIpam) GetTerraformResourceType() string { + return "aws_vpc_ipam" +} + +// GetConnectionDetailsMapping for this VPCIpam +func (tr *VPCIpam) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCIpam +func (tr *VPCIpam) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCIpam +func (tr *VPCIpam) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCIpam +func (tr *VPCIpam) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCIpam +func (tr *VPCIpam) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCIpam +func (tr *VPCIpam) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCIpam +func (tr *VPCIpam) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCIpam +func (tr *VPCIpam) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCIpam using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCIpam) LateInitialize(attrs []byte) (bool, error) { + params := &VPCIpamParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCIpam) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcipam_types.go b/apis/ec2/v1beta1/zz_vpcipam_types.go index 9a845f31d0..4a81251b03 100755 --- a/apis/ec2/v1beta1/zz_vpcipam_types.go +++ b/apis/ec2/v1beta1/zz_vpcipam_types.go @@ -143,13 +143,14 @@ type VPCIpamStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCIpam is the Schema for the VPCIpams API. Provides an IPAM resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCIpam struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcipampool_terraformed.go b/apis/ec2/v1beta1/zz_vpcipampool_terraformed.go new file mode 100755 index 0000000000..bdf6316bf5 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcipampool_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCIpamPool +func (mg *VPCIpamPool) GetTerraformResourceType() string { + return "aws_vpc_ipam_pool" +} + +// GetConnectionDetailsMapping for this VPCIpamPool +func (tr *VPCIpamPool) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCIpamPool +func (tr *VPCIpamPool) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCIpamPool +func (tr *VPCIpamPool) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCIpamPool +func (tr *VPCIpamPool) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCIpamPool +func (tr *VPCIpamPool) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCIpamPool +func (tr *VPCIpamPool) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCIpamPool +func (tr *VPCIpamPool) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCIpamPool +func (tr *VPCIpamPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCIpamPool using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCIpamPool) LateInitialize(attrs []byte) (bool, error) { + params := &VPCIpamPoolParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCIpamPool) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcipampool_types.go b/apis/ec2/v1beta1/zz_vpcipampool_types.go index 28de00803e..7ec01f1be3 100755 --- a/apis/ec2/v1beta1/zz_vpcipampool_types.go +++ b/apis/ec2/v1beta1/zz_vpcipampool_types.go @@ -259,13 +259,14 @@ type VPCIpamPoolStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCIpamPool is the Schema for the VPCIpamPools API. Provides a IP address pool resource for IPAM. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCIpamPool struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcipampoolcidr_terraformed.go b/apis/ec2/v1beta1/zz_vpcipampoolcidr_terraformed.go new file mode 100755 index 0000000000..987625890c --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcipampoolcidr_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCIpamPoolCidr +func (mg *VPCIpamPoolCidr) GetTerraformResourceType() string { + return "aws_vpc_ipam_pool_cidr" +} + +// GetConnectionDetailsMapping for this VPCIpamPoolCidr +func (tr *VPCIpamPoolCidr) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCIpamPoolCidr +func (tr *VPCIpamPoolCidr) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCIpamPoolCidr +func (tr *VPCIpamPoolCidr) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCIpamPoolCidr +func (tr *VPCIpamPoolCidr) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCIpamPoolCidr +func (tr *VPCIpamPoolCidr) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCIpamPoolCidr +func (tr *VPCIpamPoolCidr) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCIpamPoolCidr +func (tr *VPCIpamPoolCidr) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCIpamPoolCidr +func (tr *VPCIpamPoolCidr) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCIpamPoolCidr using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCIpamPoolCidr) LateInitialize(attrs []byte) (bool, error) { + params := &VPCIpamPoolCidrParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCIpamPoolCidr) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcipampoolcidr_types.go b/apis/ec2/v1beta1/zz_vpcipampoolcidr_types.go index f9a5a0a820..b577be9af3 100755 --- a/apis/ec2/v1beta1/zz_vpcipampoolcidr_types.go +++ b/apis/ec2/v1beta1/zz_vpcipampoolcidr_types.go @@ -150,13 +150,14 @@ type VPCIpamPoolCidrStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCIpamPoolCidr is the Schema for the VPCIpamPoolCidrs API. Provisions a CIDR from an IPAM address pool. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCIpamPoolCidr struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcipampoolcidrallocation_terraformed.go b/apis/ec2/v1beta1/zz_vpcipampoolcidrallocation_terraformed.go new file mode 100755 index 0000000000..3694861095 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcipampoolcidrallocation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCIpamPoolCidrAllocation +func (mg *VPCIpamPoolCidrAllocation) GetTerraformResourceType() string { + return "aws_vpc_ipam_pool_cidr_allocation" +} + +// GetConnectionDetailsMapping for this VPCIpamPoolCidrAllocation +func (tr *VPCIpamPoolCidrAllocation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCIpamPoolCidrAllocation +func (tr *VPCIpamPoolCidrAllocation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCIpamPoolCidrAllocation +func (tr *VPCIpamPoolCidrAllocation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCIpamPoolCidrAllocation +func (tr *VPCIpamPoolCidrAllocation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCIpamPoolCidrAllocation +func (tr *VPCIpamPoolCidrAllocation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCIpamPoolCidrAllocation +func (tr *VPCIpamPoolCidrAllocation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCIpamPoolCidrAllocation +func (tr *VPCIpamPoolCidrAllocation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCIpamPoolCidrAllocation +func (tr *VPCIpamPoolCidrAllocation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCIpamPoolCidrAllocation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCIpamPoolCidrAllocation) LateInitialize(attrs []byte) (bool, error) { + params := &VPCIpamPoolCidrAllocationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCIpamPoolCidrAllocation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcipampoolcidrallocation_types.go b/apis/ec2/v1beta1/zz_vpcipampoolcidrallocation_types.go index 8b2fb8f07b..4bc73db1e4 100755 --- a/apis/ec2/v1beta1/zz_vpcipampoolcidrallocation_types.go +++ b/apis/ec2/v1beta1/zz_vpcipampoolcidrallocation_types.go @@ -143,13 +143,14 @@ type VPCIpamPoolCidrAllocationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCIpamPoolCidrAllocation is the Schema for the VPCIpamPoolCidrAllocations API. Allocates (reserves) a CIDR from an IPAM address pool, preventing usage by IPAM. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCIpamPoolCidrAllocation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcipamscope_terraformed.go b/apis/ec2/v1beta1/zz_vpcipamscope_terraformed.go new file mode 100755 index 0000000000..47d4c0977a --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcipamscope_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCIpamScope +func (mg *VPCIpamScope) GetTerraformResourceType() string { + return "aws_vpc_ipam_scope" +} + +// GetConnectionDetailsMapping for this VPCIpamScope +func (tr *VPCIpamScope) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCIpamScope +func (tr *VPCIpamScope) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCIpamScope +func (tr *VPCIpamScope) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCIpamScope +func (tr *VPCIpamScope) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCIpamScope +func (tr *VPCIpamScope) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCIpamScope +func (tr *VPCIpamScope) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCIpamScope +func (tr *VPCIpamScope) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCIpamScope +func (tr *VPCIpamScope) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCIpamScope using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCIpamScope) LateInitialize(attrs []byte) (bool, error) { + params := &VPCIpamScopeParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCIpamScope) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcipamscope_types.go b/apis/ec2/v1beta1/zz_vpcipamscope_types.go index 0d1141642b..64ce2b2c38 100755 --- a/apis/ec2/v1beta1/zz_vpcipamscope_types.go +++ b/apis/ec2/v1beta1/zz_vpcipamscope_types.go @@ -127,13 +127,14 @@ type VPCIpamScopeStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCIpamScope is the Schema for the VPCIpamScopes API. Creates a scope for AWS IPAM. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCIpamScope struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcipv4cidrblockassociation_terraformed.go b/apis/ec2/v1beta1/zz_vpcipv4cidrblockassociation_terraformed.go new file mode 100755 index 0000000000..26df3bd508 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcipv4cidrblockassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCIPv4CidrBlockAssociation +func (mg *VPCIPv4CidrBlockAssociation) GetTerraformResourceType() string { + return "aws_vpc_ipv4_cidr_block_association" +} + +// GetConnectionDetailsMapping for this VPCIPv4CidrBlockAssociation +func (tr *VPCIPv4CidrBlockAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCIPv4CidrBlockAssociation +func (tr *VPCIPv4CidrBlockAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCIPv4CidrBlockAssociation +func (tr *VPCIPv4CidrBlockAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCIPv4CidrBlockAssociation +func (tr *VPCIPv4CidrBlockAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCIPv4CidrBlockAssociation +func (tr *VPCIPv4CidrBlockAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCIPv4CidrBlockAssociation +func (tr *VPCIPv4CidrBlockAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCIPv4CidrBlockAssociation +func (tr *VPCIPv4CidrBlockAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCIPv4CidrBlockAssociation +func (tr *VPCIPv4CidrBlockAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCIPv4CidrBlockAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCIPv4CidrBlockAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &VPCIPv4CidrBlockAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCIPv4CidrBlockAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcipv4cidrblockassociation_types.go b/apis/ec2/v1beta1/zz_vpcipv4cidrblockassociation_types.go index 039ec5bcf4..5114f8acf2 100755 --- a/apis/ec2/v1beta1/zz_vpcipv4cidrblockassociation_types.go +++ b/apis/ec2/v1beta1/zz_vpcipv4cidrblockassociation_types.go @@ -116,13 +116,14 @@ type VPCIPv4CidrBlockAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCIPv4CidrBlockAssociation is the Schema for the VPCIPv4CidrBlockAssociations API. Associate additional IPv4 CIDR blocks with a VPC // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCIPv4CidrBlockAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcpeeringconnection_terraformed.go b/apis/ec2/v1beta1/zz_vpcpeeringconnection_terraformed.go new file mode 100755 index 0000000000..7ebf82935a --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcpeeringconnection_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCPeeringConnection +func (mg *VPCPeeringConnection) GetTerraformResourceType() string { + return "aws_vpc_peering_connection" +} + +// GetConnectionDetailsMapping for this VPCPeeringConnection +func (tr *VPCPeeringConnection) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCPeeringConnection +func (tr *VPCPeeringConnection) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCPeeringConnection +func (tr *VPCPeeringConnection) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCPeeringConnection +func (tr *VPCPeeringConnection) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCPeeringConnection +func (tr *VPCPeeringConnection) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCPeeringConnection +func (tr *VPCPeeringConnection) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCPeeringConnection +func (tr *VPCPeeringConnection) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCPeeringConnection +func (tr *VPCPeeringConnection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCPeeringConnection using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCPeeringConnection) LateInitialize(attrs []byte) (bool, error) { + params := &VPCPeeringConnectionParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCPeeringConnection) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcpeeringconnection_types.go b/apis/ec2/v1beta1/zz_vpcpeeringconnection_types.go index 9227d93001..ef659965d9 100755 --- a/apis/ec2/v1beta1/zz_vpcpeeringconnection_types.go +++ b/apis/ec2/v1beta1/zz_vpcpeeringconnection_types.go @@ -224,13 +224,14 @@ type VPCPeeringConnectionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCPeeringConnection is the Schema for the VPCPeeringConnections API. Provides a resource to manage a VPC peering connection. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCPeeringConnection struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcpeeringconnectionaccepter_terraformed.go b/apis/ec2/v1beta1/zz_vpcpeeringconnectionaccepter_terraformed.go new file mode 100755 index 0000000000..9f9ae78cb0 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcpeeringconnectionaccepter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCPeeringConnectionAccepter +func (mg *VPCPeeringConnectionAccepter) GetTerraformResourceType() string { + return "aws_vpc_peering_connection_accepter" +} + +// GetConnectionDetailsMapping for this VPCPeeringConnectionAccepter +func (tr *VPCPeeringConnectionAccepter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCPeeringConnectionAccepter +func (tr *VPCPeeringConnectionAccepter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCPeeringConnectionAccepter +func (tr *VPCPeeringConnectionAccepter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCPeeringConnectionAccepter +func (tr *VPCPeeringConnectionAccepter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCPeeringConnectionAccepter +func (tr *VPCPeeringConnectionAccepter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCPeeringConnectionAccepter +func (tr *VPCPeeringConnectionAccepter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCPeeringConnectionAccepter +func (tr *VPCPeeringConnectionAccepter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCPeeringConnectionAccepter +func (tr *VPCPeeringConnectionAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCPeeringConnectionAccepter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCPeeringConnectionAccepter) LateInitialize(attrs []byte) (bool, error) { + params := &VPCPeeringConnectionAccepterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCPeeringConnectionAccepter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcpeeringconnectionaccepter_types.go b/apis/ec2/v1beta1/zz_vpcpeeringconnectionaccepter_types.go index a4c5658c0c..5fa0d8d0e5 100755 --- a/apis/ec2/v1beta1/zz_vpcpeeringconnectionaccepter_types.go +++ b/apis/ec2/v1beta1/zz_vpcpeeringconnectionaccepter_types.go @@ -252,13 +252,14 @@ type VPCPeeringConnectionAccepterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCPeeringConnectionAccepter is the Schema for the VPCPeeringConnectionAccepters API. Manage the accepter's side of a VPC Peering Connection. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCPeeringConnectionAccepter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpcpeeringconnectionoptions_terraformed.go b/apis/ec2/v1beta1/zz_vpcpeeringconnectionoptions_terraformed.go new file mode 100755 index 0000000000..10707f164e --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpcpeeringconnectionoptions_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCPeeringConnectionOptions +func (mg *VPCPeeringConnectionOptions) GetTerraformResourceType() string { + return "aws_vpc_peering_connection_options" +} + +// GetConnectionDetailsMapping for this VPCPeeringConnectionOptions +func (tr *VPCPeeringConnectionOptions) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCPeeringConnectionOptions +func (tr *VPCPeeringConnectionOptions) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCPeeringConnectionOptions +func (tr *VPCPeeringConnectionOptions) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCPeeringConnectionOptions +func (tr *VPCPeeringConnectionOptions) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCPeeringConnectionOptions +func (tr *VPCPeeringConnectionOptions) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCPeeringConnectionOptions +func (tr *VPCPeeringConnectionOptions) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCPeeringConnectionOptions +func (tr *VPCPeeringConnectionOptions) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCPeeringConnectionOptions +func (tr *VPCPeeringConnectionOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCPeeringConnectionOptions using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCPeeringConnectionOptions) LateInitialize(attrs []byte) (bool, error) { + params := &VPCPeeringConnectionOptionsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCPeeringConnectionOptions) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpcpeeringconnectionoptions_types.go b/apis/ec2/v1beta1/zz_vpcpeeringconnectionoptions_types.go index 44472ff819..6ba6d6a578 100755 --- a/apis/ec2/v1beta1/zz_vpcpeeringconnectionoptions_types.go +++ b/apis/ec2/v1beta1/zz_vpcpeeringconnectionoptions_types.go @@ -228,13 +228,14 @@ type VPCPeeringConnectionOptionsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCPeeringConnectionOptions is the Schema for the VPCPeeringConnectionOptionss API. Provides a resource to manage VPC peering connection options. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCPeeringConnectionOptions struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpnconnection_terraformed.go b/apis/ec2/v1beta1/zz_vpnconnection_terraformed.go new file mode 100755 index 0000000000..b8e1ec6bf4 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpnconnection_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPNConnection +func (mg *VPNConnection) GetTerraformResourceType() string { + return "aws_vpn_connection" +} + +// GetConnectionDetailsMapping for this VPNConnection +func (tr *VPNConnection) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"customer_gateway_configuration": "status.atProvider.customerGatewayConfiguration", "tunnel1_preshared_key": "spec.forProvider.tunnel1PresharedKeySecretRef", "tunnel2_preshared_key": "spec.forProvider.tunnel2PresharedKeySecretRef"} +} + +// GetObservation of this VPNConnection +func (tr *VPNConnection) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPNConnection +func (tr *VPNConnection) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPNConnection +func (tr *VPNConnection) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPNConnection +func (tr *VPNConnection) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPNConnection +func (tr *VPNConnection) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPNConnection +func (tr *VPNConnection) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPNConnection +func (tr *VPNConnection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPNConnection using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPNConnection) LateInitialize(attrs []byte) (bool, error) { + params := &VPNConnectionParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPNConnection) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpnconnection_types.go b/apis/ec2/v1beta1/zz_vpnconnection_types.go index 3d8878dc23..e9df1c73fd 100755 --- a/apis/ec2/v1beta1/zz_vpnconnection_types.go +++ b/apis/ec2/v1beta1/zz_vpnconnection_types.go @@ -922,13 +922,14 @@ type VPNConnectionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPNConnection is the Schema for the VPNConnections API. Manages a Site-to-Site VPN connection. A Site-to-Site VPN connection is an Internet Protocol security (IPsec) VPN connection between a VPC and an on-premises network. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPNConnection struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpnconnectionroute_terraformed.go b/apis/ec2/v1beta1/zz_vpnconnectionroute_terraformed.go new file mode 100755 index 0000000000..4204f8f801 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpnconnectionroute_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPNConnectionRoute +func (mg *VPNConnectionRoute) GetTerraformResourceType() string { + return "aws_vpn_connection_route" +} + +// GetConnectionDetailsMapping for this VPNConnectionRoute +func (tr *VPNConnectionRoute) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPNConnectionRoute +func (tr *VPNConnectionRoute) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPNConnectionRoute +func (tr *VPNConnectionRoute) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPNConnectionRoute +func (tr *VPNConnectionRoute) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPNConnectionRoute +func (tr *VPNConnectionRoute) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPNConnectionRoute +func (tr *VPNConnectionRoute) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPNConnectionRoute +func (tr *VPNConnectionRoute) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPNConnectionRoute +func (tr *VPNConnectionRoute) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPNConnectionRoute using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPNConnectionRoute) LateInitialize(attrs []byte) (bool, error) { + params := &VPNConnectionRouteParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPNConnectionRoute) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpnconnectionroute_types.go b/apis/ec2/v1beta1/zz_vpnconnectionroute_types.go index fd6c1736b9..df378ecfd3 100755 --- a/apis/ec2/v1beta1/zz_vpnconnectionroute_types.go +++ b/apis/ec2/v1beta1/zz_vpnconnectionroute_types.go @@ -97,13 +97,14 @@ type VPNConnectionRouteStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPNConnectionRoute is the Schema for the VPNConnectionRoutes API. Provides a static route between a VPN connection and a customer gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPNConnectionRoute struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpngateway_terraformed.go b/apis/ec2/v1beta1/zz_vpngateway_terraformed.go new file mode 100755 index 0000000000..aeeb140478 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpngateway_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPNGateway +func (mg *VPNGateway) GetTerraformResourceType() string { + return "aws_vpn_gateway" +} + +// GetConnectionDetailsMapping for this VPNGateway +func (tr *VPNGateway) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPNGateway +func (tr *VPNGateway) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPNGateway +func (tr *VPNGateway) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPNGateway +func (tr *VPNGateway) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPNGateway +func (tr *VPNGateway) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPNGateway +func (tr *VPNGateway) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPNGateway +func (tr *VPNGateway) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPNGateway +func (tr *VPNGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPNGateway using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPNGateway) LateInitialize(attrs []byte) (bool, error) { + params := &VPNGatewayParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPNGateway) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpngateway_types.go b/apis/ec2/v1beta1/zz_vpngateway_types.go index 679d661e4d..9542a30ac6 100755 --- a/apis/ec2/v1beta1/zz_vpngateway_types.go +++ b/apis/ec2/v1beta1/zz_vpngateway_types.go @@ -126,13 +126,14 @@ type VPNGatewayStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPNGateway is the Schema for the VPNGateways API. Provides a resource to create a VPC VPN Gateway. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPNGateway struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpngatewayattachment_terraformed.go b/apis/ec2/v1beta1/zz_vpngatewayattachment_terraformed.go new file mode 100755 index 0000000000..849c50810a --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpngatewayattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPNGatewayAttachment +func (mg *VPNGatewayAttachment) GetTerraformResourceType() string { + return "aws_vpn_gateway_attachment" +} + +// GetConnectionDetailsMapping for this VPNGatewayAttachment +func (tr *VPNGatewayAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPNGatewayAttachment +func (tr *VPNGatewayAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPNGatewayAttachment +func (tr *VPNGatewayAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPNGatewayAttachment +func (tr *VPNGatewayAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPNGatewayAttachment +func (tr *VPNGatewayAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPNGatewayAttachment +func (tr *VPNGatewayAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPNGatewayAttachment +func (tr *VPNGatewayAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPNGatewayAttachment +func (tr *VPNGatewayAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPNGatewayAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPNGatewayAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &VPNGatewayAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPNGatewayAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpngatewayattachment_types.go b/apis/ec2/v1beta1/zz_vpngatewayattachment_types.go index a3da93b9d2..d3fc1efa50 100755 --- a/apis/ec2/v1beta1/zz_vpngatewayattachment_types.go +++ b/apis/ec2/v1beta1/zz_vpngatewayattachment_types.go @@ -114,13 +114,14 @@ type VPNGatewayAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPNGatewayAttachment is the Schema for the VPNGatewayAttachments API. Provides a Virtual Private Gateway attachment resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPNGatewayAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ec2/v1beta1/zz_vpngatewayroutepropagation_terraformed.go b/apis/ec2/v1beta1/zz_vpngatewayroutepropagation_terraformed.go new file mode 100755 index 0000000000..fbaaf7a288 --- /dev/null +++ b/apis/ec2/v1beta1/zz_vpngatewayroutepropagation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPNGatewayRoutePropagation +func (mg *VPNGatewayRoutePropagation) GetTerraformResourceType() string { + return "aws_vpn_gateway_route_propagation" +} + +// GetConnectionDetailsMapping for this VPNGatewayRoutePropagation +func (tr *VPNGatewayRoutePropagation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPNGatewayRoutePropagation +func (tr *VPNGatewayRoutePropagation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPNGatewayRoutePropagation +func (tr *VPNGatewayRoutePropagation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPNGatewayRoutePropagation +func (tr *VPNGatewayRoutePropagation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPNGatewayRoutePropagation +func (tr *VPNGatewayRoutePropagation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPNGatewayRoutePropagation +func (tr *VPNGatewayRoutePropagation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPNGatewayRoutePropagation +func (tr *VPNGatewayRoutePropagation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPNGatewayRoutePropagation +func (tr *VPNGatewayRoutePropagation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPNGatewayRoutePropagation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPNGatewayRoutePropagation) LateInitialize(attrs []byte) (bool, error) { + params := &VPNGatewayRoutePropagationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPNGatewayRoutePropagation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ec2/v1beta1/zz_vpngatewayroutepropagation_types.go b/apis/ec2/v1beta1/zz_vpngatewayroutepropagation_types.go index c79d36f9c0..e6264e411c 100755 --- a/apis/ec2/v1beta1/zz_vpngatewayroutepropagation_types.go +++ b/apis/ec2/v1beta1/zz_vpngatewayroutepropagation_types.go @@ -116,13 +116,14 @@ type VPNGatewayRoutePropagationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPNGatewayRoutePropagation is the Schema for the VPNGatewayRoutePropagations API. Requests automatic route propagation between a VPN gateway and a route table. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPNGatewayRoutePropagation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecr/v1beta1/zz_generated.conversion_hubs.go b/apis/ecr/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..bd68a5dc64 --- /dev/null +++ b/apis/ecr/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *LifecyclePolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PullThroughCacheRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RegistryPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RegistryScanningConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReplicationConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Repository) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RepositoryPolicy) Hub() {} diff --git a/apis/ecr/v1beta1/zz_generated_terraformed.go b/apis/ecr/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 1d0addb4e7..0000000000 --- a/apis/ecr/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,817 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this LifecyclePolicy -func (mg *LifecyclePolicy) GetTerraformResourceType() string { - return "aws_ecr_lifecycle_policy" -} - -// GetConnectionDetailsMapping for this LifecyclePolicy -func (tr *LifecyclePolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LifecyclePolicy -func (tr *LifecyclePolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LifecyclePolicy -func (tr *LifecyclePolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LifecyclePolicy -func (tr *LifecyclePolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LifecyclePolicy -func (tr *LifecyclePolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LifecyclePolicy -func (tr *LifecyclePolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LifecyclePolicy -func (tr *LifecyclePolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LifecyclePolicy -func (tr *LifecyclePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LifecyclePolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LifecyclePolicy) LateInitialize(attrs []byte) (bool, error) { - params := &LifecyclePolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LifecyclePolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PullThroughCacheRule -func (mg *PullThroughCacheRule) GetTerraformResourceType() string { - return "aws_ecr_pull_through_cache_rule" -} - -// GetConnectionDetailsMapping for this PullThroughCacheRule -func (tr *PullThroughCacheRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PullThroughCacheRule -func (tr *PullThroughCacheRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PullThroughCacheRule -func (tr *PullThroughCacheRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PullThroughCacheRule -func (tr *PullThroughCacheRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PullThroughCacheRule -func (tr *PullThroughCacheRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PullThroughCacheRule -func (tr *PullThroughCacheRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PullThroughCacheRule -func (tr *PullThroughCacheRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PullThroughCacheRule -func (tr *PullThroughCacheRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PullThroughCacheRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PullThroughCacheRule) LateInitialize(attrs []byte) (bool, error) { - params := &PullThroughCacheRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PullThroughCacheRule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RegistryPolicy -func (mg *RegistryPolicy) GetTerraformResourceType() string { - return "aws_ecr_registry_policy" -} - -// GetConnectionDetailsMapping for this RegistryPolicy -func (tr *RegistryPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RegistryPolicy -func (tr *RegistryPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RegistryPolicy -func (tr *RegistryPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RegistryPolicy -func (tr *RegistryPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RegistryPolicy -func (tr *RegistryPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RegistryPolicy -func (tr *RegistryPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RegistryPolicy -func (tr *RegistryPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RegistryPolicy -func (tr *RegistryPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RegistryPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RegistryPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &RegistryPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RegistryPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RegistryScanningConfiguration -func (mg *RegistryScanningConfiguration) GetTerraformResourceType() string { - return "aws_ecr_registry_scanning_configuration" -} - -// GetConnectionDetailsMapping for this RegistryScanningConfiguration -func (tr *RegistryScanningConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RegistryScanningConfiguration -func (tr *RegistryScanningConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RegistryScanningConfiguration -func (tr *RegistryScanningConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RegistryScanningConfiguration -func (tr *RegistryScanningConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RegistryScanningConfiguration -func (tr *RegistryScanningConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RegistryScanningConfiguration -func (tr *RegistryScanningConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RegistryScanningConfiguration -func (tr *RegistryScanningConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RegistryScanningConfiguration -func (tr *RegistryScanningConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RegistryScanningConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RegistryScanningConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &RegistryScanningConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RegistryScanningConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReplicationConfiguration -func (mg *ReplicationConfiguration) GetTerraformResourceType() string { - return "aws_ecr_replication_configuration" -} - -// GetConnectionDetailsMapping for this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReplicationConfiguration -func (tr *ReplicationConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReplicationConfiguration -func (tr *ReplicationConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReplicationConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReplicationConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &ReplicationConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReplicationConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Repository -func (mg *Repository) GetTerraformResourceType() string { - return "aws_ecr_repository" -} - -// GetConnectionDetailsMapping for this Repository -func (tr *Repository) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Repository -func (tr *Repository) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Repository -func (tr *Repository) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Repository -func (tr *Repository) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Repository -func (tr *Repository) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Repository -func (tr *Repository) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Repository -func (tr *Repository) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Repository -func (tr *Repository) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Repository using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Repository) LateInitialize(attrs []byte) (bool, error) { - params := &RepositoryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Repository) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RepositoryPolicy -func (mg *RepositoryPolicy) GetTerraformResourceType() string { - return "aws_ecr_repository_policy" -} - -// GetConnectionDetailsMapping for this RepositoryPolicy -func (tr *RepositoryPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RepositoryPolicy -func (tr *RepositoryPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RepositoryPolicy -func (tr *RepositoryPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RepositoryPolicy -func (tr *RepositoryPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RepositoryPolicy -func (tr *RepositoryPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RepositoryPolicy -func (tr *RepositoryPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RepositoryPolicy -func (tr *RepositoryPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RepositoryPolicy -func (tr *RepositoryPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RepositoryPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RepositoryPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &RepositoryPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RepositoryPolicy) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/ecr/v1beta1/zz_lifecyclepolicy_terraformed.go b/apis/ecr/v1beta1/zz_lifecyclepolicy_terraformed.go new file mode 100755 index 0000000000..80f532a099 --- /dev/null +++ b/apis/ecr/v1beta1/zz_lifecyclepolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LifecyclePolicy +func (mg *LifecyclePolicy) GetTerraformResourceType() string { + return "aws_ecr_lifecycle_policy" +} + +// GetConnectionDetailsMapping for this LifecyclePolicy +func (tr *LifecyclePolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LifecyclePolicy +func (tr *LifecyclePolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LifecyclePolicy +func (tr *LifecyclePolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LifecyclePolicy +func (tr *LifecyclePolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LifecyclePolicy +func (tr *LifecyclePolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LifecyclePolicy +func (tr *LifecyclePolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LifecyclePolicy +func (tr *LifecyclePolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LifecyclePolicy +func (tr *LifecyclePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LifecyclePolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LifecyclePolicy) LateInitialize(attrs []byte) (bool, error) { + params := &LifecyclePolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LifecyclePolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecr/v1beta1/zz_lifecyclepolicy_types.go b/apis/ecr/v1beta1/zz_lifecyclepolicy_types.go index 009b412740..148123aa90 100755 --- a/apis/ecr/v1beta1/zz_lifecyclepolicy_types.go +++ b/apis/ecr/v1beta1/zz_lifecyclepolicy_types.go @@ -97,13 +97,14 @@ type LifecyclePolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LifecyclePolicy is the Schema for the LifecyclePolicys API. Manages an ECR repository lifecycle policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LifecyclePolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecr/v1beta1/zz_pullthroughcacherule_terraformed.go b/apis/ecr/v1beta1/zz_pullthroughcacherule_terraformed.go new file mode 100755 index 0000000000..6bb549c16f --- /dev/null +++ b/apis/ecr/v1beta1/zz_pullthroughcacherule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PullThroughCacheRule +func (mg *PullThroughCacheRule) GetTerraformResourceType() string { + return "aws_ecr_pull_through_cache_rule" +} + +// GetConnectionDetailsMapping for this PullThroughCacheRule +func (tr *PullThroughCacheRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PullThroughCacheRule +func (tr *PullThroughCacheRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PullThroughCacheRule +func (tr *PullThroughCacheRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PullThroughCacheRule +func (tr *PullThroughCacheRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PullThroughCacheRule +func (tr *PullThroughCacheRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PullThroughCacheRule +func (tr *PullThroughCacheRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PullThroughCacheRule +func (tr *PullThroughCacheRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PullThroughCacheRule +func (tr *PullThroughCacheRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PullThroughCacheRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PullThroughCacheRule) LateInitialize(attrs []byte) (bool, error) { + params := &PullThroughCacheRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PullThroughCacheRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecr/v1beta1/zz_pullthroughcacherule_types.go b/apis/ecr/v1beta1/zz_pullthroughcacherule_types.go index bc4da4e884..3d7e3c5b2b 100755 --- a/apis/ecr/v1beta1/zz_pullthroughcacherule_types.go +++ b/apis/ecr/v1beta1/zz_pullthroughcacherule_types.go @@ -80,13 +80,14 @@ type PullThroughCacheRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PullThroughCacheRule is the Schema for the PullThroughCacheRules API. Provides an Elastic Container Registry Pull Through Cache Rule. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PullThroughCacheRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecr/v1beta1/zz_registrypolicy_terraformed.go b/apis/ecr/v1beta1/zz_registrypolicy_terraformed.go new file mode 100755 index 0000000000..bd9125a7b4 --- /dev/null +++ b/apis/ecr/v1beta1/zz_registrypolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RegistryPolicy +func (mg *RegistryPolicy) GetTerraformResourceType() string { + return "aws_ecr_registry_policy" +} + +// GetConnectionDetailsMapping for this RegistryPolicy +func (tr *RegistryPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RegistryPolicy +func (tr *RegistryPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RegistryPolicy +func (tr *RegistryPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RegistryPolicy +func (tr *RegistryPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RegistryPolicy +func (tr *RegistryPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RegistryPolicy +func (tr *RegistryPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RegistryPolicy +func (tr *RegistryPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RegistryPolicy +func (tr *RegistryPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RegistryPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RegistryPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &RegistryPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RegistryPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecr/v1beta1/zz_registrypolicy_types.go b/apis/ecr/v1beta1/zz_registrypolicy_types.go index e4bddf2f2f..9aab1746f6 100755 --- a/apis/ecr/v1beta1/zz_registrypolicy_types.go +++ b/apis/ecr/v1beta1/zz_registrypolicy_types.go @@ -69,13 +69,14 @@ type RegistryPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RegistryPolicy is the Schema for the RegistryPolicys API. Provides an Elastic Container Registry Policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RegistryPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecr/v1beta1/zz_registryscanningconfiguration_terraformed.go b/apis/ecr/v1beta1/zz_registryscanningconfiguration_terraformed.go new file mode 100755 index 0000000000..1b463b255f --- /dev/null +++ b/apis/ecr/v1beta1/zz_registryscanningconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RegistryScanningConfiguration +func (mg *RegistryScanningConfiguration) GetTerraformResourceType() string { + return "aws_ecr_registry_scanning_configuration" +} + +// GetConnectionDetailsMapping for this RegistryScanningConfiguration +func (tr *RegistryScanningConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RegistryScanningConfiguration +func (tr *RegistryScanningConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RegistryScanningConfiguration +func (tr *RegistryScanningConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RegistryScanningConfiguration +func (tr *RegistryScanningConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RegistryScanningConfiguration +func (tr *RegistryScanningConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RegistryScanningConfiguration +func (tr *RegistryScanningConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RegistryScanningConfiguration +func (tr *RegistryScanningConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RegistryScanningConfiguration +func (tr *RegistryScanningConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RegistryScanningConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RegistryScanningConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &RegistryScanningConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RegistryScanningConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecr/v1beta1/zz_registryscanningconfiguration_types.go b/apis/ecr/v1beta1/zz_registryscanningconfiguration_types.go index 733ed592b6..49f3251a96 100755 --- a/apis/ecr/v1beta1/zz_registryscanningconfiguration_types.go +++ b/apis/ecr/v1beta1/zz_registryscanningconfiguration_types.go @@ -129,13 +129,14 @@ type RegistryScanningConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RegistryScanningConfiguration is the Schema for the RegistryScanningConfigurations API. Provides an Elastic Container Registry Scanning Configuration. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RegistryScanningConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecr/v1beta1/zz_replicationconfiguration_terraformed.go b/apis/ecr/v1beta1/zz_replicationconfiguration_terraformed.go new file mode 100755 index 0000000000..c97ec1bcee --- /dev/null +++ b/apis/ecr/v1beta1/zz_replicationconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReplicationConfiguration +func (mg *ReplicationConfiguration) GetTerraformResourceType() string { + return "aws_ecr_replication_configuration" +} + +// GetConnectionDetailsMapping for this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReplicationConfiguration +func (tr *ReplicationConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReplicationConfiguration +func (tr *ReplicationConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReplicationConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReplicationConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &ReplicationConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReplicationConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecr/v1beta1/zz_replicationconfiguration_types.go b/apis/ecr/v1beta1/zz_replicationconfiguration_types.go index a3ae04e46d..4d11018fdf 100755 --- a/apis/ecr/v1beta1/zz_replicationconfiguration_types.go +++ b/apis/ecr/v1beta1/zz_replicationconfiguration_types.go @@ -173,13 +173,14 @@ type ReplicationConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReplicationConfiguration is the Schema for the ReplicationConfigurations API. Provides an Elastic Container Registry Replication Configuration. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReplicationConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecr/v1beta1/zz_repository_terraformed.go b/apis/ecr/v1beta1/zz_repository_terraformed.go new file mode 100755 index 0000000000..459588abd7 --- /dev/null +++ b/apis/ecr/v1beta1/zz_repository_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Repository +func (mg *Repository) GetTerraformResourceType() string { + return "aws_ecr_repository" +} + +// GetConnectionDetailsMapping for this Repository +func (tr *Repository) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Repository +func (tr *Repository) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Repository +func (tr *Repository) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Repository +func (tr *Repository) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Repository +func (tr *Repository) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Repository +func (tr *Repository) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Repository +func (tr *Repository) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Repository +func (tr *Repository) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Repository using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Repository) LateInitialize(attrs []byte) (bool, error) { + params := &RepositoryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Repository) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecr/v1beta1/zz_repository_types.go b/apis/ecr/v1beta1/zz_repository_types.go index 32ca62f98f..1050577fcc 100755 --- a/apis/ecr/v1beta1/zz_repository_types.go +++ b/apis/ecr/v1beta1/zz_repository_types.go @@ -194,13 +194,14 @@ type RepositoryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Repository is the Schema for the Repositorys API. Provides an Elastic Container Registry Repository. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Repository struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecr/v1beta1/zz_repositorypolicy_terraformed.go b/apis/ecr/v1beta1/zz_repositorypolicy_terraformed.go new file mode 100755 index 0000000000..bbc82b76d0 --- /dev/null +++ b/apis/ecr/v1beta1/zz_repositorypolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RepositoryPolicy +func (mg *RepositoryPolicy) GetTerraformResourceType() string { + return "aws_ecr_repository_policy" +} + +// GetConnectionDetailsMapping for this RepositoryPolicy +func (tr *RepositoryPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RepositoryPolicy +func (tr *RepositoryPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RepositoryPolicy +func (tr *RepositoryPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RepositoryPolicy +func (tr *RepositoryPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RepositoryPolicy +func (tr *RepositoryPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RepositoryPolicy +func (tr *RepositoryPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RepositoryPolicy +func (tr *RepositoryPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RepositoryPolicy +func (tr *RepositoryPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RepositoryPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RepositoryPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &RepositoryPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RepositoryPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecr/v1beta1/zz_repositorypolicy_types.go b/apis/ecr/v1beta1/zz_repositorypolicy_types.go index aa44928ac2..92b03437dd 100755 --- a/apis/ecr/v1beta1/zz_repositorypolicy_types.go +++ b/apis/ecr/v1beta1/zz_repositorypolicy_types.go @@ -97,13 +97,14 @@ type RepositoryPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RepositoryPolicy is the Schema for the RepositoryPolicys API. Provides an Elastic Container Registry Repository Policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RepositoryPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecrpublic/v1beta1/zz_generated.conversion_hubs.go b/apis/ecrpublic/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..bc6cee6d69 --- /dev/null +++ b/apis/ecrpublic/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Repository) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RepositoryPolicy) Hub() {} diff --git a/apis/ecrpublic/v1beta1/zz_repository_terraformed.go b/apis/ecrpublic/v1beta1/zz_repository_terraformed.go new file mode 100755 index 0000000000..5f8728fc14 --- /dev/null +++ b/apis/ecrpublic/v1beta1/zz_repository_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Repository +func (mg *Repository) GetTerraformResourceType() string { + return "aws_ecrpublic_repository" +} + +// GetConnectionDetailsMapping for this Repository +func (tr *Repository) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Repository +func (tr *Repository) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Repository +func (tr *Repository) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Repository +func (tr *Repository) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Repository +func (tr *Repository) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Repository +func (tr *Repository) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Repository +func (tr *Repository) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Repository +func (tr *Repository) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Repository using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Repository) LateInitialize(attrs []byte) (bool, error) { + params := &RepositoryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Repository) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecrpublic/v1beta1/zz_repository_types.go b/apis/ecrpublic/v1beta1/zz_repository_types.go index 21d35c674b..cb0d3b563e 100755 --- a/apis/ecrpublic/v1beta1/zz_repository_types.go +++ b/apis/ecrpublic/v1beta1/zz_repository_types.go @@ -176,13 +176,14 @@ type RepositoryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Repository is the Schema for the Repositorys API. Provides a Public Elastic Container Registry Repository. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Repository struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecrpublic/v1beta1/zz_generated_terraformed.go b/apis/ecrpublic/v1beta1/zz_repositorypolicy_terraformed.go similarity index 53% rename from apis/ecrpublic/v1beta1/zz_generated_terraformed.go rename to apis/ecrpublic/v1beta1/zz_repositorypolicy_terraformed.go index bbbc8534e3..9524b0a83d 100755 --- a/apis/ecrpublic/v1beta1/zz_generated_terraformed.go +++ b/apis/ecrpublic/v1beta1/zz_repositorypolicy_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Repository -func (mg *Repository) GetTerraformResourceType() string { - return "aws_ecrpublic_repository" -} - -// GetConnectionDetailsMapping for this Repository -func (tr *Repository) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Repository -func (tr *Repository) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Repository -func (tr *Repository) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Repository -func (tr *Repository) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Repository -func (tr *Repository) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Repository -func (tr *Repository) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Repository -func (tr *Repository) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Repository -func (tr *Repository) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Repository using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Repository) LateInitialize(attrs []byte) (bool, error) { - params := &RepositoryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Repository) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this RepositoryPolicy func (mg *RepositoryPolicy) GetTerraformResourceType() string { return "aws_ecrpublic_repository_policy" diff --git a/apis/ecrpublic/v1beta1/zz_repositorypolicy_types.go b/apis/ecrpublic/v1beta1/zz_repositorypolicy_types.go index 8682368df0..a11ced3790 100755 --- a/apis/ecrpublic/v1beta1/zz_repositorypolicy_types.go +++ b/apis/ecrpublic/v1beta1/zz_repositorypolicy_types.go @@ -97,13 +97,14 @@ type RepositoryPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RepositoryPolicy is the Schema for the RepositoryPolicys API. Provides an Elastic Container Registry Public Repository Policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RepositoryPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecs/v1beta1/zz_accountsettingdefault_terraformed.go b/apis/ecs/v1beta1/zz_accountsettingdefault_terraformed.go new file mode 100755 index 0000000000..11789bc5af --- /dev/null +++ b/apis/ecs/v1beta1/zz_accountsettingdefault_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AccountSettingDefault +func (mg *AccountSettingDefault) GetTerraformResourceType() string { + return "aws_ecs_account_setting_default" +} + +// GetConnectionDetailsMapping for this AccountSettingDefault +func (tr *AccountSettingDefault) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AccountSettingDefault +func (tr *AccountSettingDefault) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AccountSettingDefault +func (tr *AccountSettingDefault) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AccountSettingDefault +func (tr *AccountSettingDefault) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AccountSettingDefault +func (tr *AccountSettingDefault) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AccountSettingDefault +func (tr *AccountSettingDefault) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AccountSettingDefault +func (tr *AccountSettingDefault) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AccountSettingDefault +func (tr *AccountSettingDefault) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AccountSettingDefault using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AccountSettingDefault) LateInitialize(attrs []byte) (bool, error) { + params := &AccountSettingDefaultParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AccountSettingDefault) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecs/v1beta1/zz_accountsettingdefault_types.go b/apis/ecs/v1beta1/zz_accountsettingdefault_types.go index 324e52b21b..3b72c90c85 100755 --- a/apis/ecs/v1beta1/zz_accountsettingdefault_types.go +++ b/apis/ecs/v1beta1/zz_accountsettingdefault_types.go @@ -80,13 +80,14 @@ type AccountSettingDefaultStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AccountSettingDefault is the Schema for the AccountSettingDefaults API. Provides an ECS Default account setting. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AccountSettingDefault struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecs/v1beta1/zz_capacityprovider_terraformed.go b/apis/ecs/v1beta1/zz_capacityprovider_terraformed.go new file mode 100755 index 0000000000..7ba48b29ad --- /dev/null +++ b/apis/ecs/v1beta1/zz_capacityprovider_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CapacityProvider +func (mg *CapacityProvider) GetTerraformResourceType() string { + return "aws_ecs_capacity_provider" +} + +// GetConnectionDetailsMapping for this CapacityProvider +func (tr *CapacityProvider) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CapacityProvider +func (tr *CapacityProvider) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CapacityProvider +func (tr *CapacityProvider) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CapacityProvider +func (tr *CapacityProvider) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CapacityProvider +func (tr *CapacityProvider) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CapacityProvider +func (tr *CapacityProvider) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CapacityProvider +func (tr *CapacityProvider) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CapacityProvider +func (tr *CapacityProvider) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CapacityProvider using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CapacityProvider) LateInitialize(attrs []byte) (bool, error) { + params := &CapacityProviderParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CapacityProvider) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecs/v1beta1/zz_capacityprovider_types.go b/apis/ecs/v1beta1/zz_capacityprovider_types.go index 91e4b01580..7f3e9f51dc 100755 --- a/apis/ecs/v1beta1/zz_capacityprovider_types.go +++ b/apis/ecs/v1beta1/zz_capacityprovider_types.go @@ -206,13 +206,14 @@ type CapacityProviderStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CapacityProvider is the Schema for the CapacityProviders API. Provides an ECS cluster capacity provider. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CapacityProvider struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecs/v1beta1/zz_cluster_terraformed.go b/apis/ecs/v1beta1/zz_cluster_terraformed.go new file mode 100755 index 0000000000..fc2495df58 --- /dev/null +++ b/apis/ecs/v1beta1/zz_cluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cluster +func (mg *Cluster) GetTerraformResourceType() string { + return "aws_ecs_cluster" +} + +// GetConnectionDetailsMapping for this Cluster +func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Cluster +func (tr *Cluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cluster +func (tr *Cluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cluster +func (tr *Cluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cluster +func (tr *Cluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cluster +func (tr *Cluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecs/v1beta1/zz_cluster_types.go b/apis/ecs/v1beta1/zz_cluster_types.go index 02f431bcf6..038c0ed02a 100755 --- a/apis/ecs/v1beta1/zz_cluster_types.go +++ b/apis/ecs/v1beta1/zz_cluster_types.go @@ -326,13 +326,14 @@ type ClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cluster is the Schema for the Clusters API. Provides an ECS cluster. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecs/v1beta1/zz_clustercapacityproviders_terraformed.go b/apis/ecs/v1beta1/zz_clustercapacityproviders_terraformed.go new file mode 100755 index 0000000000..0526ff47cd --- /dev/null +++ b/apis/ecs/v1beta1/zz_clustercapacityproviders_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterCapacityProviders +func (mg *ClusterCapacityProviders) GetTerraformResourceType() string { + return "aws_ecs_cluster_capacity_providers" +} + +// GetConnectionDetailsMapping for this ClusterCapacityProviders +func (tr *ClusterCapacityProviders) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterCapacityProviders +func (tr *ClusterCapacityProviders) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterCapacityProviders +func (tr *ClusterCapacityProviders) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterCapacityProviders +func (tr *ClusterCapacityProviders) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterCapacityProviders +func (tr *ClusterCapacityProviders) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterCapacityProviders +func (tr *ClusterCapacityProviders) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterCapacityProviders +func (tr *ClusterCapacityProviders) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterCapacityProviders +func (tr *ClusterCapacityProviders) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterCapacityProviders using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterCapacityProviders) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterCapacityProvidersParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterCapacityProviders) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecs/v1beta1/zz_clustercapacityproviders_types.go b/apis/ecs/v1beta1/zz_clustercapacityproviders_types.go index 9ec389a02a..47b7fdd350 100755 --- a/apis/ecs/v1beta1/zz_clustercapacityproviders_types.go +++ b/apis/ecs/v1beta1/zz_clustercapacityproviders_types.go @@ -148,13 +148,14 @@ type ClusterCapacityProvidersStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterCapacityProviders is the Schema for the ClusterCapacityProviderss API. Provides an ECS cluster capacity providers resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterCapacityProviders struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecs/v1beta1/zz_generated.conversion_hubs.go b/apis/ecs/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..f2efb3ff8e --- /dev/null +++ b/apis/ecs/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AccountSettingDefault) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CapacityProvider) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Cluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterCapacityProviders) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Service) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TaskDefinition) Hub() {} diff --git a/apis/ecs/v1beta1/zz_generated_terraformed.go b/apis/ecs/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 3773c0a2ac..0000000000 --- a/apis/ecs/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,703 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AccountSettingDefault -func (mg *AccountSettingDefault) GetTerraformResourceType() string { - return "aws_ecs_account_setting_default" -} - -// GetConnectionDetailsMapping for this AccountSettingDefault -func (tr *AccountSettingDefault) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AccountSettingDefault -func (tr *AccountSettingDefault) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AccountSettingDefault -func (tr *AccountSettingDefault) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AccountSettingDefault -func (tr *AccountSettingDefault) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AccountSettingDefault -func (tr *AccountSettingDefault) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AccountSettingDefault -func (tr *AccountSettingDefault) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AccountSettingDefault -func (tr *AccountSettingDefault) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AccountSettingDefault -func (tr *AccountSettingDefault) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AccountSettingDefault using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AccountSettingDefault) LateInitialize(attrs []byte) (bool, error) { - params := &AccountSettingDefaultParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AccountSettingDefault) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CapacityProvider -func (mg *CapacityProvider) GetTerraformResourceType() string { - return "aws_ecs_capacity_provider" -} - -// GetConnectionDetailsMapping for this CapacityProvider -func (tr *CapacityProvider) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CapacityProvider -func (tr *CapacityProvider) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CapacityProvider -func (tr *CapacityProvider) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CapacityProvider -func (tr *CapacityProvider) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CapacityProvider -func (tr *CapacityProvider) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CapacityProvider -func (tr *CapacityProvider) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CapacityProvider -func (tr *CapacityProvider) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CapacityProvider -func (tr *CapacityProvider) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CapacityProvider using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CapacityProvider) LateInitialize(attrs []byte) (bool, error) { - params := &CapacityProviderParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CapacityProvider) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Cluster -func (mg *Cluster) GetTerraformResourceType() string { - return "aws_ecs_cluster" -} - -// GetConnectionDetailsMapping for this Cluster -func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Cluster -func (tr *Cluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cluster -func (tr *Cluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cluster -func (tr *Cluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cluster -func (tr *Cluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cluster -func (tr *Cluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterCapacityProviders -func (mg *ClusterCapacityProviders) GetTerraformResourceType() string { - return "aws_ecs_cluster_capacity_providers" -} - -// GetConnectionDetailsMapping for this ClusterCapacityProviders -func (tr *ClusterCapacityProviders) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterCapacityProviders -func (tr *ClusterCapacityProviders) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterCapacityProviders -func (tr *ClusterCapacityProviders) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterCapacityProviders -func (tr *ClusterCapacityProviders) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterCapacityProviders -func (tr *ClusterCapacityProviders) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterCapacityProviders -func (tr *ClusterCapacityProviders) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterCapacityProviders -func (tr *ClusterCapacityProviders) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterCapacityProviders -func (tr *ClusterCapacityProviders) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterCapacityProviders using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterCapacityProviders) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterCapacityProvidersParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterCapacityProviders) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Service -func (mg *Service) GetTerraformResourceType() string { - return "aws_ecs_service" -} - -// GetConnectionDetailsMapping for this Service -func (tr *Service) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Service -func (tr *Service) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Service -func (tr *Service) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Service -func (tr *Service) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Service -func (tr *Service) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Service -func (tr *Service) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Service -func (tr *Service) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Service -func (tr *Service) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Service using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Service) LateInitialize(attrs []byte) (bool, error) { - params := &ServiceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Service) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TaskDefinition -func (mg *TaskDefinition) GetTerraformResourceType() string { - return "aws_ecs_task_definition" -} - -// GetConnectionDetailsMapping for this TaskDefinition -func (tr *TaskDefinition) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TaskDefinition -func (tr *TaskDefinition) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TaskDefinition -func (tr *TaskDefinition) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TaskDefinition -func (tr *TaskDefinition) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TaskDefinition -func (tr *TaskDefinition) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TaskDefinition -func (tr *TaskDefinition) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TaskDefinition -func (tr *TaskDefinition) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TaskDefinition -func (tr *TaskDefinition) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TaskDefinition using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TaskDefinition) LateInitialize(attrs []byte) (bool, error) { - params := &TaskDefinitionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TaskDefinition) GetTerraformSchemaVersion() int { - return 1 -} diff --git a/apis/ecs/v1beta1/zz_service_terraformed.go b/apis/ecs/v1beta1/zz_service_terraformed.go new file mode 100755 index 0000000000..38b59e48e8 --- /dev/null +++ b/apis/ecs/v1beta1/zz_service_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Service +func (mg *Service) GetTerraformResourceType() string { + return "aws_ecs_service" +} + +// GetConnectionDetailsMapping for this Service +func (tr *Service) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Service +func (tr *Service) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Service +func (tr *Service) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Service +func (tr *Service) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Service +func (tr *Service) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Service +func (tr *Service) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Service +func (tr *Service) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Service +func (tr *Service) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Service using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Service) LateInitialize(attrs []byte) (bool, error) { + params := &ServiceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Service) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ecs/v1beta1/zz_service_types.go b/apis/ecs/v1beta1/zz_service_types.go index 27b2897317..314a19e175 100755 --- a/apis/ecs/v1beta1/zz_service_types.go +++ b/apis/ecs/v1beta1/zz_service_types.go @@ -993,13 +993,14 @@ type ServiceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Service is the Schema for the Services API. Provides an ECS service. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Service struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ecs/v1beta1/zz_taskdefinition_terraformed.go b/apis/ecs/v1beta1/zz_taskdefinition_terraformed.go new file mode 100755 index 0000000000..854c8be0b6 --- /dev/null +++ b/apis/ecs/v1beta1/zz_taskdefinition_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TaskDefinition +func (mg *TaskDefinition) GetTerraformResourceType() string { + return "aws_ecs_task_definition" +} + +// GetConnectionDetailsMapping for this TaskDefinition +func (tr *TaskDefinition) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TaskDefinition +func (tr *TaskDefinition) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TaskDefinition +func (tr *TaskDefinition) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TaskDefinition +func (tr *TaskDefinition) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TaskDefinition +func (tr *TaskDefinition) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TaskDefinition +func (tr *TaskDefinition) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TaskDefinition +func (tr *TaskDefinition) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TaskDefinition +func (tr *TaskDefinition) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TaskDefinition using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TaskDefinition) LateInitialize(attrs []byte) (bool, error) { + params := &TaskDefinitionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TaskDefinition) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ecs/v1beta1/zz_taskdefinition_types.go b/apis/ecs/v1beta1/zz_taskdefinition_types.go index 462e3e6b26..1df82f47c3 100755 --- a/apis/ecs/v1beta1/zz_taskdefinition_types.go +++ b/apis/ecs/v1beta1/zz_taskdefinition_types.go @@ -707,13 +707,14 @@ type TaskDefinitionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TaskDefinition is the Schema for the TaskDefinitions API. Manages a revision of an ECS task definition. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TaskDefinition struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/efs/v1beta1/zz_accesspoint_terraformed.go b/apis/efs/v1beta1/zz_accesspoint_terraformed.go new file mode 100755 index 0000000000..b3493af72d --- /dev/null +++ b/apis/efs/v1beta1/zz_accesspoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AccessPoint +func (mg *AccessPoint) GetTerraformResourceType() string { + return "aws_efs_access_point" +} + +// GetConnectionDetailsMapping for this AccessPoint +func (tr *AccessPoint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AccessPoint +func (tr *AccessPoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AccessPoint +func (tr *AccessPoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AccessPoint +func (tr *AccessPoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AccessPoint +func (tr *AccessPoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AccessPoint +func (tr *AccessPoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AccessPoint +func (tr *AccessPoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AccessPoint +func (tr *AccessPoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AccessPoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AccessPoint) LateInitialize(attrs []byte) (bool, error) { + params := &AccessPointParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AccessPoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/efs/v1beta1/zz_accesspoint_types.go b/apis/efs/v1beta1/zz_accesspoint_types.go index 3d2de82a70..83ab5bbdec 100755 --- a/apis/efs/v1beta1/zz_accesspoint_types.go +++ b/apis/efs/v1beta1/zz_accesspoint_types.go @@ -242,13 +242,14 @@ type AccessPointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AccessPoint is the Schema for the AccessPoints API. Provides an Elastic File System (EFS) access point. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AccessPoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/efs/v1beta1/zz_backuppolicy_terraformed.go b/apis/efs/v1beta1/zz_backuppolicy_terraformed.go new file mode 100755 index 0000000000..84527b2640 --- /dev/null +++ b/apis/efs/v1beta1/zz_backuppolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BackupPolicy +func (mg *BackupPolicy) GetTerraformResourceType() string { + return "aws_efs_backup_policy" +} + +// GetConnectionDetailsMapping for this BackupPolicy +func (tr *BackupPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BackupPolicy +func (tr *BackupPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BackupPolicy +func (tr *BackupPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BackupPolicy +func (tr *BackupPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BackupPolicy +func (tr *BackupPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BackupPolicy +func (tr *BackupPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BackupPolicy +func (tr *BackupPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BackupPolicy +func (tr *BackupPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BackupPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BackupPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &BackupPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BackupPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/efs/v1beta1/zz_backuppolicy_types.go b/apis/efs/v1beta1/zz_backuppolicy_types.go index b35e2c23ec..7f3740e24d 100755 --- a/apis/efs/v1beta1/zz_backuppolicy_types.go +++ b/apis/efs/v1beta1/zz_backuppolicy_types.go @@ -115,13 +115,14 @@ type BackupPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BackupPolicy is the Schema for the BackupPolicys API. Provides an Elastic File System (EFS) Backup Policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BackupPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/efs/v1beta1/zz_filesystem_terraformed.go b/apis/efs/v1beta1/zz_filesystem_terraformed.go new file mode 100755 index 0000000000..d0f245d6af --- /dev/null +++ b/apis/efs/v1beta1/zz_filesystem_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FileSystem +func (mg *FileSystem) GetTerraformResourceType() string { + return "aws_efs_file_system" +} + +// GetConnectionDetailsMapping for this FileSystem +func (tr *FileSystem) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FileSystem +func (tr *FileSystem) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FileSystem +func (tr *FileSystem) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FileSystem +func (tr *FileSystem) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FileSystem +func (tr *FileSystem) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FileSystem +func (tr *FileSystem) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FileSystem +func (tr *FileSystem) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FileSystem +func (tr *FileSystem) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FileSystem using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FileSystem) LateInitialize(attrs []byte) (bool, error) { + params := &FileSystemParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FileSystem) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/efs/v1beta1/zz_filesystem_types.go b/apis/efs/v1beta1/zz_filesystem_types.go index 341bffb702..df48b45a0d 100755 --- a/apis/efs/v1beta1/zz_filesystem_types.go +++ b/apis/efs/v1beta1/zz_filesystem_types.go @@ -249,13 +249,14 @@ type FileSystemStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FileSystem is the Schema for the FileSystems API. Provides an Elastic File System (EFS) File System resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FileSystem struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/efs/v1beta1/zz_filesystempolicy_terraformed.go b/apis/efs/v1beta1/zz_filesystempolicy_terraformed.go new file mode 100755 index 0000000000..6603373716 --- /dev/null +++ b/apis/efs/v1beta1/zz_filesystempolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FileSystemPolicy +func (mg *FileSystemPolicy) GetTerraformResourceType() string { + return "aws_efs_file_system_policy" +} + +// GetConnectionDetailsMapping for this FileSystemPolicy +func (tr *FileSystemPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FileSystemPolicy +func (tr *FileSystemPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FileSystemPolicy +func (tr *FileSystemPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FileSystemPolicy +func (tr *FileSystemPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FileSystemPolicy +func (tr *FileSystemPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FileSystemPolicy +func (tr *FileSystemPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FileSystemPolicy +func (tr *FileSystemPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FileSystemPolicy +func (tr *FileSystemPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FileSystemPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FileSystemPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &FileSystemPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FileSystemPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/efs/v1beta1/zz_filesystempolicy_types.go b/apis/efs/v1beta1/zz_filesystempolicy_types.go index 5f6beb29de..3c579a33f2 100755 --- a/apis/efs/v1beta1/zz_filesystempolicy_types.go +++ b/apis/efs/v1beta1/zz_filesystempolicy_types.go @@ -106,13 +106,14 @@ type FileSystemPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FileSystemPolicy is the Schema for the FileSystemPolicys API. Provides an Elastic File System (EFS) File System Policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FileSystemPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/efs/v1beta1/zz_generated.conversion_hubs.go b/apis/efs/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..5cbdd91332 --- /dev/null +++ b/apis/efs/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AccessPoint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BackupPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FileSystem) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FileSystemPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MountTarget) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReplicationConfiguration) Hub() {} diff --git a/apis/efs/v1beta1/zz_generated_terraformed.go b/apis/efs/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 1a89160fec..0000000000 --- a/apis/efs/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,703 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AccessPoint -func (mg *AccessPoint) GetTerraformResourceType() string { - return "aws_efs_access_point" -} - -// GetConnectionDetailsMapping for this AccessPoint -func (tr *AccessPoint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AccessPoint -func (tr *AccessPoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AccessPoint -func (tr *AccessPoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AccessPoint -func (tr *AccessPoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AccessPoint -func (tr *AccessPoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AccessPoint -func (tr *AccessPoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AccessPoint -func (tr *AccessPoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AccessPoint -func (tr *AccessPoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AccessPoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AccessPoint) LateInitialize(attrs []byte) (bool, error) { - params := &AccessPointParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AccessPoint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BackupPolicy -func (mg *BackupPolicy) GetTerraformResourceType() string { - return "aws_efs_backup_policy" -} - -// GetConnectionDetailsMapping for this BackupPolicy -func (tr *BackupPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BackupPolicy -func (tr *BackupPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BackupPolicy -func (tr *BackupPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BackupPolicy -func (tr *BackupPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BackupPolicy -func (tr *BackupPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BackupPolicy -func (tr *BackupPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BackupPolicy -func (tr *BackupPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BackupPolicy -func (tr *BackupPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BackupPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BackupPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &BackupPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BackupPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FileSystem -func (mg *FileSystem) GetTerraformResourceType() string { - return "aws_efs_file_system" -} - -// GetConnectionDetailsMapping for this FileSystem -func (tr *FileSystem) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FileSystem -func (tr *FileSystem) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FileSystem -func (tr *FileSystem) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FileSystem -func (tr *FileSystem) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FileSystem -func (tr *FileSystem) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FileSystem -func (tr *FileSystem) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FileSystem -func (tr *FileSystem) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FileSystem -func (tr *FileSystem) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FileSystem using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FileSystem) LateInitialize(attrs []byte) (bool, error) { - params := &FileSystemParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FileSystem) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FileSystemPolicy -func (mg *FileSystemPolicy) GetTerraformResourceType() string { - return "aws_efs_file_system_policy" -} - -// GetConnectionDetailsMapping for this FileSystemPolicy -func (tr *FileSystemPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FileSystemPolicy -func (tr *FileSystemPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FileSystemPolicy -func (tr *FileSystemPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FileSystemPolicy -func (tr *FileSystemPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FileSystemPolicy -func (tr *FileSystemPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FileSystemPolicy -func (tr *FileSystemPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FileSystemPolicy -func (tr *FileSystemPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FileSystemPolicy -func (tr *FileSystemPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FileSystemPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FileSystemPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &FileSystemPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FileSystemPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MountTarget -func (mg *MountTarget) GetTerraformResourceType() string { - return "aws_efs_mount_target" -} - -// GetConnectionDetailsMapping for this MountTarget -func (tr *MountTarget) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MountTarget -func (tr *MountTarget) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MountTarget -func (tr *MountTarget) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MountTarget -func (tr *MountTarget) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MountTarget -func (tr *MountTarget) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MountTarget -func (tr *MountTarget) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MountTarget -func (tr *MountTarget) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MountTarget -func (tr *MountTarget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MountTarget using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MountTarget) LateInitialize(attrs []byte) (bool, error) { - params := &MountTargetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MountTarget) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReplicationConfiguration -func (mg *ReplicationConfiguration) GetTerraformResourceType() string { - return "aws_efs_replication_configuration" -} - -// GetConnectionDetailsMapping for this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReplicationConfiguration -func (tr *ReplicationConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReplicationConfiguration -func (tr *ReplicationConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReplicationConfiguration -func (tr *ReplicationConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReplicationConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReplicationConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &ReplicationConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReplicationConfiguration) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/efs/v1beta1/zz_mounttarget_terraformed.go b/apis/efs/v1beta1/zz_mounttarget_terraformed.go new file mode 100755 index 0000000000..d06c22d447 --- /dev/null +++ b/apis/efs/v1beta1/zz_mounttarget_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MountTarget +func (mg *MountTarget) GetTerraformResourceType() string { + return "aws_efs_mount_target" +} + +// GetConnectionDetailsMapping for this MountTarget +func (tr *MountTarget) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MountTarget +func (tr *MountTarget) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MountTarget +func (tr *MountTarget) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MountTarget +func (tr *MountTarget) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MountTarget +func (tr *MountTarget) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MountTarget +func (tr *MountTarget) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MountTarget +func (tr *MountTarget) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MountTarget +func (tr *MountTarget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MountTarget using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MountTarget) LateInitialize(attrs []byte) (bool, error) { + params := &MountTargetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MountTarget) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/efs/v1beta1/zz_mounttarget_types.go b/apis/efs/v1beta1/zz_mounttarget_types.go index 955f9cde29..6ec412443d 100755 --- a/apis/efs/v1beta1/zz_mounttarget_types.go +++ b/apis/efs/v1beta1/zz_mounttarget_types.go @@ -182,13 +182,14 @@ type MountTargetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MountTarget is the Schema for the MountTargets API. Provides an Elastic File System (EFS) mount target. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MountTarget struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/efs/v1beta1/zz_replicationconfiguration_terraformed.go b/apis/efs/v1beta1/zz_replicationconfiguration_terraformed.go new file mode 100755 index 0000000000..63c179e458 --- /dev/null +++ b/apis/efs/v1beta1/zz_replicationconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReplicationConfiguration +func (mg *ReplicationConfiguration) GetTerraformResourceType() string { + return "aws_efs_replication_configuration" +} + +// GetConnectionDetailsMapping for this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReplicationConfiguration +func (tr *ReplicationConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReplicationConfiguration +func (tr *ReplicationConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReplicationConfiguration +func (tr *ReplicationConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReplicationConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReplicationConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &ReplicationConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReplicationConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/efs/v1beta1/zz_replicationconfiguration_types.go b/apis/efs/v1beta1/zz_replicationconfiguration_types.go index d6ec161fb4..bdaeb3f9c2 100755 --- a/apis/efs/v1beta1/zz_replicationconfiguration_types.go +++ b/apis/efs/v1beta1/zz_replicationconfiguration_types.go @@ -152,13 +152,14 @@ type ReplicationConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReplicationConfiguration is the Schema for the ReplicationConfigurations API. Provides an Elastic File System (EFS) Replication Configuration. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReplicationConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/eks/v1beta1/zz_addon_terraformed.go b/apis/eks/v1beta1/zz_addon_terraformed.go new file mode 100755 index 0000000000..2ee19574b8 --- /dev/null +++ b/apis/eks/v1beta1/zz_addon_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Addon +func (mg *Addon) GetTerraformResourceType() string { + return "aws_eks_addon" +} + +// GetConnectionDetailsMapping for this Addon +func (tr *Addon) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Addon +func (tr *Addon) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Addon +func (tr *Addon) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Addon +func (tr *Addon) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Addon +func (tr *Addon) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Addon +func (tr *Addon) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Addon +func (tr *Addon) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Addon +func (tr *Addon) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Addon using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Addon) LateInitialize(attrs []byte) (bool, error) { + params := &AddonParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Addon) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/eks/v1beta1/zz_addon_types.go b/apis/eks/v1beta1/zz_addon_types.go index ba4623eb1f..09071f5ccf 100755 --- a/apis/eks/v1beta1/zz_addon_types.go +++ b/apis/eks/v1beta1/zz_addon_types.go @@ -219,13 +219,14 @@ type AddonStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Addon is the Schema for the Addons API. Manages an EKS add-on // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Addon struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/eks/v1beta1/zz_cluster_terraformed.go b/apis/eks/v1beta1/zz_cluster_terraformed.go new file mode 100755 index 0000000000..e8c15f48c6 --- /dev/null +++ b/apis/eks/v1beta1/zz_cluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cluster +func (mg *Cluster) GetTerraformResourceType() string { + return "aws_eks_cluster" +} + +// GetConnectionDetailsMapping for this Cluster +func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Cluster +func (tr *Cluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cluster +func (tr *Cluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cluster +func (tr *Cluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cluster +func (tr *Cluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cluster +func (tr *Cluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/eks/v1beta1/zz_cluster_types.go b/apis/eks/v1beta1/zz_cluster_types.go index 47deb76739..51af20a5df 100755 --- a/apis/eks/v1beta1/zz_cluster_types.go +++ b/apis/eks/v1beta1/zz_cluster_types.go @@ -512,13 +512,14 @@ type ClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cluster is the Schema for the Clusters API. Manages an EKS Cluster // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/eks/v1beta1/zz_fargateprofile_terraformed.go b/apis/eks/v1beta1/zz_fargateprofile_terraformed.go new file mode 100755 index 0000000000..1ab20b8a95 --- /dev/null +++ b/apis/eks/v1beta1/zz_fargateprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FargateProfile +func (mg *FargateProfile) GetTerraformResourceType() string { + return "aws_eks_fargate_profile" +} + +// GetConnectionDetailsMapping for this FargateProfile +func (tr *FargateProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FargateProfile +func (tr *FargateProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FargateProfile +func (tr *FargateProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FargateProfile +func (tr *FargateProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FargateProfile +func (tr *FargateProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FargateProfile +func (tr *FargateProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FargateProfile +func (tr *FargateProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FargateProfile +func (tr *FargateProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FargateProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FargateProfile) LateInitialize(attrs []byte) (bool, error) { + params := &FargateProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FargateProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/eks/v1beta1/zz_fargateprofile_types.go b/apis/eks/v1beta1/zz_fargateprofile_types.go index da0cca9985..d053c8b7ee 100755 --- a/apis/eks/v1beta1/zz_fargateprofile_types.go +++ b/apis/eks/v1beta1/zz_fargateprofile_types.go @@ -216,13 +216,14 @@ type FargateProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FargateProfile is the Schema for the FargateProfiles API. Manages an EKS Fargate Profile // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FargateProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/eks/v1beta1/zz_generated.conversion_hubs.go b/apis/eks/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..62d0fa189d --- /dev/null +++ b/apis/eks/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Addon) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Cluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FargateProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *IdentityProviderConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NodeGroup) Hub() {} diff --git a/apis/eks/v1beta1/zz_generated_terraformed.go b/apis/eks/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 8dfc025f57..0000000000 --- a/apis/eks/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,590 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Addon -func (mg *Addon) GetTerraformResourceType() string { - return "aws_eks_addon" -} - -// GetConnectionDetailsMapping for this Addon -func (tr *Addon) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Addon -func (tr *Addon) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Addon -func (tr *Addon) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Addon -func (tr *Addon) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Addon -func (tr *Addon) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Addon -func (tr *Addon) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Addon -func (tr *Addon) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Addon -func (tr *Addon) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Addon using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Addon) LateInitialize(attrs []byte) (bool, error) { - params := &AddonParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Addon) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Cluster -func (mg *Cluster) GetTerraformResourceType() string { - return "aws_eks_cluster" -} - -// GetConnectionDetailsMapping for this Cluster -func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Cluster -func (tr *Cluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cluster -func (tr *Cluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cluster -func (tr *Cluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cluster -func (tr *Cluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cluster -func (tr *Cluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FargateProfile -func (mg *FargateProfile) GetTerraformResourceType() string { - return "aws_eks_fargate_profile" -} - -// GetConnectionDetailsMapping for this FargateProfile -func (tr *FargateProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FargateProfile -func (tr *FargateProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FargateProfile -func (tr *FargateProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FargateProfile -func (tr *FargateProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FargateProfile -func (tr *FargateProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FargateProfile -func (tr *FargateProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FargateProfile -func (tr *FargateProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FargateProfile -func (tr *FargateProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FargateProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FargateProfile) LateInitialize(attrs []byte) (bool, error) { - params := &FargateProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FargateProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this IdentityProviderConfig -func (mg *IdentityProviderConfig) GetTerraformResourceType() string { - return "aws_eks_identity_provider_config" -} - -// GetConnectionDetailsMapping for this IdentityProviderConfig -func (tr *IdentityProviderConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this IdentityProviderConfig -func (tr *IdentityProviderConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this IdentityProviderConfig -func (tr *IdentityProviderConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this IdentityProviderConfig -func (tr *IdentityProviderConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this IdentityProviderConfig -func (tr *IdentityProviderConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this IdentityProviderConfig -func (tr *IdentityProviderConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this IdentityProviderConfig -func (tr *IdentityProviderConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this IdentityProviderConfig -func (tr *IdentityProviderConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this IdentityProviderConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *IdentityProviderConfig) LateInitialize(attrs []byte) (bool, error) { - params := &IdentityProviderConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *IdentityProviderConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NodeGroup -func (mg *NodeGroup) GetTerraformResourceType() string { - return "aws_eks_node_group" -} - -// GetConnectionDetailsMapping for this NodeGroup -func (tr *NodeGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NodeGroup -func (tr *NodeGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NodeGroup -func (tr *NodeGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NodeGroup -func (tr *NodeGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NodeGroup -func (tr *NodeGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NodeGroup -func (tr *NodeGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NodeGroup -func (tr *NodeGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NodeGroup -func (tr *NodeGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NodeGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NodeGroup) LateInitialize(attrs []byte) (bool, error) { - params := &NodeGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("ReleaseVersion")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NodeGroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/eks/v1beta1/zz_identityproviderconfig_terraformed.go b/apis/eks/v1beta1/zz_identityproviderconfig_terraformed.go new file mode 100755 index 0000000000..77166eecfe --- /dev/null +++ b/apis/eks/v1beta1/zz_identityproviderconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this IdentityProviderConfig +func (mg *IdentityProviderConfig) GetTerraformResourceType() string { + return "aws_eks_identity_provider_config" +} + +// GetConnectionDetailsMapping for this IdentityProviderConfig +func (tr *IdentityProviderConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this IdentityProviderConfig +func (tr *IdentityProviderConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this IdentityProviderConfig +func (tr *IdentityProviderConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this IdentityProviderConfig +func (tr *IdentityProviderConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this IdentityProviderConfig +func (tr *IdentityProviderConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this IdentityProviderConfig +func (tr *IdentityProviderConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this IdentityProviderConfig +func (tr *IdentityProviderConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this IdentityProviderConfig +func (tr *IdentityProviderConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this IdentityProviderConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *IdentityProviderConfig) LateInitialize(attrs []byte) (bool, error) { + params := &IdentityProviderConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *IdentityProviderConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/eks/v1beta1/zz_identityproviderconfig_types.go b/apis/eks/v1beta1/zz_identityproviderconfig_types.go index e7526969b7..dcdd0cc0c9 100755 --- a/apis/eks/v1beta1/zz_identityproviderconfig_types.go +++ b/apis/eks/v1beta1/zz_identityproviderconfig_types.go @@ -201,13 +201,14 @@ type IdentityProviderConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IdentityProviderConfig is the Schema for the IdentityProviderConfigs API. Manages an EKS Identity Provider Configuration. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type IdentityProviderConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/eks/v1beta1/zz_nodegroup_terraformed.go b/apis/eks/v1beta1/zz_nodegroup_terraformed.go new file mode 100755 index 0000000000..502e1e75ed --- /dev/null +++ b/apis/eks/v1beta1/zz_nodegroup_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NodeGroup +func (mg *NodeGroup) GetTerraformResourceType() string { + return "aws_eks_node_group" +} + +// GetConnectionDetailsMapping for this NodeGroup +func (tr *NodeGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NodeGroup +func (tr *NodeGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NodeGroup +func (tr *NodeGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NodeGroup +func (tr *NodeGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NodeGroup +func (tr *NodeGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NodeGroup +func (tr *NodeGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NodeGroup +func (tr *NodeGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NodeGroup +func (tr *NodeGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NodeGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NodeGroup) LateInitialize(attrs []byte) (bool, error) { + params := &NodeGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("ReleaseVersion")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NodeGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/eks/v1beta1/zz_nodegroup_types.go b/apis/eks/v1beta1/zz_nodegroup_types.go index ca7f6f108e..b612a6ca44 100755 --- a/apis/eks/v1beta1/zz_nodegroup_types.go +++ b/apis/eks/v1beta1/zz_nodegroup_types.go @@ -543,13 +543,14 @@ type NodeGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NodeGroup is the Schema for the NodeGroups API. Manages an EKS Node Group // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NodeGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticache/v1beta1/zz_cluster_terraformed.go b/apis/elasticache/v1beta1/zz_cluster_terraformed.go new file mode 100755 index 0000000000..468ee23d5c --- /dev/null +++ b/apis/elasticache/v1beta1/zz_cluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cluster +func (mg *Cluster) GetTerraformResourceType() string { + return "aws_elasticache_cluster" +} + +// GetConnectionDetailsMapping for this Cluster +func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Cluster +func (tr *Cluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cluster +func (tr *Cluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cluster +func (tr *Cluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cluster +func (tr *Cluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cluster +func (tr *Cluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticache/v1beta1/zz_cluster_types.go b/apis/elasticache/v1beta1/zz_cluster_types.go index 81a45dc6c1..4f7cb85c0e 100755 --- a/apis/elasticache/v1beta1/zz_cluster_types.go +++ b/apis/elasticache/v1beta1/zz_cluster_types.go @@ -540,13 +540,14 @@ type ClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cluster is the Schema for the Clusters API. Provides an ElastiCache Cluster resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticache/v1beta1/zz_generated.conversion_hubs.go b/apis/elasticache/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..d2a8c35f29 --- /dev/null +++ b/apis/elasticache/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Cluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ParameterGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReplicationGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SubnetGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *User) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserGroup) Hub() {} diff --git a/apis/elasticache/v1beta1/zz_generated_terraformed.go b/apis/elasticache/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index e06caee866..0000000000 --- a/apis/elasticache/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,709 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Cluster -func (mg *Cluster) GetTerraformResourceType() string { - return "aws_elasticache_cluster" -} - -// GetConnectionDetailsMapping for this Cluster -func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Cluster -func (tr *Cluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cluster -func (tr *Cluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cluster -func (tr *Cluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cluster -func (tr *Cluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cluster -func (tr *Cluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ParameterGroup -func (mg *ParameterGroup) GetTerraformResourceType() string { - return "aws_elasticache_parameter_group" -} - -// GetConnectionDetailsMapping for this ParameterGroup -func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ParameterGroup -func (tr *ParameterGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ParameterGroup -func (tr *ParameterGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ParameterGroup -func (tr *ParameterGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ParameterGroup -func (tr *ParameterGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ParameterGroup -func (tr *ParameterGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ParameterGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ParameterGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ParameterGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReplicationGroup -func (mg *ReplicationGroup) GetTerraformResourceType() string { - return "aws_elasticache_replication_group" -} - -// GetConnectionDetailsMapping for this ReplicationGroup -func (tr *ReplicationGroup) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"auth_token": "spec.forProvider.authTokenSecretRef"} -} - -// GetObservation of this ReplicationGroup -func (tr *ReplicationGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReplicationGroup -func (tr *ReplicationGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReplicationGroup -func (tr *ReplicationGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReplicationGroup -func (tr *ReplicationGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReplicationGroup -func (tr *ReplicationGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReplicationGroup -func (tr *ReplicationGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReplicationGroup -func (tr *ReplicationGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReplicationGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReplicationGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ReplicationGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("ClusterMode")) - opts = append(opts, resource.WithNameFilter("Description")) - opts = append(opts, resource.WithNameFilter("NumCacheClusters")) - opts = append(opts, resource.WithNameFilter("NumNodeGroups")) - opts = append(opts, resource.WithNameFilter("NumberCacheClusters")) - opts = append(opts, resource.WithNameFilter("ReplicationGroupDescription")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReplicationGroup) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this SubnetGroup -func (mg *SubnetGroup) GetTerraformResourceType() string { - return "aws_elasticache_subnet_group" -} - -// GetConnectionDetailsMapping for this SubnetGroup -func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SubnetGroup -func (tr *SubnetGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SubnetGroup -func (tr *SubnetGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SubnetGroup -func (tr *SubnetGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SubnetGroup -func (tr *SubnetGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SubnetGroup -func (tr *SubnetGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SubnetGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { - params := &SubnetGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SubnetGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this User -func (mg *User) GetTerraformResourceType() string { - return "aws_elasticache_user" -} - -// GetConnectionDetailsMapping for this User -func (tr *User) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"authentication_mode[*].passwords[*]": "spec.forProvider.authenticationMode[*].passwords[*]SecretRef", "passwords[*]": "spec.forProvider.passwords[*]SecretRef"} -} - -// GetObservation of this User -func (tr *User) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this User -func (tr *User) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this User -func (tr *User) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this User -func (tr *User) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this User -func (tr *User) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this User -func (tr *User) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this User -func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this User using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *User) LateInitialize(attrs []byte) (bool, error) { - params := &UserParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *User) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserGroup -func (mg *UserGroup) GetTerraformResourceType() string { - return "aws_elasticache_user_group" -} - -// GetConnectionDetailsMapping for this UserGroup -func (tr *UserGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserGroup -func (tr *UserGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserGroup -func (tr *UserGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserGroup -func (tr *UserGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserGroup -func (tr *UserGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserGroup -func (tr *UserGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserGroup -func (tr *UserGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserGroup -func (tr *UserGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserGroup) LateInitialize(attrs []byte) (bool, error) { - params := &UserGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserGroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/elasticache/v1beta1/zz_parametergroup_terraformed.go b/apis/elasticache/v1beta1/zz_parametergroup_terraformed.go new file mode 100755 index 0000000000..7fab890207 --- /dev/null +++ b/apis/elasticache/v1beta1/zz_parametergroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ParameterGroup +func (mg *ParameterGroup) GetTerraformResourceType() string { + return "aws_elasticache_parameter_group" +} + +// GetConnectionDetailsMapping for this ParameterGroup +func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ParameterGroup +func (tr *ParameterGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ParameterGroup +func (tr *ParameterGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ParameterGroup +func (tr *ParameterGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ParameterGroup +func (tr *ParameterGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ParameterGroup +func (tr *ParameterGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ParameterGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ParameterGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ParameterGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticache/v1beta1/zz_parametergroup_types.go b/apis/elasticache/v1beta1/zz_parametergroup_types.go index c1dce0259a..d4b46bb8df 100755 --- a/apis/elasticache/v1beta1/zz_parametergroup_types.go +++ b/apis/elasticache/v1beta1/zz_parametergroup_types.go @@ -147,13 +147,14 @@ type ParameterGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ParameterGroup is the Schema for the ParameterGroups API. Provides an ElastiCache parameter group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ParameterGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticache/v1beta1/zz_replicationgroup_terraformed.go b/apis/elasticache/v1beta1/zz_replicationgroup_terraformed.go new file mode 100755 index 0000000000..5a3a37a1ba --- /dev/null +++ b/apis/elasticache/v1beta1/zz_replicationgroup_terraformed.go @@ -0,0 +1,139 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReplicationGroup +func (mg *ReplicationGroup) GetTerraformResourceType() string { + return "aws_elasticache_replication_group" +} + +// GetConnectionDetailsMapping for this ReplicationGroup +func (tr *ReplicationGroup) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"auth_token": "spec.forProvider.authTokenSecretRef"} +} + +// GetObservation of this ReplicationGroup +func (tr *ReplicationGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReplicationGroup +func (tr *ReplicationGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReplicationGroup +func (tr *ReplicationGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReplicationGroup +func (tr *ReplicationGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReplicationGroup +func (tr *ReplicationGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReplicationGroup +func (tr *ReplicationGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReplicationGroup +func (tr *ReplicationGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReplicationGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReplicationGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ReplicationGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("ClusterMode")) + opts = append(opts, resource.WithNameFilter("Description")) + opts = append(opts, resource.WithNameFilter("NumCacheClusters")) + opts = append(opts, resource.WithNameFilter("NumNodeGroups")) + opts = append(opts, resource.WithNameFilter("NumberCacheClusters")) + opts = append(opts, resource.WithNameFilter("ReplicationGroupDescription")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReplicationGroup) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/elasticache/v1beta1/zz_replicationgroup_types.go b/apis/elasticache/v1beta1/zz_replicationgroup_types.go index c9ac9e4afc..f4bb278195 100755 --- a/apis/elasticache/v1beta1/zz_replicationgroup_types.go +++ b/apis/elasticache/v1beta1/zz_replicationgroup_types.go @@ -638,13 +638,14 @@ type ReplicationGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReplicationGroup is the Schema for the ReplicationGroups API. Provides an ElastiCache Replication Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReplicationGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticache/v1beta1/zz_subnetgroup_terraformed.go b/apis/elasticache/v1beta1/zz_subnetgroup_terraformed.go new file mode 100755 index 0000000000..647833723c --- /dev/null +++ b/apis/elasticache/v1beta1/zz_subnetgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SubnetGroup +func (mg *SubnetGroup) GetTerraformResourceType() string { + return "aws_elasticache_subnet_group" +} + +// GetConnectionDetailsMapping for this SubnetGroup +func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SubnetGroup +func (tr *SubnetGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SubnetGroup +func (tr *SubnetGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SubnetGroup +func (tr *SubnetGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SubnetGroup +func (tr *SubnetGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SubnetGroup +func (tr *SubnetGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SubnetGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { + params := &SubnetGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SubnetGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticache/v1beta1/zz_subnetgroup_types.go b/apis/elasticache/v1beta1/zz_subnetgroup_types.go index bed1e2c6ab..b461b9dfe0 100755 --- a/apis/elasticache/v1beta1/zz_subnetgroup_types.go +++ b/apis/elasticache/v1beta1/zz_subnetgroup_types.go @@ -120,13 +120,14 @@ type SubnetGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SubnetGroup is the Schema for the SubnetGroups API. Provides an ElastiCache Subnet Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SubnetGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticache/v1beta1/zz_user_terraformed.go b/apis/elasticache/v1beta1/zz_user_terraformed.go new file mode 100755 index 0000000000..5e64c83206 --- /dev/null +++ b/apis/elasticache/v1beta1/zz_user_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this User +func (mg *User) GetTerraformResourceType() string { + return "aws_elasticache_user" +} + +// GetConnectionDetailsMapping for this User +func (tr *User) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"authentication_mode[*].passwords[*]": "spec.forProvider.authenticationMode[*].passwords[*]SecretRef", "passwords[*]": "spec.forProvider.passwords[*]SecretRef"} +} + +// GetObservation of this User +func (tr *User) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this User +func (tr *User) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this User +func (tr *User) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this User +func (tr *User) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this User +func (tr *User) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this User +func (tr *User) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this User +func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this User using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *User) LateInitialize(attrs []byte) (bool, error) { + params := &UserParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *User) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticache/v1beta1/zz_user_types.go b/apis/elasticache/v1beta1/zz_user_types.go index ad44fc87c5..9b33da9409 100755 --- a/apis/elasticache/v1beta1/zz_user_types.go +++ b/apis/elasticache/v1beta1/zz_user_types.go @@ -154,13 +154,14 @@ type UserStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // User is the Schema for the Users API. Provides an ElastiCache user. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type User struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticache/v1beta1/zz_usergroup_terraformed.go b/apis/elasticache/v1beta1/zz_usergroup_terraformed.go new file mode 100755 index 0000000000..b2c0a59845 --- /dev/null +++ b/apis/elasticache/v1beta1/zz_usergroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserGroup +func (mg *UserGroup) GetTerraformResourceType() string { + return "aws_elasticache_user_group" +} + +// GetConnectionDetailsMapping for this UserGroup +func (tr *UserGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserGroup +func (tr *UserGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserGroup +func (tr *UserGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserGroup +func (tr *UserGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserGroup +func (tr *UserGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserGroup +func (tr *UserGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserGroup +func (tr *UserGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserGroup +func (tr *UserGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserGroup) LateInitialize(attrs []byte) (bool, error) { + params := &UserGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticache/v1beta1/zz_usergroup_types.go b/apis/elasticache/v1beta1/zz_usergroup_types.go index 186e2c50da..c8ca77f912 100755 --- a/apis/elasticache/v1beta1/zz_usergroup_types.go +++ b/apis/elasticache/v1beta1/zz_usergroup_types.go @@ -123,13 +123,14 @@ type UserGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserGroup is the Schema for the UserGroups API. Provides an ElastiCache user group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticbeanstalk/v1beta1/zz_application_terraformed.go b/apis/elasticbeanstalk/v1beta1/zz_application_terraformed.go new file mode 100755 index 0000000000..d029e715bc --- /dev/null +++ b/apis/elasticbeanstalk/v1beta1/zz_application_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Application +func (mg *Application) GetTerraformResourceType() string { + return "aws_elastic_beanstalk_application" +} + +// GetConnectionDetailsMapping for this Application +func (tr *Application) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Application +func (tr *Application) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Application +func (tr *Application) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Application +func (tr *Application) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Application +func (tr *Application) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Application +func (tr *Application) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Application +func (tr *Application) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Application +func (tr *Application) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Application using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Application) LateInitialize(attrs []byte) (bool, error) { + params := &ApplicationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Application) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticbeanstalk/v1beta1/zz_application_types.go b/apis/elasticbeanstalk/v1beta1/zz_application_types.go index 3bc00b40f8..0eee4c698d 100755 --- a/apis/elasticbeanstalk/v1beta1/zz_application_types.go +++ b/apis/elasticbeanstalk/v1beta1/zz_application_types.go @@ -161,13 +161,14 @@ type ApplicationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Application is the Schema for the Applications API. Provides an Elastic Beanstalk Application Resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Application struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticbeanstalk/v1beta1/zz_applicationversion_terraformed.go b/apis/elasticbeanstalk/v1beta1/zz_applicationversion_terraformed.go new file mode 100755 index 0000000000..1c5a3a8899 --- /dev/null +++ b/apis/elasticbeanstalk/v1beta1/zz_applicationversion_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ApplicationVersion +func (mg *ApplicationVersion) GetTerraformResourceType() string { + return "aws_elastic_beanstalk_application_version" +} + +// GetConnectionDetailsMapping for this ApplicationVersion +func (tr *ApplicationVersion) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ApplicationVersion +func (tr *ApplicationVersion) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ApplicationVersion +func (tr *ApplicationVersion) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ApplicationVersion +func (tr *ApplicationVersion) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ApplicationVersion +func (tr *ApplicationVersion) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ApplicationVersion +func (tr *ApplicationVersion) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ApplicationVersion +func (tr *ApplicationVersion) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ApplicationVersion +func (tr *ApplicationVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ApplicationVersion using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ApplicationVersion) LateInitialize(attrs []byte) (bool, error) { + params := &ApplicationVersionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ApplicationVersion) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticbeanstalk/v1beta1/zz_applicationversion_types.go b/apis/elasticbeanstalk/v1beta1/zz_applicationversion_types.go index cad8ffd76f..7e4b04fe0e 100755 --- a/apis/elasticbeanstalk/v1beta1/zz_applicationversion_types.go +++ b/apis/elasticbeanstalk/v1beta1/zz_applicationversion_types.go @@ -167,13 +167,14 @@ type ApplicationVersionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ApplicationVersion is the Schema for the ApplicationVersions API. Provides an Elastic Beanstalk Application Version Resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ApplicationVersion struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticbeanstalk/v1beta1/zz_configurationtemplate_terraformed.go b/apis/elasticbeanstalk/v1beta1/zz_configurationtemplate_terraformed.go new file mode 100755 index 0000000000..3a1a90cb32 --- /dev/null +++ b/apis/elasticbeanstalk/v1beta1/zz_configurationtemplate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConfigurationTemplate +func (mg *ConfigurationTemplate) GetTerraformResourceType() string { + return "aws_elastic_beanstalk_configuration_template" +} + +// GetConnectionDetailsMapping for this ConfigurationTemplate +func (tr *ConfigurationTemplate) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ConfigurationTemplate +func (tr *ConfigurationTemplate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConfigurationTemplate +func (tr *ConfigurationTemplate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConfigurationTemplate +func (tr *ConfigurationTemplate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConfigurationTemplate +func (tr *ConfigurationTemplate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConfigurationTemplate +func (tr *ConfigurationTemplate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConfigurationTemplate +func (tr *ConfigurationTemplate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConfigurationTemplate +func (tr *ConfigurationTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConfigurationTemplate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConfigurationTemplate) LateInitialize(attrs []byte) (bool, error) { + params := &ConfigurationTemplateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConfigurationTemplate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticbeanstalk/v1beta1/zz_configurationtemplate_types.go b/apis/elasticbeanstalk/v1beta1/zz_configurationtemplate_types.go index 65f260d8d1..9eec0e5ae9 100755 --- a/apis/elasticbeanstalk/v1beta1/zz_configurationtemplate_types.go +++ b/apis/elasticbeanstalk/v1beta1/zz_configurationtemplate_types.go @@ -183,13 +183,14 @@ type ConfigurationTemplateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConfigurationTemplate is the Schema for the ConfigurationTemplates API. Provides an Elastic Beanstalk Configuration Template // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConfigurationTemplate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticbeanstalk/v1beta1/zz_generated.conversion_hubs.go b/apis/elasticbeanstalk/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..7d43ff2eb3 --- /dev/null +++ b/apis/elasticbeanstalk/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Application) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ApplicationVersion) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ConfigurationTemplate) Hub() {} diff --git a/apis/elasticbeanstalk/v1beta1/zz_generated_terraformed.go b/apis/elasticbeanstalk/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 06b131c988..0000000000 --- a/apis/elasticbeanstalk/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Application -func (mg *Application) GetTerraformResourceType() string { - return "aws_elastic_beanstalk_application" -} - -// GetConnectionDetailsMapping for this Application -func (tr *Application) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Application -func (tr *Application) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Application -func (tr *Application) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Application -func (tr *Application) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Application -func (tr *Application) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Application -func (tr *Application) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Application -func (tr *Application) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Application -func (tr *Application) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Application using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Application) LateInitialize(attrs []byte) (bool, error) { - params := &ApplicationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Application) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ApplicationVersion -func (mg *ApplicationVersion) GetTerraformResourceType() string { - return "aws_elastic_beanstalk_application_version" -} - -// GetConnectionDetailsMapping for this ApplicationVersion -func (tr *ApplicationVersion) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ApplicationVersion -func (tr *ApplicationVersion) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ApplicationVersion -func (tr *ApplicationVersion) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ApplicationVersion -func (tr *ApplicationVersion) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ApplicationVersion -func (tr *ApplicationVersion) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ApplicationVersion -func (tr *ApplicationVersion) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ApplicationVersion -func (tr *ApplicationVersion) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ApplicationVersion -func (tr *ApplicationVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ApplicationVersion using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ApplicationVersion) LateInitialize(attrs []byte) (bool, error) { - params := &ApplicationVersionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ApplicationVersion) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ConfigurationTemplate -func (mg *ConfigurationTemplate) GetTerraformResourceType() string { - return "aws_elastic_beanstalk_configuration_template" -} - -// GetConnectionDetailsMapping for this ConfigurationTemplate -func (tr *ConfigurationTemplate) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ConfigurationTemplate -func (tr *ConfigurationTemplate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConfigurationTemplate -func (tr *ConfigurationTemplate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConfigurationTemplate -func (tr *ConfigurationTemplate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConfigurationTemplate -func (tr *ConfigurationTemplate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConfigurationTemplate -func (tr *ConfigurationTemplate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConfigurationTemplate -func (tr *ConfigurationTemplate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConfigurationTemplate -func (tr *ConfigurationTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConfigurationTemplate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConfigurationTemplate) LateInitialize(attrs []byte) (bool, error) { - params := &ConfigurationTemplateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConfigurationTemplate) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/elasticsearch/v1beta1/zz_domain_terraformed.go b/apis/elasticsearch/v1beta1/zz_domain_terraformed.go new file mode 100755 index 0000000000..78695e32d4 --- /dev/null +++ b/apis/elasticsearch/v1beta1/zz_domain_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Domain +func (mg *Domain) GetTerraformResourceType() string { + return "aws_elasticsearch_domain" +} + +// GetConnectionDetailsMapping for this Domain +func (tr *Domain) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"advanced_security_options[*].master_user_options[*].master_user_password": "spec.forProvider.advancedSecurityOptions[*].masterUserOptions[*].masterUserPasswordSecretRef"} +} + +// GetObservation of this Domain +func (tr *Domain) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Domain +func (tr *Domain) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Domain +func (tr *Domain) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Domain +func (tr *Domain) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Domain +func (tr *Domain) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Domain +func (tr *Domain) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Domain +func (tr *Domain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Domain using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Domain) LateInitialize(attrs []byte) (bool, error) { + params := &DomainParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Domain) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticsearch/v1beta1/zz_domain_types.go b/apis/elasticsearch/v1beta1/zz_domain_types.go index a47600e0ff..8dbe07634d 100755 --- a/apis/elasticsearch/v1beta1/zz_domain_types.go +++ b/apis/elasticsearch/v1beta1/zz_domain_types.go @@ -900,13 +900,14 @@ type DomainStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Domain is the Schema for the Domains API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Domain struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticsearch/v1beta1/zz_domainpolicy_terraformed.go b/apis/elasticsearch/v1beta1/zz_domainpolicy_terraformed.go new file mode 100755 index 0000000000..60920766bb --- /dev/null +++ b/apis/elasticsearch/v1beta1/zz_domainpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DomainPolicy +func (mg *DomainPolicy) GetTerraformResourceType() string { + return "aws_elasticsearch_domain_policy" +} + +// GetConnectionDetailsMapping for this DomainPolicy +func (tr *DomainPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DomainPolicy +func (tr *DomainPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DomainPolicy +func (tr *DomainPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DomainPolicy +func (tr *DomainPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DomainPolicy +func (tr *DomainPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DomainPolicy +func (tr *DomainPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DomainPolicy +func (tr *DomainPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DomainPolicy +func (tr *DomainPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DomainPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DomainPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &DomainPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DomainPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticsearch/v1beta1/zz_domainpolicy_types.go b/apis/elasticsearch/v1beta1/zz_domainpolicy_types.go index a16228b13d..784e071acf 100755 --- a/apis/elasticsearch/v1beta1/zz_domainpolicy_types.go +++ b/apis/elasticsearch/v1beta1/zz_domainpolicy_types.go @@ -95,13 +95,14 @@ type DomainPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DomainPolicy is the Schema for the DomainPolicys API. Provides an Elasticsearch Domain Policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DomainPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticsearch/v1beta1/zz_domainsamloptions_terraformed.go b/apis/elasticsearch/v1beta1/zz_domainsamloptions_terraformed.go new file mode 100755 index 0000000000..8623c06de3 --- /dev/null +++ b/apis/elasticsearch/v1beta1/zz_domainsamloptions_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DomainSAMLOptions +func (mg *DomainSAMLOptions) GetTerraformResourceType() string { + return "aws_elasticsearch_domain_saml_options" +} + +// GetConnectionDetailsMapping for this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"saml_options[*].master_user_name": "spec.forProvider.samlOptions[*].masterUserNameSecretRef"} +} + +// GetObservation of this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DomainSAMLOptions +func (tr *DomainSAMLOptions) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DomainSAMLOptions +func (tr *DomainSAMLOptions) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DomainSAMLOptions using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DomainSAMLOptions) LateInitialize(attrs []byte) (bool, error) { + params := &DomainSAMLOptionsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DomainSAMLOptions) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticsearch/v1beta1/zz_domainsamloptions_types.go b/apis/elasticsearch/v1beta1/zz_domainsamloptions_types.go index 8bce46b595..23a0fe0305 100755 --- a/apis/elasticsearch/v1beta1/zz_domainsamloptions_types.go +++ b/apis/elasticsearch/v1beta1/zz_domainsamloptions_types.go @@ -170,13 +170,14 @@ type DomainSAMLOptionsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DomainSAMLOptions is the Schema for the DomainSAMLOptionss API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DomainSAMLOptions struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elasticsearch/v1beta1/zz_generated.conversion_hubs.go b/apis/elasticsearch/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..62d14afc7b --- /dev/null +++ b/apis/elasticsearch/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Domain) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DomainPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DomainSAMLOptions) Hub() {} diff --git a/apis/elasticsearch/v1beta1/zz_generated_terraformed.go b/apis/elasticsearch/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index a10f5c4696..0000000000 --- a/apis/elasticsearch/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Domain -func (mg *Domain) GetTerraformResourceType() string { - return "aws_elasticsearch_domain" -} - -// GetConnectionDetailsMapping for this Domain -func (tr *Domain) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"advanced_security_options[*].master_user_options[*].master_user_password": "spec.forProvider.advancedSecurityOptions[*].masterUserOptions[*].masterUserPasswordSecretRef"} -} - -// GetObservation of this Domain -func (tr *Domain) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Domain -func (tr *Domain) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Domain -func (tr *Domain) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Domain -func (tr *Domain) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Domain -func (tr *Domain) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Domain -func (tr *Domain) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Domain -func (tr *Domain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Domain using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Domain) LateInitialize(attrs []byte) (bool, error) { - params := &DomainParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Domain) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DomainPolicy -func (mg *DomainPolicy) GetTerraformResourceType() string { - return "aws_elasticsearch_domain_policy" -} - -// GetConnectionDetailsMapping for this DomainPolicy -func (tr *DomainPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DomainPolicy -func (tr *DomainPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DomainPolicy -func (tr *DomainPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DomainPolicy -func (tr *DomainPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DomainPolicy -func (tr *DomainPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DomainPolicy -func (tr *DomainPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DomainPolicy -func (tr *DomainPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DomainPolicy -func (tr *DomainPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DomainPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DomainPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &DomainPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DomainPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DomainSAMLOptions -func (mg *DomainSAMLOptions) GetTerraformResourceType() string { - return "aws_elasticsearch_domain_saml_options" -} - -// GetConnectionDetailsMapping for this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"saml_options[*].master_user_name": "spec.forProvider.samlOptions[*].masterUserNameSecretRef"} -} - -// GetObservation of this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DomainSAMLOptions -func (tr *DomainSAMLOptions) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DomainSAMLOptions -func (tr *DomainSAMLOptions) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DomainSAMLOptions using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DomainSAMLOptions) LateInitialize(attrs []byte) (bool, error) { - params := &DomainSAMLOptionsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DomainSAMLOptions) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/elastictranscoder/v1beta1/zz_generated.conversion_hubs.go b/apis/elastictranscoder/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..c443773edd --- /dev/null +++ b/apis/elastictranscoder/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Pipeline) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Preset) Hub() {} diff --git a/apis/elastictranscoder/v1beta1/zz_generated_terraformed.go b/apis/elastictranscoder/v1beta1/zz_pipeline_terraformed.go similarity index 52% rename from apis/elastictranscoder/v1beta1/zz_generated_terraformed.go rename to apis/elastictranscoder/v1beta1/zz_pipeline_terraformed.go index 4cf5b5d2d3..dde60f4227 100755 --- a/apis/elastictranscoder/v1beta1/zz_generated_terraformed.go +++ b/apis/elastictranscoder/v1beta1/zz_pipeline_terraformed.go @@ -131,117 +131,3 @@ func (tr *Pipeline) LateInitialize(attrs []byte) (bool, error) { func (tr *Pipeline) GetTerraformSchemaVersion() int { return 0 } - -// GetTerraformResourceType returns Terraform resource type for this Preset -func (mg *Preset) GetTerraformResourceType() string { - return "aws_elastictranscoder_preset" -} - -// GetConnectionDetailsMapping for this Preset -func (tr *Preset) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Preset -func (tr *Preset) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Preset -func (tr *Preset) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Preset -func (tr *Preset) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Preset -func (tr *Preset) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Preset -func (tr *Preset) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Preset -func (tr *Preset) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Preset -func (tr *Preset) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Preset using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Preset) LateInitialize(attrs []byte) (bool, error) { - params := &PresetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Preset) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/elastictranscoder/v1beta1/zz_pipeline_types.go b/apis/elastictranscoder/v1beta1/zz_pipeline_types.go index 4a65c1a52e..9b2f68cc25 100755 --- a/apis/elastictranscoder/v1beta1/zz_pipeline_types.go +++ b/apis/elastictranscoder/v1beta1/zz_pipeline_types.go @@ -426,13 +426,14 @@ type PipelineStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Pipeline is the Schema for the Pipelines API. Provides an Elastic Transcoder pipeline resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Pipeline struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elastictranscoder/v1beta1/zz_preset_terraformed.go b/apis/elastictranscoder/v1beta1/zz_preset_terraformed.go new file mode 100755 index 0000000000..a42961939c --- /dev/null +++ b/apis/elastictranscoder/v1beta1/zz_preset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Preset +func (mg *Preset) GetTerraformResourceType() string { + return "aws_elastictranscoder_preset" +} + +// GetConnectionDetailsMapping for this Preset +func (tr *Preset) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Preset +func (tr *Preset) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Preset +func (tr *Preset) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Preset +func (tr *Preset) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Preset +func (tr *Preset) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Preset +func (tr *Preset) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Preset +func (tr *Preset) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Preset +func (tr *Preset) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Preset using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Preset) LateInitialize(attrs []byte) (bool, error) { + params := &PresetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Preset) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elastictranscoder/v1beta1/zz_preset_types.go b/apis/elastictranscoder/v1beta1/zz_preset_types.go index 0324a3aede..48a227c9ca 100755 --- a/apis/elastictranscoder/v1beta1/zz_preset_types.go +++ b/apis/elastictranscoder/v1beta1/zz_preset_types.go @@ -606,13 +606,14 @@ type PresetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Preset is the Schema for the Presets API. Provides an Elastic Transcoder preset resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Preset struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elb/v1beta1/zz_appcookiestickinesspolicy_terraformed.go b/apis/elb/v1beta1/zz_appcookiestickinesspolicy_terraformed.go new file mode 100755 index 0000000000..c60e975eac --- /dev/null +++ b/apis/elb/v1beta1/zz_appcookiestickinesspolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AppCookieStickinessPolicy +func (mg *AppCookieStickinessPolicy) GetTerraformResourceType() string { + return "aws_app_cookie_stickiness_policy" +} + +// GetConnectionDetailsMapping for this AppCookieStickinessPolicy +func (tr *AppCookieStickinessPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AppCookieStickinessPolicy +func (tr *AppCookieStickinessPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AppCookieStickinessPolicy +func (tr *AppCookieStickinessPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AppCookieStickinessPolicy +func (tr *AppCookieStickinessPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AppCookieStickinessPolicy +func (tr *AppCookieStickinessPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AppCookieStickinessPolicy +func (tr *AppCookieStickinessPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AppCookieStickinessPolicy +func (tr *AppCookieStickinessPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AppCookieStickinessPolicy +func (tr *AppCookieStickinessPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AppCookieStickinessPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AppCookieStickinessPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &AppCookieStickinessPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AppCookieStickinessPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elb/v1beta1/zz_appcookiestickinesspolicy_types.go b/apis/elb/v1beta1/zz_appcookiestickinesspolicy_types.go index e331e18706..0947094cbd 100755 --- a/apis/elb/v1beta1/zz_appcookiestickinesspolicy_types.go +++ b/apis/elb/v1beta1/zz_appcookiestickinesspolicy_types.go @@ -97,13 +97,14 @@ type AppCookieStickinessPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AppCookieStickinessPolicy is the Schema for the AppCookieStickinessPolicys API. Provides an application cookie stickiness policy, which allows an ELB to wed its stickiness cookie to a cookie generated by your application. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AppCookieStickinessPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elb/v1beta1/zz_attachment_terraformed.go b/apis/elb/v1beta1/zz_attachment_terraformed.go new file mode 100755 index 0000000000..519367b958 --- /dev/null +++ b/apis/elb/v1beta1/zz_attachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Attachment +func (mg *Attachment) GetTerraformResourceType() string { + return "aws_elb_attachment" +} + +// GetConnectionDetailsMapping for this Attachment +func (tr *Attachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Attachment +func (tr *Attachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Attachment +func (tr *Attachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Attachment +func (tr *Attachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Attachment +func (tr *Attachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Attachment +func (tr *Attachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Attachment +func (tr *Attachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Attachment +func (tr *Attachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Attachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Attachment) LateInitialize(attrs []byte) (bool, error) { + params := &AttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Attachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elb/v1beta1/zz_attachment_types.go b/apis/elb/v1beta1/zz_attachment_types.go index 29c177a0af..2151cbd731 100755 --- a/apis/elb/v1beta1/zz_attachment_types.go +++ b/apis/elb/v1beta1/zz_attachment_types.go @@ -113,13 +113,14 @@ type AttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Attachment is the Schema for the Attachments API. Provides an Elastic Load Balancer Attachment resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Attachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elb/v1beta1/zz_backendserverpolicy_terraformed.go b/apis/elb/v1beta1/zz_backendserverpolicy_terraformed.go new file mode 100755 index 0000000000..0b9e0fd4fb --- /dev/null +++ b/apis/elb/v1beta1/zz_backendserverpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BackendServerPolicy +func (mg *BackendServerPolicy) GetTerraformResourceType() string { + return "aws_load_balancer_backend_server_policy" +} + +// GetConnectionDetailsMapping for this BackendServerPolicy +func (tr *BackendServerPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BackendServerPolicy +func (tr *BackendServerPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BackendServerPolicy +func (tr *BackendServerPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BackendServerPolicy +func (tr *BackendServerPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BackendServerPolicy +func (tr *BackendServerPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BackendServerPolicy +func (tr *BackendServerPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BackendServerPolicy +func (tr *BackendServerPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BackendServerPolicy +func (tr *BackendServerPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BackendServerPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BackendServerPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &BackendServerPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BackendServerPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elb/v1beta1/zz_backendserverpolicy_types.go b/apis/elb/v1beta1/zz_backendserverpolicy_types.go index bf78fee9a2..35c3d4956f 100755 --- a/apis/elb/v1beta1/zz_backendserverpolicy_types.go +++ b/apis/elb/v1beta1/zz_backendserverpolicy_types.go @@ -109,13 +109,14 @@ type BackendServerPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BackendServerPolicy is the Schema for the BackendServerPolicys API. Attaches a load balancer policy to an ELB backend server. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BackendServerPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elb/v1beta1/zz_elb_terraformed.go b/apis/elb/v1beta1/zz_elb_terraformed.go new file mode 100755 index 0000000000..6f8b083ca4 --- /dev/null +++ b/apis/elb/v1beta1/zz_elb_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ELB +func (mg *ELB) GetTerraformResourceType() string { + return "aws_elb" +} + +// GetConnectionDetailsMapping for this ELB +func (tr *ELB) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ELB +func (tr *ELB) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ELB +func (tr *ELB) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ELB +func (tr *ELB) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ELB +func (tr *ELB) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ELB +func (tr *ELB) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ELB +func (tr *ELB) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ELB +func (tr *ELB) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ELB using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ELB) LateInitialize(attrs []byte) (bool, error) { + params := &ELBParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("AccessLogs")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ELB) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elb/v1beta1/zz_elb_types.go b/apis/elb/v1beta1/zz_elb_types.go index 74cf525d63..feeae3f8ee 100755 --- a/apis/elb/v1beta1/zz_elb_types.go +++ b/apis/elb/v1beta1/zz_elb_types.go @@ -465,13 +465,14 @@ type ELBStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ELB is the Schema for the ELBs API. Provides an Elastic Load Balancer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ELB struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elb/v1beta1/zz_generated.conversion_hubs.go b/apis/elb/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..dd1e24ec3a --- /dev/null +++ b/apis/elb/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AppCookieStickinessPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ELB) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Attachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LBCookieStickinessPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LBSSLNegotiationPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BackendServerPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ListenerPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Policy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ProxyProtocolPolicy) Hub() {} diff --git a/apis/elb/v1beta1/zz_generated_terraformed.go b/apis/elb/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 2d3e38fa0c..0000000000 --- a/apis/elb/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1046 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AppCookieStickinessPolicy -func (mg *AppCookieStickinessPolicy) GetTerraformResourceType() string { - return "aws_app_cookie_stickiness_policy" -} - -// GetConnectionDetailsMapping for this AppCookieStickinessPolicy -func (tr *AppCookieStickinessPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AppCookieStickinessPolicy -func (tr *AppCookieStickinessPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AppCookieStickinessPolicy -func (tr *AppCookieStickinessPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AppCookieStickinessPolicy -func (tr *AppCookieStickinessPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AppCookieStickinessPolicy -func (tr *AppCookieStickinessPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AppCookieStickinessPolicy -func (tr *AppCookieStickinessPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AppCookieStickinessPolicy -func (tr *AppCookieStickinessPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AppCookieStickinessPolicy -func (tr *AppCookieStickinessPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AppCookieStickinessPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AppCookieStickinessPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &AppCookieStickinessPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AppCookieStickinessPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ELB -func (mg *ELB) GetTerraformResourceType() string { - return "aws_elb" -} - -// GetConnectionDetailsMapping for this ELB -func (tr *ELB) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ELB -func (tr *ELB) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ELB -func (tr *ELB) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ELB -func (tr *ELB) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ELB -func (tr *ELB) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ELB -func (tr *ELB) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ELB -func (tr *ELB) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ELB -func (tr *ELB) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ELB using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ELB) LateInitialize(attrs []byte) (bool, error) { - params := &ELBParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("AccessLogs")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ELB) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Attachment -func (mg *Attachment) GetTerraformResourceType() string { - return "aws_elb_attachment" -} - -// GetConnectionDetailsMapping for this Attachment -func (tr *Attachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Attachment -func (tr *Attachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Attachment -func (tr *Attachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Attachment -func (tr *Attachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Attachment -func (tr *Attachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Attachment -func (tr *Attachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Attachment -func (tr *Attachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Attachment -func (tr *Attachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Attachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Attachment) LateInitialize(attrs []byte) (bool, error) { - params := &AttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Attachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LBCookieStickinessPolicy -func (mg *LBCookieStickinessPolicy) GetTerraformResourceType() string { - return "aws_lb_cookie_stickiness_policy" -} - -// GetConnectionDetailsMapping for this LBCookieStickinessPolicy -func (tr *LBCookieStickinessPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LBCookieStickinessPolicy -func (tr *LBCookieStickinessPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LBCookieStickinessPolicy -func (tr *LBCookieStickinessPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LBCookieStickinessPolicy -func (tr *LBCookieStickinessPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LBCookieStickinessPolicy -func (tr *LBCookieStickinessPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LBCookieStickinessPolicy -func (tr *LBCookieStickinessPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LBCookieStickinessPolicy -func (tr *LBCookieStickinessPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LBCookieStickinessPolicy -func (tr *LBCookieStickinessPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LBCookieStickinessPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LBCookieStickinessPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &LBCookieStickinessPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LBCookieStickinessPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LBSSLNegotiationPolicy -func (mg *LBSSLNegotiationPolicy) GetTerraformResourceType() string { - return "aws_lb_ssl_negotiation_policy" -} - -// GetConnectionDetailsMapping for this LBSSLNegotiationPolicy -func (tr *LBSSLNegotiationPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LBSSLNegotiationPolicy -func (tr *LBSSLNegotiationPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LBSSLNegotiationPolicy -func (tr *LBSSLNegotiationPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LBSSLNegotiationPolicy -func (tr *LBSSLNegotiationPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LBSSLNegotiationPolicy -func (tr *LBSSLNegotiationPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LBSSLNegotiationPolicy -func (tr *LBSSLNegotiationPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LBSSLNegotiationPolicy -func (tr *LBSSLNegotiationPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LBSSLNegotiationPolicy -func (tr *LBSSLNegotiationPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LBSSLNegotiationPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LBSSLNegotiationPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &LBSSLNegotiationPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LBSSLNegotiationPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BackendServerPolicy -func (mg *BackendServerPolicy) GetTerraformResourceType() string { - return "aws_load_balancer_backend_server_policy" -} - -// GetConnectionDetailsMapping for this BackendServerPolicy -func (tr *BackendServerPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BackendServerPolicy -func (tr *BackendServerPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BackendServerPolicy -func (tr *BackendServerPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BackendServerPolicy -func (tr *BackendServerPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BackendServerPolicy -func (tr *BackendServerPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BackendServerPolicy -func (tr *BackendServerPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BackendServerPolicy -func (tr *BackendServerPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BackendServerPolicy -func (tr *BackendServerPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BackendServerPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BackendServerPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &BackendServerPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BackendServerPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ListenerPolicy -func (mg *ListenerPolicy) GetTerraformResourceType() string { - return "aws_load_balancer_listener_policy" -} - -// GetConnectionDetailsMapping for this ListenerPolicy -func (tr *ListenerPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ListenerPolicy -func (tr *ListenerPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ListenerPolicy -func (tr *ListenerPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ListenerPolicy -func (tr *ListenerPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ListenerPolicy -func (tr *ListenerPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ListenerPolicy -func (tr *ListenerPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ListenerPolicy -func (tr *ListenerPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ListenerPolicy -func (tr *ListenerPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ListenerPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ListenerPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &ListenerPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ListenerPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Policy -func (mg *Policy) GetTerraformResourceType() string { - return "aws_load_balancer_policy" -} - -// GetConnectionDetailsMapping for this Policy -func (tr *Policy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Policy -func (tr *Policy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Policy -func (tr *Policy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Policy -func (tr *Policy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Policy -func (tr *Policy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Policy -func (tr *Policy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Policy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { - params := &PolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Policy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ProxyProtocolPolicy -func (mg *ProxyProtocolPolicy) GetTerraformResourceType() string { - return "aws_proxy_protocol_policy" -} - -// GetConnectionDetailsMapping for this ProxyProtocolPolicy -func (tr *ProxyProtocolPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ProxyProtocolPolicy -func (tr *ProxyProtocolPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ProxyProtocolPolicy -func (tr *ProxyProtocolPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ProxyProtocolPolicy -func (tr *ProxyProtocolPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ProxyProtocolPolicy -func (tr *ProxyProtocolPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ProxyProtocolPolicy -func (tr *ProxyProtocolPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ProxyProtocolPolicy -func (tr *ProxyProtocolPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ProxyProtocolPolicy -func (tr *ProxyProtocolPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ProxyProtocolPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ProxyProtocolPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &ProxyProtocolPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ProxyProtocolPolicy) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/elb/v1beta1/zz_lbcookiestickinesspolicy_terraformed.go b/apis/elb/v1beta1/zz_lbcookiestickinesspolicy_terraformed.go new file mode 100755 index 0000000000..10bfaff7db --- /dev/null +++ b/apis/elb/v1beta1/zz_lbcookiestickinesspolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LBCookieStickinessPolicy +func (mg *LBCookieStickinessPolicy) GetTerraformResourceType() string { + return "aws_lb_cookie_stickiness_policy" +} + +// GetConnectionDetailsMapping for this LBCookieStickinessPolicy +func (tr *LBCookieStickinessPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LBCookieStickinessPolicy +func (tr *LBCookieStickinessPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LBCookieStickinessPolicy +func (tr *LBCookieStickinessPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LBCookieStickinessPolicy +func (tr *LBCookieStickinessPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LBCookieStickinessPolicy +func (tr *LBCookieStickinessPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LBCookieStickinessPolicy +func (tr *LBCookieStickinessPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LBCookieStickinessPolicy +func (tr *LBCookieStickinessPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LBCookieStickinessPolicy +func (tr *LBCookieStickinessPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LBCookieStickinessPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LBCookieStickinessPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &LBCookieStickinessPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LBCookieStickinessPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elb/v1beta1/zz_lbcookiestickinesspolicy_types.go b/apis/elb/v1beta1/zz_lbcookiestickinesspolicy_types.go index 57ca205961..aeb714e6a0 100755 --- a/apis/elb/v1beta1/zz_lbcookiestickinesspolicy_types.go +++ b/apis/elb/v1beta1/zz_lbcookiestickinesspolicy_types.go @@ -130,13 +130,14 @@ type LBCookieStickinessPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LBCookieStickinessPolicy is the Schema for the LBCookieStickinessPolicys API. Provides a load balancer cookie stickiness policy, which allows an ELB to control the sticky session lifetime of the browser. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LBCookieStickinessPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elb/v1beta1/zz_lbsslnegotiationpolicy_terraformed.go b/apis/elb/v1beta1/zz_lbsslnegotiationpolicy_terraformed.go new file mode 100755 index 0000000000..acce020dc0 --- /dev/null +++ b/apis/elb/v1beta1/zz_lbsslnegotiationpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LBSSLNegotiationPolicy +func (mg *LBSSLNegotiationPolicy) GetTerraformResourceType() string { + return "aws_lb_ssl_negotiation_policy" +} + +// GetConnectionDetailsMapping for this LBSSLNegotiationPolicy +func (tr *LBSSLNegotiationPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LBSSLNegotiationPolicy +func (tr *LBSSLNegotiationPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LBSSLNegotiationPolicy +func (tr *LBSSLNegotiationPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LBSSLNegotiationPolicy +func (tr *LBSSLNegotiationPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LBSSLNegotiationPolicy +func (tr *LBSSLNegotiationPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LBSSLNegotiationPolicy +func (tr *LBSSLNegotiationPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LBSSLNegotiationPolicy +func (tr *LBSSLNegotiationPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LBSSLNegotiationPolicy +func (tr *LBSSLNegotiationPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LBSSLNegotiationPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LBSSLNegotiationPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &LBSSLNegotiationPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LBSSLNegotiationPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elb/v1beta1/zz_lbsslnegotiationpolicy_types.go b/apis/elb/v1beta1/zz_lbsslnegotiationpolicy_types.go index 2a63528ec7..08c9ee0013 100755 --- a/apis/elb/v1beta1/zz_lbsslnegotiationpolicy_types.go +++ b/apis/elb/v1beta1/zz_lbsslnegotiationpolicy_types.go @@ -169,13 +169,14 @@ type LBSSLNegotiationPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LBSSLNegotiationPolicy is the Schema for the LBSSLNegotiationPolicys API. Provides a load balancer SSL negotiation policy, which allows an ELB to control which ciphers and protocols are supported during SSL negotiations between a client and a load balancer. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LBSSLNegotiationPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elb/v1beta1/zz_listenerpolicy_terraformed.go b/apis/elb/v1beta1/zz_listenerpolicy_terraformed.go new file mode 100755 index 0000000000..5cb45743e2 --- /dev/null +++ b/apis/elb/v1beta1/zz_listenerpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ListenerPolicy +func (mg *ListenerPolicy) GetTerraformResourceType() string { + return "aws_load_balancer_listener_policy" +} + +// GetConnectionDetailsMapping for this ListenerPolicy +func (tr *ListenerPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ListenerPolicy +func (tr *ListenerPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ListenerPolicy +func (tr *ListenerPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ListenerPolicy +func (tr *ListenerPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ListenerPolicy +func (tr *ListenerPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ListenerPolicy +func (tr *ListenerPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ListenerPolicy +func (tr *ListenerPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ListenerPolicy +func (tr *ListenerPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ListenerPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ListenerPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &ListenerPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ListenerPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elb/v1beta1/zz_listenerpolicy_types.go b/apis/elb/v1beta1/zz_listenerpolicy_types.go index 75788be0f5..f70d1a630c 100755 --- a/apis/elb/v1beta1/zz_listenerpolicy_types.go +++ b/apis/elb/v1beta1/zz_listenerpolicy_types.go @@ -122,13 +122,14 @@ type ListenerPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ListenerPolicy is the Schema for the ListenerPolicys API. Attaches a load balancer policy to an ELB Listener. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ListenerPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elb/v1beta1/zz_policy_terraformed.go b/apis/elb/v1beta1/zz_policy_terraformed.go new file mode 100755 index 0000000000..55225ef4d6 --- /dev/null +++ b/apis/elb/v1beta1/zz_policy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Policy +func (mg *Policy) GetTerraformResourceType() string { + return "aws_load_balancer_policy" +} + +// GetConnectionDetailsMapping for this Policy +func (tr *Policy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Policy +func (tr *Policy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Policy +func (tr *Policy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Policy +func (tr *Policy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Policy +func (tr *Policy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Policy +func (tr *Policy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Policy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { + params := &PolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Policy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elb/v1beta1/zz_policy_types.go b/apis/elb/v1beta1/zz_policy_types.go index 19b2390de8..7d034d8214 100755 --- a/apis/elb/v1beta1/zz_policy_types.go +++ b/apis/elb/v1beta1/zz_policy_types.go @@ -157,13 +157,14 @@ type PolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Policy is the Schema for the Policys API. Provides a load balancer policy, which can be attached to an ELB listener or backend server. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Policy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elb/v1beta1/zz_proxyprotocolpolicy_terraformed.go b/apis/elb/v1beta1/zz_proxyprotocolpolicy_terraformed.go new file mode 100755 index 0000000000..6ea9e2d6d1 --- /dev/null +++ b/apis/elb/v1beta1/zz_proxyprotocolpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ProxyProtocolPolicy +func (mg *ProxyProtocolPolicy) GetTerraformResourceType() string { + return "aws_proxy_protocol_policy" +} + +// GetConnectionDetailsMapping for this ProxyProtocolPolicy +func (tr *ProxyProtocolPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ProxyProtocolPolicy +func (tr *ProxyProtocolPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ProxyProtocolPolicy +func (tr *ProxyProtocolPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ProxyProtocolPolicy +func (tr *ProxyProtocolPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ProxyProtocolPolicy +func (tr *ProxyProtocolPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ProxyProtocolPolicy +func (tr *ProxyProtocolPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ProxyProtocolPolicy +func (tr *ProxyProtocolPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ProxyProtocolPolicy +func (tr *ProxyProtocolPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ProxyProtocolPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ProxyProtocolPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &ProxyProtocolPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ProxyProtocolPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elb/v1beta1/zz_proxyprotocolpolicy_types.go b/apis/elb/v1beta1/zz_proxyprotocolpolicy_types.go index 454d077eef..4675e71350 100755 --- a/apis/elb/v1beta1/zz_proxyprotocolpolicy_types.go +++ b/apis/elb/v1beta1/zz_proxyprotocolpolicy_types.go @@ -105,13 +105,14 @@ type ProxyProtocolPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ProxyProtocolPolicy is the Schema for the ProxyProtocolPolicys API. Provides a proxy protocol policy, which allows an ELB to carry a client connection information to a backend. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ProxyProtocolPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elbv2/v1beta1/zz_generated.conversion_hubs.go b/apis/elbv2/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..51859c768a --- /dev/null +++ b/apis/elbv2/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *LB) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LBListener) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LBListenerCertificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LBListenerRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LBTargetGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LBTargetGroupAttachment) Hub() {} diff --git a/apis/elbv2/v1beta1/zz_generated_terraformed.go b/apis/elbv2/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index f25aa60e88..0000000000 --- a/apis/elbv2/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,705 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this LB -func (mg *LB) GetTerraformResourceType() string { - return "aws_lb" -} - -// GetConnectionDetailsMapping for this LB -func (tr *LB) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LB -func (tr *LB) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LB -func (tr *LB) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LB -func (tr *LB) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LB -func (tr *LB) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LB -func (tr *LB) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LB -func (tr *LB) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LB -func (tr *LB) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LB using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LB) LateInitialize(attrs []byte) (bool, error) { - params := &LBParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("AccessLogs")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LB) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LBListener -func (mg *LBListener) GetTerraformResourceType() string { - return "aws_lb_listener" -} - -// GetConnectionDetailsMapping for this LBListener -func (tr *LBListener) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"default_action[*].authenticate_oidc[*].client_secret": "spec.forProvider.defaultAction[*].authenticateOidc[*].clientSecretSecretRef"} -} - -// GetObservation of this LBListener -func (tr *LBListener) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LBListener -func (tr *LBListener) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LBListener -func (tr *LBListener) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LBListener -func (tr *LBListener) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LBListener -func (tr *LBListener) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LBListener -func (tr *LBListener) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LBListener -func (tr *LBListener) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LBListener using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LBListener) LateInitialize(attrs []byte) (bool, error) { - params := &LBListenerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LBListener) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LBListenerCertificate -func (mg *LBListenerCertificate) GetTerraformResourceType() string { - return "aws_lb_listener_certificate" -} - -// GetConnectionDetailsMapping for this LBListenerCertificate -func (tr *LBListenerCertificate) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LBListenerCertificate -func (tr *LBListenerCertificate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LBListenerCertificate -func (tr *LBListenerCertificate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LBListenerCertificate -func (tr *LBListenerCertificate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LBListenerCertificate -func (tr *LBListenerCertificate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LBListenerCertificate -func (tr *LBListenerCertificate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LBListenerCertificate -func (tr *LBListenerCertificate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LBListenerCertificate -func (tr *LBListenerCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LBListenerCertificate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LBListenerCertificate) LateInitialize(attrs []byte) (bool, error) { - params := &LBListenerCertificateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LBListenerCertificate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LBListenerRule -func (mg *LBListenerRule) GetTerraformResourceType() string { - return "aws_lb_listener_rule" -} - -// GetConnectionDetailsMapping for this LBListenerRule -func (tr *LBListenerRule) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"action[*].authenticate_oidc[*].client_secret": "spec.forProvider.action[*].authenticateOidc[*].clientSecretSecretRef"} -} - -// GetObservation of this LBListenerRule -func (tr *LBListenerRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LBListenerRule -func (tr *LBListenerRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LBListenerRule -func (tr *LBListenerRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LBListenerRule -func (tr *LBListenerRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LBListenerRule -func (tr *LBListenerRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LBListenerRule -func (tr *LBListenerRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LBListenerRule -func (tr *LBListenerRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LBListenerRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LBListenerRule) LateInitialize(attrs []byte) (bool, error) { - params := &LBListenerRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LBListenerRule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LBTargetGroup -func (mg *LBTargetGroup) GetTerraformResourceType() string { - return "aws_lb_target_group" -} - -// GetConnectionDetailsMapping for this LBTargetGroup -func (tr *LBTargetGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LBTargetGroup -func (tr *LBTargetGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LBTargetGroup -func (tr *LBTargetGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LBTargetGroup -func (tr *LBTargetGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LBTargetGroup -func (tr *LBTargetGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LBTargetGroup -func (tr *LBTargetGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LBTargetGroup -func (tr *LBTargetGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LBTargetGroup -func (tr *LBTargetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LBTargetGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LBTargetGroup) LateInitialize(attrs []byte) (bool, error) { - params := &LBTargetGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("TargetFailover")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LBTargetGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LBTargetGroupAttachment -func (mg *LBTargetGroupAttachment) GetTerraformResourceType() string { - return "aws_lb_target_group_attachment" -} - -// GetConnectionDetailsMapping for this LBTargetGroupAttachment -func (tr *LBTargetGroupAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LBTargetGroupAttachment -func (tr *LBTargetGroupAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LBTargetGroupAttachment -func (tr *LBTargetGroupAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LBTargetGroupAttachment -func (tr *LBTargetGroupAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LBTargetGroupAttachment -func (tr *LBTargetGroupAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LBTargetGroupAttachment -func (tr *LBTargetGroupAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LBTargetGroupAttachment -func (tr *LBTargetGroupAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LBTargetGroupAttachment -func (tr *LBTargetGroupAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LBTargetGroupAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LBTargetGroupAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &LBTargetGroupAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LBTargetGroupAttachment) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/elbv2/v1beta1/zz_lb_terraformed.go b/apis/elbv2/v1beta1/zz_lb_terraformed.go new file mode 100755 index 0000000000..2f83d1b888 --- /dev/null +++ b/apis/elbv2/v1beta1/zz_lb_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LB +func (mg *LB) GetTerraformResourceType() string { + return "aws_lb" +} + +// GetConnectionDetailsMapping for this LB +func (tr *LB) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LB +func (tr *LB) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LB +func (tr *LB) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LB +func (tr *LB) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LB +func (tr *LB) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LB +func (tr *LB) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LB +func (tr *LB) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LB +func (tr *LB) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LB using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LB) LateInitialize(attrs []byte) (bool, error) { + params := &LBParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("AccessLogs")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LB) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elbv2/v1beta1/zz_lb_types.go b/apis/elbv2/v1beta1/zz_lb_types.go index 5f5a702e0e..a589a49c44 100755 --- a/apis/elbv2/v1beta1/zz_lb_types.go +++ b/apis/elbv2/v1beta1/zz_lb_types.go @@ -476,13 +476,14 @@ type LBStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LB is the Schema for the LBs API. Provides a Load Balancer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LB struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elbv2/v1beta1/zz_lblistener_terraformed.go b/apis/elbv2/v1beta1/zz_lblistener_terraformed.go new file mode 100755 index 0000000000..aced0ccc9e --- /dev/null +++ b/apis/elbv2/v1beta1/zz_lblistener_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LBListener +func (mg *LBListener) GetTerraformResourceType() string { + return "aws_lb_listener" +} + +// GetConnectionDetailsMapping for this LBListener +func (tr *LBListener) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"default_action[*].authenticate_oidc[*].client_secret": "spec.forProvider.defaultAction[*].authenticateOidc[*].clientSecretSecretRef"} +} + +// GetObservation of this LBListener +func (tr *LBListener) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LBListener +func (tr *LBListener) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LBListener +func (tr *LBListener) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LBListener +func (tr *LBListener) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LBListener +func (tr *LBListener) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LBListener +func (tr *LBListener) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LBListener +func (tr *LBListener) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LBListener using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LBListener) LateInitialize(attrs []byte) (bool, error) { + params := &LBListenerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LBListener) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elbv2/v1beta1/zz_lblistener_types.go b/apis/elbv2/v1beta1/zz_lblistener_types.go index 7e134089cb..e8c31f5aaa 100755 --- a/apis/elbv2/v1beta1/zz_lblistener_types.go +++ b/apis/elbv2/v1beta1/zz_lblistener_types.go @@ -694,13 +694,14 @@ type LBListenerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LBListener is the Schema for the LBListeners API. Provides a Load Balancer Listener resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LBListener struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elbv2/v1beta1/zz_lblistenercertificate_terraformed.go b/apis/elbv2/v1beta1/zz_lblistenercertificate_terraformed.go new file mode 100755 index 0000000000..6641126244 --- /dev/null +++ b/apis/elbv2/v1beta1/zz_lblistenercertificate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LBListenerCertificate +func (mg *LBListenerCertificate) GetTerraformResourceType() string { + return "aws_lb_listener_certificate" +} + +// GetConnectionDetailsMapping for this LBListenerCertificate +func (tr *LBListenerCertificate) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LBListenerCertificate +func (tr *LBListenerCertificate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LBListenerCertificate +func (tr *LBListenerCertificate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LBListenerCertificate +func (tr *LBListenerCertificate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LBListenerCertificate +func (tr *LBListenerCertificate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LBListenerCertificate +func (tr *LBListenerCertificate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LBListenerCertificate +func (tr *LBListenerCertificate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LBListenerCertificate +func (tr *LBListenerCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LBListenerCertificate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LBListenerCertificate) LateInitialize(attrs []byte) (bool, error) { + params := &LBListenerCertificateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LBListenerCertificate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elbv2/v1beta1/zz_lblistenercertificate_types.go b/apis/elbv2/v1beta1/zz_lblistenercertificate_types.go index bdff03aad1..e637775a20 100755 --- a/apis/elbv2/v1beta1/zz_lblistenercertificate_types.go +++ b/apis/elbv2/v1beta1/zz_lblistenercertificate_types.go @@ -118,13 +118,14 @@ type LBListenerCertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LBListenerCertificate is the Schema for the LBListenerCertificates API. Provides a Load Balancer Listener Certificate resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LBListenerCertificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elbv2/v1beta1/zz_lblistenerrule_terraformed.go b/apis/elbv2/v1beta1/zz_lblistenerrule_terraformed.go new file mode 100755 index 0000000000..b4f7c4f337 --- /dev/null +++ b/apis/elbv2/v1beta1/zz_lblistenerrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LBListenerRule +func (mg *LBListenerRule) GetTerraformResourceType() string { + return "aws_lb_listener_rule" +} + +// GetConnectionDetailsMapping for this LBListenerRule +func (tr *LBListenerRule) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"action[*].authenticate_oidc[*].client_secret": "spec.forProvider.action[*].authenticateOidc[*].clientSecretSecretRef"} +} + +// GetObservation of this LBListenerRule +func (tr *LBListenerRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LBListenerRule +func (tr *LBListenerRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LBListenerRule +func (tr *LBListenerRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LBListenerRule +func (tr *LBListenerRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LBListenerRule +func (tr *LBListenerRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LBListenerRule +func (tr *LBListenerRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LBListenerRule +func (tr *LBListenerRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LBListenerRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LBListenerRule) LateInitialize(attrs []byte) (bool, error) { + params := &LBListenerRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LBListenerRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elbv2/v1beta1/zz_lblistenerrule_types.go b/apis/elbv2/v1beta1/zz_lblistenerrule_types.go index 23cd7e26f3..8fd734ee5d 100755 --- a/apis/elbv2/v1beta1/zz_lblistenerrule_types.go +++ b/apis/elbv2/v1beta1/zz_lblistenerrule_types.go @@ -945,13 +945,14 @@ type LBListenerRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LBListenerRule is the Schema for the LBListenerRules API. Provides a Load Balancer Listener Rule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LBListenerRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elbv2/v1beta1/zz_lbtargetgroup_terraformed.go b/apis/elbv2/v1beta1/zz_lbtargetgroup_terraformed.go new file mode 100755 index 0000000000..fe66455ab6 --- /dev/null +++ b/apis/elbv2/v1beta1/zz_lbtargetgroup_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LBTargetGroup +func (mg *LBTargetGroup) GetTerraformResourceType() string { + return "aws_lb_target_group" +} + +// GetConnectionDetailsMapping for this LBTargetGroup +func (tr *LBTargetGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LBTargetGroup +func (tr *LBTargetGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LBTargetGroup +func (tr *LBTargetGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LBTargetGroup +func (tr *LBTargetGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LBTargetGroup +func (tr *LBTargetGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LBTargetGroup +func (tr *LBTargetGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LBTargetGroup +func (tr *LBTargetGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LBTargetGroup +func (tr *LBTargetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LBTargetGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LBTargetGroup) LateInitialize(attrs []byte) (bool, error) { + params := &LBTargetGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("TargetFailover")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LBTargetGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elbv2/v1beta1/zz_lbtargetgroup_types.go b/apis/elbv2/v1beta1/zz_lbtargetgroup_types.go index 52bfa86f82..0d3cf4b8eb 100755 --- a/apis/elbv2/v1beta1/zz_lbtargetgroup_types.go +++ b/apis/elbv2/v1beta1/zz_lbtargetgroup_types.go @@ -456,13 +456,14 @@ type LBTargetGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LBTargetGroup is the Schema for the LBTargetGroups API. Provides a Target Group resource for use with Load Balancers. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LBTargetGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/elbv2/v1beta1/zz_lbtargetgroupattachment_terraformed.go b/apis/elbv2/v1beta1/zz_lbtargetgroupattachment_terraformed.go new file mode 100755 index 0000000000..630dcd9906 --- /dev/null +++ b/apis/elbv2/v1beta1/zz_lbtargetgroupattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LBTargetGroupAttachment +func (mg *LBTargetGroupAttachment) GetTerraformResourceType() string { + return "aws_lb_target_group_attachment" +} + +// GetConnectionDetailsMapping for this LBTargetGroupAttachment +func (tr *LBTargetGroupAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LBTargetGroupAttachment +func (tr *LBTargetGroupAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LBTargetGroupAttachment +func (tr *LBTargetGroupAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LBTargetGroupAttachment +func (tr *LBTargetGroupAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LBTargetGroupAttachment +func (tr *LBTargetGroupAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LBTargetGroupAttachment +func (tr *LBTargetGroupAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LBTargetGroupAttachment +func (tr *LBTargetGroupAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LBTargetGroupAttachment +func (tr *LBTargetGroupAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LBTargetGroupAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LBTargetGroupAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &LBTargetGroupAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LBTargetGroupAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elbv2/v1beta1/zz_lbtargetgroupattachment_types.go b/apis/elbv2/v1beta1/zz_lbtargetgroupattachment_types.go index 9049fe208f..11bf6f86a1 100755 --- a/apis/elbv2/v1beta1/zz_lbtargetgroupattachment_types.go +++ b/apis/elbv2/v1beta1/zz_lbtargetgroupattachment_types.go @@ -116,13 +116,14 @@ type LBTargetGroupAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LBTargetGroupAttachment is the Schema for the LBTargetGroupAttachments API. Provides the ability to register instances and containers with a LB target group // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LBTargetGroupAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/emr/v1beta1/zz_generated.conversion_hubs.go b/apis/emr/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b83b82a6c9 --- /dev/null +++ b/apis/emr/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *SecurityConfiguration) Hub() {} diff --git a/apis/emr/v1beta1/zz_generated_terraformed.go b/apis/emr/v1beta1/zz_securityconfiguration_terraformed.go similarity index 100% rename from apis/emr/v1beta1/zz_generated_terraformed.go rename to apis/emr/v1beta1/zz_securityconfiguration_terraformed.go diff --git a/apis/emr/v1beta1/zz_securityconfiguration_types.go b/apis/emr/v1beta1/zz_securityconfiguration_types.go index c950be9481..82f9be5acb 100755 --- a/apis/emr/v1beta1/zz_securityconfiguration_types.go +++ b/apis/emr/v1beta1/zz_securityconfiguration_types.go @@ -71,13 +71,14 @@ type SecurityConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SecurityConfiguration is the Schema for the SecurityConfigurations API. Provides a resource to manage AWS EMR Security Configurations // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SecurityConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/emrserverless/v1beta1/zz_generated_terraformed.go b/apis/emrserverless/v1beta1/zz_application_terraformed.go similarity index 100% rename from apis/emrserverless/v1beta1/zz_generated_terraformed.go rename to apis/emrserverless/v1beta1/zz_application_terraformed.go diff --git a/apis/emrserverless/v1beta1/zz_application_types.go b/apis/emrserverless/v1beta1/zz_application_types.go index 9b820030bf..f12264cd7b 100755 --- a/apis/emrserverless/v1beta1/zz_application_types.go +++ b/apis/emrserverless/v1beta1/zz_application_types.go @@ -416,13 +416,14 @@ type ApplicationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Application is the Schema for the Applications API. Manages an EMR Serverless Application // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Application struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/emrserverless/v1beta1/zz_generated.conversion_hubs.go b/apis/emrserverless/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..dfc9ca8265 --- /dev/null +++ b/apis/emrserverless/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Application) Hub() {} diff --git a/apis/evidently/v1beta1/zz_feature_terraformed.go b/apis/evidently/v1beta1/zz_feature_terraformed.go new file mode 100755 index 0000000000..9a2ccd6a60 --- /dev/null +++ b/apis/evidently/v1beta1/zz_feature_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Feature +func (mg *Feature) GetTerraformResourceType() string { + return "aws_evidently_feature" +} + +// GetConnectionDetailsMapping for this Feature +func (tr *Feature) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Feature +func (tr *Feature) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Feature +func (tr *Feature) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Feature +func (tr *Feature) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Feature +func (tr *Feature) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Feature +func (tr *Feature) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Feature +func (tr *Feature) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Feature +func (tr *Feature) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Feature using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Feature) LateInitialize(attrs []byte) (bool, error) { + params := &FeatureParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Feature) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/evidently/v1beta1/zz_feature_types.go b/apis/evidently/v1beta1/zz_feature_types.go index 7bfdc03853..a835e9abc8 100755 --- a/apis/evidently/v1beta1/zz_feature_types.go +++ b/apis/evidently/v1beta1/zz_feature_types.go @@ -256,13 +256,14 @@ type FeatureStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Feature is the Schema for the Features API. Provides a CloudWatch Evidently Feature resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Feature struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/evidently/v1beta1/zz_generated.conversion_hubs.go b/apis/evidently/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b0f5515027 --- /dev/null +++ b/apis/evidently/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Feature) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Project) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Segment) Hub() {} diff --git a/apis/evidently/v1beta1/zz_generated_terraformed.go b/apis/evidently/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 36a50aba84..0000000000 --- a/apis/evidently/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Feature -func (mg *Feature) GetTerraformResourceType() string { - return "aws_evidently_feature" -} - -// GetConnectionDetailsMapping for this Feature -func (tr *Feature) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Feature -func (tr *Feature) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Feature -func (tr *Feature) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Feature -func (tr *Feature) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Feature -func (tr *Feature) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Feature -func (tr *Feature) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Feature -func (tr *Feature) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Feature -func (tr *Feature) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Feature using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Feature) LateInitialize(attrs []byte) (bool, error) { - params := &FeatureParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Feature) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Project -func (mg *Project) GetTerraformResourceType() string { - return "aws_evidently_project" -} - -// GetConnectionDetailsMapping for this Project -func (tr *Project) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Project -func (tr *Project) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Project -func (tr *Project) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Project -func (tr *Project) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Project -func (tr *Project) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Project -func (tr *Project) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Project -func (tr *Project) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Project -func (tr *Project) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Project using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Project) LateInitialize(attrs []byte) (bool, error) { - params := &ProjectParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Project) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Segment -func (mg *Segment) GetTerraformResourceType() string { - return "aws_evidently_segment" -} - -// GetConnectionDetailsMapping for this Segment -func (tr *Segment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Segment -func (tr *Segment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Segment -func (tr *Segment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Segment -func (tr *Segment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Segment -func (tr *Segment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Segment -func (tr *Segment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Segment -func (tr *Segment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Segment -func (tr *Segment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Segment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Segment) LateInitialize(attrs []byte) (bool, error) { - params := &SegmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Segment) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/evidently/v1beta1/zz_project_terraformed.go b/apis/evidently/v1beta1/zz_project_terraformed.go new file mode 100755 index 0000000000..5346a83425 --- /dev/null +++ b/apis/evidently/v1beta1/zz_project_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Project +func (mg *Project) GetTerraformResourceType() string { + return "aws_evidently_project" +} + +// GetConnectionDetailsMapping for this Project +func (tr *Project) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Project +func (tr *Project) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Project +func (tr *Project) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Project +func (tr *Project) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Project +func (tr *Project) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Project +func (tr *Project) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Project +func (tr *Project) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Project +func (tr *Project) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Project using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Project) LateInitialize(attrs []byte) (bool, error) { + params := &ProjectParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Project) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/evidently/v1beta1/zz_project_types.go b/apis/evidently/v1beta1/zz_project_types.go index 5338450158..f157af5714 100755 --- a/apis/evidently/v1beta1/zz_project_types.go +++ b/apis/evidently/v1beta1/zz_project_types.go @@ -209,13 +209,14 @@ type ProjectStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Project is the Schema for the Projects API. Provides a CloudWatch Evidently Project resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Project struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/evidently/v1beta1/zz_segment_terraformed.go b/apis/evidently/v1beta1/zz_segment_terraformed.go new file mode 100755 index 0000000000..c5736d62e3 --- /dev/null +++ b/apis/evidently/v1beta1/zz_segment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Segment +func (mg *Segment) GetTerraformResourceType() string { + return "aws_evidently_segment" +} + +// GetConnectionDetailsMapping for this Segment +func (tr *Segment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Segment +func (tr *Segment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Segment +func (tr *Segment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Segment +func (tr *Segment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Segment +func (tr *Segment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Segment +func (tr *Segment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Segment +func (tr *Segment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Segment +func (tr *Segment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Segment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Segment) LateInitialize(attrs []byte) (bool, error) { + params := &SegmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Segment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/evidently/v1beta1/zz_segment_types.go b/apis/evidently/v1beta1/zz_segment_types.go index 186fc7069c..97331b4d45 100755 --- a/apis/evidently/v1beta1/zz_segment_types.go +++ b/apis/evidently/v1beta1/zz_segment_types.go @@ -110,13 +110,14 @@ type SegmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Segment is the Schema for the Segments API. Provides a CloudWatch Evidently Segment resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Segment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/firehose/v1beta1/zz_generated_terraformed.go b/apis/firehose/v1beta1/zz_deliverystream_terraformed.go similarity index 100% rename from apis/firehose/v1beta1/zz_generated_terraformed.go rename to apis/firehose/v1beta1/zz_deliverystream_terraformed.go diff --git a/apis/firehose/v1beta1/zz_deliverystream_types.go b/apis/firehose/v1beta1/zz_deliverystream_types.go index 1f55a7aef2..1a5900d663 100755 --- a/apis/firehose/v1beta1/zz_deliverystream_types.go +++ b/apis/firehose/v1beta1/zz_deliverystream_types.go @@ -3181,13 +3181,14 @@ type DeliveryStreamStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DeliveryStream is the Schema for the DeliveryStreams API. Provides a AWS Kinesis Firehose Delivery Stream // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DeliveryStream struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/firehose/v1beta1/zz_generated.conversion_hubs.go b/apis/firehose/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..bab53ecd1c --- /dev/null +++ b/apis/firehose/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *DeliveryStream) Hub() {} diff --git a/apis/fis/v1beta1/zz_generated_terraformed.go b/apis/fis/v1beta1/zz_experimenttemplate_terraformed.go similarity index 100% rename from apis/fis/v1beta1/zz_generated_terraformed.go rename to apis/fis/v1beta1/zz_experimenttemplate_terraformed.go diff --git a/apis/fis/v1beta1/zz_experimenttemplate_types.go b/apis/fis/v1beta1/zz_experimenttemplate_types.go index 6ac4eb64dc..0097a5cb58 100755 --- a/apis/fis/v1beta1/zz_experimenttemplate_types.go +++ b/apis/fis/v1beta1/zz_experimenttemplate_types.go @@ -436,13 +436,14 @@ type ExperimentTemplateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ExperimentTemplate is the Schema for the ExperimentTemplates API. Provides an FIS Experiment Template. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ExperimentTemplate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/fis/v1beta1/zz_generated.conversion_hubs.go b/apis/fis/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..898adf3997 --- /dev/null +++ b/apis/fis/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ExperimentTemplate) Hub() {} diff --git a/apis/fsx/v1beta1/zz_backup_terraformed.go b/apis/fsx/v1beta1/zz_backup_terraformed.go new file mode 100755 index 0000000000..698c2955ff --- /dev/null +++ b/apis/fsx/v1beta1/zz_backup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Backup +func (mg *Backup) GetTerraformResourceType() string { + return "aws_fsx_backup" +} + +// GetConnectionDetailsMapping for this Backup +func (tr *Backup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Backup +func (tr *Backup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Backup +func (tr *Backup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Backup +func (tr *Backup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Backup +func (tr *Backup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Backup +func (tr *Backup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Backup +func (tr *Backup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Backup +func (tr *Backup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Backup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Backup) LateInitialize(attrs []byte) (bool, error) { + params := &BackupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Backup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/fsx/v1beta1/zz_backup_types.go b/apis/fsx/v1beta1/zz_backup_types.go index af7dcb2e4b..21a1f172bb 100755 --- a/apis/fsx/v1beta1/zz_backup_types.go +++ b/apis/fsx/v1beta1/zz_backup_types.go @@ -127,13 +127,14 @@ type BackupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Backup is the Schema for the Backups API. Manages a FSx Backup. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Backup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/fsx/v1beta1/zz_datarepositoryassociation_terraformed.go b/apis/fsx/v1beta1/zz_datarepositoryassociation_terraformed.go new file mode 100755 index 0000000000..e6a8daa7b6 --- /dev/null +++ b/apis/fsx/v1beta1/zz_datarepositoryassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DataRepositoryAssociation +func (mg *DataRepositoryAssociation) GetTerraformResourceType() string { + return "aws_fsx_data_repository_association" +} + +// GetConnectionDetailsMapping for this DataRepositoryAssociation +func (tr *DataRepositoryAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DataRepositoryAssociation +func (tr *DataRepositoryAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DataRepositoryAssociation +func (tr *DataRepositoryAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DataRepositoryAssociation +func (tr *DataRepositoryAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DataRepositoryAssociation +func (tr *DataRepositoryAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DataRepositoryAssociation +func (tr *DataRepositoryAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DataRepositoryAssociation +func (tr *DataRepositoryAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DataRepositoryAssociation +func (tr *DataRepositoryAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DataRepositoryAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DataRepositoryAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &DataRepositoryAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DataRepositoryAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/fsx/v1beta1/zz_datarepositoryassociation_types.go b/apis/fsx/v1beta1/zz_datarepositoryassociation_types.go index 8008b7e92d..77f165f47f 100755 --- a/apis/fsx/v1beta1/zz_datarepositoryassociation_types.go +++ b/apis/fsx/v1beta1/zz_datarepositoryassociation_types.go @@ -241,13 +241,14 @@ type DataRepositoryAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DataRepositoryAssociation is the Schema for the DataRepositoryAssociations API. Manages a FSx for Lustre Data Repository Association. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DataRepositoryAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/fsx/v1beta1/zz_generated.conversion_hubs.go b/apis/fsx/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b02f21fa66 --- /dev/null +++ b/apis/fsx/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Backup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DataRepositoryAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LustreFileSystem) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *OntapFileSystem) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *OntapStorageVirtualMachine) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *WindowsFileSystem) Hub() {} diff --git a/apis/fsx/v1beta1/zz_generated_terraformed.go b/apis/fsx/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 95b2c98f74..0000000000 --- a/apis/fsx/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,703 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Backup -func (mg *Backup) GetTerraformResourceType() string { - return "aws_fsx_backup" -} - -// GetConnectionDetailsMapping for this Backup -func (tr *Backup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Backup -func (tr *Backup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Backup -func (tr *Backup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Backup -func (tr *Backup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Backup -func (tr *Backup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Backup -func (tr *Backup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Backup -func (tr *Backup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Backup -func (tr *Backup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Backup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Backup) LateInitialize(attrs []byte) (bool, error) { - params := &BackupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Backup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DataRepositoryAssociation -func (mg *DataRepositoryAssociation) GetTerraformResourceType() string { - return "aws_fsx_data_repository_association" -} - -// GetConnectionDetailsMapping for this DataRepositoryAssociation -func (tr *DataRepositoryAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DataRepositoryAssociation -func (tr *DataRepositoryAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DataRepositoryAssociation -func (tr *DataRepositoryAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DataRepositoryAssociation -func (tr *DataRepositoryAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DataRepositoryAssociation -func (tr *DataRepositoryAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DataRepositoryAssociation -func (tr *DataRepositoryAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DataRepositoryAssociation -func (tr *DataRepositoryAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DataRepositoryAssociation -func (tr *DataRepositoryAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DataRepositoryAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DataRepositoryAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &DataRepositoryAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DataRepositoryAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LustreFileSystem -func (mg *LustreFileSystem) GetTerraformResourceType() string { - return "aws_fsx_lustre_file_system" -} - -// GetConnectionDetailsMapping for this LustreFileSystem -func (tr *LustreFileSystem) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LustreFileSystem -func (tr *LustreFileSystem) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LustreFileSystem -func (tr *LustreFileSystem) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LustreFileSystem -func (tr *LustreFileSystem) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LustreFileSystem -func (tr *LustreFileSystem) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LustreFileSystem -func (tr *LustreFileSystem) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LustreFileSystem -func (tr *LustreFileSystem) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LustreFileSystem -func (tr *LustreFileSystem) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LustreFileSystem using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LustreFileSystem) LateInitialize(attrs []byte) (bool, error) { - params := &LustreFileSystemParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LustreFileSystem) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this OntapFileSystem -func (mg *OntapFileSystem) GetTerraformResourceType() string { - return "aws_fsx_ontap_file_system" -} - -// GetConnectionDetailsMapping for this OntapFileSystem -func (tr *OntapFileSystem) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"fsx_admin_password": "spec.forProvider.fsxAdminPasswordSecretRef"} -} - -// GetObservation of this OntapFileSystem -func (tr *OntapFileSystem) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this OntapFileSystem -func (tr *OntapFileSystem) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this OntapFileSystem -func (tr *OntapFileSystem) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this OntapFileSystem -func (tr *OntapFileSystem) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this OntapFileSystem -func (tr *OntapFileSystem) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this OntapFileSystem -func (tr *OntapFileSystem) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this OntapFileSystem -func (tr *OntapFileSystem) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this OntapFileSystem using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *OntapFileSystem) LateInitialize(attrs []byte) (bool, error) { - params := &OntapFileSystemParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *OntapFileSystem) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this OntapStorageVirtualMachine -func (mg *OntapStorageVirtualMachine) GetTerraformResourceType() string { - return "aws_fsx_ontap_storage_virtual_machine" -} - -// GetConnectionDetailsMapping for this OntapStorageVirtualMachine -func (tr *OntapStorageVirtualMachine) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"active_directory_configuration[*].self_managed_active_directory_configuration[*].password": "spec.forProvider.activeDirectoryConfiguration[*].selfManagedActiveDirectoryConfiguration[*].passwordSecretRef", "svm_admin_password": "spec.forProvider.svmAdminPasswordSecretRef"} -} - -// GetObservation of this OntapStorageVirtualMachine -func (tr *OntapStorageVirtualMachine) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this OntapStorageVirtualMachine -func (tr *OntapStorageVirtualMachine) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this OntapStorageVirtualMachine -func (tr *OntapStorageVirtualMachine) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this OntapStorageVirtualMachine -func (tr *OntapStorageVirtualMachine) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this OntapStorageVirtualMachine -func (tr *OntapStorageVirtualMachine) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this OntapStorageVirtualMachine -func (tr *OntapStorageVirtualMachine) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this OntapStorageVirtualMachine -func (tr *OntapStorageVirtualMachine) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this OntapStorageVirtualMachine using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *OntapStorageVirtualMachine) LateInitialize(attrs []byte) (bool, error) { - params := &OntapStorageVirtualMachineParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *OntapStorageVirtualMachine) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this WindowsFileSystem -func (mg *WindowsFileSystem) GetTerraformResourceType() string { - return "aws_fsx_windows_file_system" -} - -// GetConnectionDetailsMapping for this WindowsFileSystem -func (tr *WindowsFileSystem) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"self_managed_active_directory[*].password": "spec.forProvider.selfManagedActiveDirectory[*].passwordSecretRef"} -} - -// GetObservation of this WindowsFileSystem -func (tr *WindowsFileSystem) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this WindowsFileSystem -func (tr *WindowsFileSystem) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this WindowsFileSystem -func (tr *WindowsFileSystem) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this WindowsFileSystem -func (tr *WindowsFileSystem) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this WindowsFileSystem -func (tr *WindowsFileSystem) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this WindowsFileSystem -func (tr *WindowsFileSystem) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this WindowsFileSystem -func (tr *WindowsFileSystem) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this WindowsFileSystem using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *WindowsFileSystem) LateInitialize(attrs []byte) (bool, error) { - params := &WindowsFileSystemParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *WindowsFileSystem) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/fsx/v1beta1/zz_lustrefilesystem_terraformed.go b/apis/fsx/v1beta1/zz_lustrefilesystem_terraformed.go new file mode 100755 index 0000000000..6db69336de --- /dev/null +++ b/apis/fsx/v1beta1/zz_lustrefilesystem_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LustreFileSystem +func (mg *LustreFileSystem) GetTerraformResourceType() string { + return "aws_fsx_lustre_file_system" +} + +// GetConnectionDetailsMapping for this LustreFileSystem +func (tr *LustreFileSystem) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LustreFileSystem +func (tr *LustreFileSystem) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LustreFileSystem +func (tr *LustreFileSystem) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LustreFileSystem +func (tr *LustreFileSystem) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LustreFileSystem +func (tr *LustreFileSystem) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LustreFileSystem +func (tr *LustreFileSystem) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LustreFileSystem +func (tr *LustreFileSystem) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LustreFileSystem +func (tr *LustreFileSystem) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LustreFileSystem using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LustreFileSystem) LateInitialize(attrs []byte) (bool, error) { + params := &LustreFileSystemParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LustreFileSystem) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/fsx/v1beta1/zz_lustrefilesystem_types.go b/apis/fsx/v1beta1/zz_lustrefilesystem_types.go index 9afa5b6661..b4fb0f165b 100755 --- a/apis/fsx/v1beta1/zz_lustrefilesystem_types.go +++ b/apis/fsx/v1beta1/zz_lustrefilesystem_types.go @@ -429,13 +429,14 @@ type LustreFileSystemStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LustreFileSystem is the Schema for the LustreFileSystems API. Manages a FSx Lustre File System. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LustreFileSystem struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/fsx/v1beta1/zz_ontapfilesystem_terraformed.go b/apis/fsx/v1beta1/zz_ontapfilesystem_terraformed.go new file mode 100755 index 0000000000..48a6b1796f --- /dev/null +++ b/apis/fsx/v1beta1/zz_ontapfilesystem_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this OntapFileSystem +func (mg *OntapFileSystem) GetTerraformResourceType() string { + return "aws_fsx_ontap_file_system" +} + +// GetConnectionDetailsMapping for this OntapFileSystem +func (tr *OntapFileSystem) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"fsx_admin_password": "spec.forProvider.fsxAdminPasswordSecretRef"} +} + +// GetObservation of this OntapFileSystem +func (tr *OntapFileSystem) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this OntapFileSystem +func (tr *OntapFileSystem) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this OntapFileSystem +func (tr *OntapFileSystem) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this OntapFileSystem +func (tr *OntapFileSystem) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this OntapFileSystem +func (tr *OntapFileSystem) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this OntapFileSystem +func (tr *OntapFileSystem) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this OntapFileSystem +func (tr *OntapFileSystem) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this OntapFileSystem using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *OntapFileSystem) LateInitialize(attrs []byte) (bool, error) { + params := &OntapFileSystemParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *OntapFileSystem) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/fsx/v1beta1/zz_ontapfilesystem_types.go b/apis/fsx/v1beta1/zz_ontapfilesystem_types.go index a74ad72ca2..047d3decb8 100755 --- a/apis/fsx/v1beta1/zz_ontapfilesystem_types.go +++ b/apis/fsx/v1beta1/zz_ontapfilesystem_types.go @@ -401,13 +401,14 @@ type OntapFileSystemStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // OntapFileSystem is the Schema for the OntapFileSystems API. Manages an Amazon FSx for NetApp ONTAP file system. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type OntapFileSystem struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/fsx/v1beta1/zz_ontapstoragevirtualmachine_terraformed.go b/apis/fsx/v1beta1/zz_ontapstoragevirtualmachine_terraformed.go new file mode 100755 index 0000000000..ac30cb46ae --- /dev/null +++ b/apis/fsx/v1beta1/zz_ontapstoragevirtualmachine_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this OntapStorageVirtualMachine +func (mg *OntapStorageVirtualMachine) GetTerraformResourceType() string { + return "aws_fsx_ontap_storage_virtual_machine" +} + +// GetConnectionDetailsMapping for this OntapStorageVirtualMachine +func (tr *OntapStorageVirtualMachine) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"active_directory_configuration[*].self_managed_active_directory_configuration[*].password": "spec.forProvider.activeDirectoryConfiguration[*].selfManagedActiveDirectoryConfiguration[*].passwordSecretRef", "svm_admin_password": "spec.forProvider.svmAdminPasswordSecretRef"} +} + +// GetObservation of this OntapStorageVirtualMachine +func (tr *OntapStorageVirtualMachine) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this OntapStorageVirtualMachine +func (tr *OntapStorageVirtualMachine) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this OntapStorageVirtualMachine +func (tr *OntapStorageVirtualMachine) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this OntapStorageVirtualMachine +func (tr *OntapStorageVirtualMachine) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this OntapStorageVirtualMachine +func (tr *OntapStorageVirtualMachine) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this OntapStorageVirtualMachine +func (tr *OntapStorageVirtualMachine) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this OntapStorageVirtualMachine +func (tr *OntapStorageVirtualMachine) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this OntapStorageVirtualMachine using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *OntapStorageVirtualMachine) LateInitialize(attrs []byte) (bool, error) { + params := &OntapStorageVirtualMachineParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *OntapStorageVirtualMachine) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/fsx/v1beta1/zz_ontapstoragevirtualmachine_types.go b/apis/fsx/v1beta1/zz_ontapstoragevirtualmachine_types.go index f8c16a5c42..2d5d7336e5 100755 --- a/apis/fsx/v1beta1/zz_ontapstoragevirtualmachine_types.go +++ b/apis/fsx/v1beta1/zz_ontapstoragevirtualmachine_types.go @@ -330,13 +330,14 @@ type OntapStorageVirtualMachineStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // OntapStorageVirtualMachine is the Schema for the OntapStorageVirtualMachines API. Manages a FSx Storage Virtual Machine. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type OntapStorageVirtualMachine struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/fsx/v1beta1/zz_windowsfilesystem_terraformed.go b/apis/fsx/v1beta1/zz_windowsfilesystem_terraformed.go new file mode 100755 index 0000000000..490215c1bf --- /dev/null +++ b/apis/fsx/v1beta1/zz_windowsfilesystem_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this WindowsFileSystem +func (mg *WindowsFileSystem) GetTerraformResourceType() string { + return "aws_fsx_windows_file_system" +} + +// GetConnectionDetailsMapping for this WindowsFileSystem +func (tr *WindowsFileSystem) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"self_managed_active_directory[*].password": "spec.forProvider.selfManagedActiveDirectory[*].passwordSecretRef"} +} + +// GetObservation of this WindowsFileSystem +func (tr *WindowsFileSystem) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this WindowsFileSystem +func (tr *WindowsFileSystem) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this WindowsFileSystem +func (tr *WindowsFileSystem) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this WindowsFileSystem +func (tr *WindowsFileSystem) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this WindowsFileSystem +func (tr *WindowsFileSystem) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this WindowsFileSystem +func (tr *WindowsFileSystem) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this WindowsFileSystem +func (tr *WindowsFileSystem) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this WindowsFileSystem using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *WindowsFileSystem) LateInitialize(attrs []byte) (bool, error) { + params := &WindowsFileSystemParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *WindowsFileSystem) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/fsx/v1beta1/zz_windowsfilesystem_types.go b/apis/fsx/v1beta1/zz_windowsfilesystem_types.go index 619fc5dd00..53b5fab994 100755 --- a/apis/fsx/v1beta1/zz_windowsfilesystem_types.go +++ b/apis/fsx/v1beta1/zz_windowsfilesystem_types.go @@ -472,13 +472,14 @@ type WindowsFileSystemStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // WindowsFileSystem is the Schema for the WindowsFileSystems API. Manages a FSx Windows File System. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type WindowsFileSystem struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/gamelift/v1beta1/zz_alias_terraformed.go b/apis/gamelift/v1beta1/zz_alias_terraformed.go new file mode 100755 index 0000000000..4bb96c2752 --- /dev/null +++ b/apis/gamelift/v1beta1/zz_alias_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Alias +func (mg *Alias) GetTerraformResourceType() string { + return "aws_gamelift_alias" +} + +// GetConnectionDetailsMapping for this Alias +func (tr *Alias) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Alias +func (tr *Alias) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Alias +func (tr *Alias) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Alias +func (tr *Alias) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Alias +func (tr *Alias) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Alias +func (tr *Alias) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Alias +func (tr *Alias) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Alias +func (tr *Alias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Alias using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Alias) LateInitialize(attrs []byte) (bool, error) { + params := &AliasParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Alias) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/gamelift/v1beta1/zz_alias_types.go b/apis/gamelift/v1beta1/zz_alias_types.go index 5e07d004f1..416a6ec22c 100755 --- a/apis/gamelift/v1beta1/zz_alias_types.go +++ b/apis/gamelift/v1beta1/zz_alias_types.go @@ -147,13 +147,14 @@ type AliasStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Alias is the Schema for the Aliass API. Provides a GameLift Alias resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Alias struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/gamelift/v1beta1/zz_build_terraformed.go b/apis/gamelift/v1beta1/zz_build_terraformed.go new file mode 100755 index 0000000000..dc3fa95e2d --- /dev/null +++ b/apis/gamelift/v1beta1/zz_build_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Build +func (mg *Build) GetTerraformResourceType() string { + return "aws_gamelift_build" +} + +// GetConnectionDetailsMapping for this Build +func (tr *Build) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Build +func (tr *Build) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Build +func (tr *Build) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Build +func (tr *Build) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Build +func (tr *Build) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Build +func (tr *Build) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Build +func (tr *Build) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Build +func (tr *Build) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Build using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Build) LateInitialize(attrs []byte) (bool, error) { + params := &BuildParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Build) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/gamelift/v1beta1/zz_build_types.go b/apis/gamelift/v1beta1/zz_build_types.go index 90fe8a1447..43378600ab 100755 --- a/apis/gamelift/v1beta1/zz_build_types.go +++ b/apis/gamelift/v1beta1/zz_build_types.go @@ -225,13 +225,14 @@ type BuildStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Build is the Schema for the Builds API. Provides a GameLift Build resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Build struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/gamelift/v1beta1/zz_fleet_terraformed.go b/apis/gamelift/v1beta1/zz_fleet_terraformed.go new file mode 100755 index 0000000000..bcfe0e1144 --- /dev/null +++ b/apis/gamelift/v1beta1/zz_fleet_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Fleet +func (mg *Fleet) GetTerraformResourceType() string { + return "aws_gamelift_fleet" +} + +// GetConnectionDetailsMapping for this Fleet +func (tr *Fleet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Fleet +func (tr *Fleet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Fleet +func (tr *Fleet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Fleet +func (tr *Fleet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Fleet +func (tr *Fleet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Fleet +func (tr *Fleet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Fleet +func (tr *Fleet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Fleet +func (tr *Fleet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Fleet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Fleet) LateInitialize(attrs []byte) (bool, error) { + params := &FleetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Fleet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/gamelift/v1beta1/zz_fleet_types.go b/apis/gamelift/v1beta1/zz_fleet_types.go index c02eea36cf..9fc6cb2fa4 100755 --- a/apis/gamelift/v1beta1/zz_fleet_types.go +++ b/apis/gamelift/v1beta1/zz_fleet_types.go @@ -432,13 +432,14 @@ type FleetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Fleet is the Schema for the Fleets API. Provides a GameLift Fleet resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws},path=fleet type Fleet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/gamelift/v1beta1/zz_gamesessionqueue_terraformed.go b/apis/gamelift/v1beta1/zz_gamesessionqueue_terraformed.go new file mode 100755 index 0000000000..30b1ba65e1 --- /dev/null +++ b/apis/gamelift/v1beta1/zz_gamesessionqueue_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GameSessionQueue +func (mg *GameSessionQueue) GetTerraformResourceType() string { + return "aws_gamelift_game_session_queue" +} + +// GetConnectionDetailsMapping for this GameSessionQueue +func (tr *GameSessionQueue) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GameSessionQueue +func (tr *GameSessionQueue) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GameSessionQueue +func (tr *GameSessionQueue) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GameSessionQueue +func (tr *GameSessionQueue) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GameSessionQueue +func (tr *GameSessionQueue) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GameSessionQueue +func (tr *GameSessionQueue) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GameSessionQueue +func (tr *GameSessionQueue) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GameSessionQueue +func (tr *GameSessionQueue) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GameSessionQueue using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GameSessionQueue) LateInitialize(attrs []byte) (bool, error) { + params := &GameSessionQueueParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GameSessionQueue) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/gamelift/v1beta1/zz_gamesessionqueue_types.go b/apis/gamelift/v1beta1/zz_gamesessionqueue_types.go index 14e8cf2a58..323c0cce3f 100755 --- a/apis/gamelift/v1beta1/zz_gamesessionqueue_types.go +++ b/apis/gamelift/v1beta1/zz_gamesessionqueue_types.go @@ -176,13 +176,14 @@ type GameSessionQueueStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GameSessionQueue is the Schema for the GameSessionQueues API. Provides a GameLift Game Session Queue resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GameSessionQueue struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/gamelift/v1beta1/zz_generated.conversion_hubs.go b/apis/gamelift/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..1fa384f7c3 --- /dev/null +++ b/apis/gamelift/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Alias) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Build) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Fleet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GameSessionQueue) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Script) Hub() {} diff --git a/apis/gamelift/v1beta1/zz_generated_terraformed.go b/apis/gamelift/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 8af62e46aa..0000000000 --- a/apis/gamelift/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,589 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Alias -func (mg *Alias) GetTerraformResourceType() string { - return "aws_gamelift_alias" -} - -// GetConnectionDetailsMapping for this Alias -func (tr *Alias) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Alias -func (tr *Alias) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Alias -func (tr *Alias) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Alias -func (tr *Alias) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Alias -func (tr *Alias) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Alias -func (tr *Alias) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Alias -func (tr *Alias) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Alias -func (tr *Alias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Alias using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Alias) LateInitialize(attrs []byte) (bool, error) { - params := &AliasParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Alias) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Build -func (mg *Build) GetTerraformResourceType() string { - return "aws_gamelift_build" -} - -// GetConnectionDetailsMapping for this Build -func (tr *Build) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Build -func (tr *Build) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Build -func (tr *Build) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Build -func (tr *Build) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Build -func (tr *Build) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Build -func (tr *Build) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Build -func (tr *Build) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Build -func (tr *Build) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Build using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Build) LateInitialize(attrs []byte) (bool, error) { - params := &BuildParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Build) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Fleet -func (mg *Fleet) GetTerraformResourceType() string { - return "aws_gamelift_fleet" -} - -// GetConnectionDetailsMapping for this Fleet -func (tr *Fleet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Fleet -func (tr *Fleet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Fleet -func (tr *Fleet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Fleet -func (tr *Fleet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Fleet -func (tr *Fleet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Fleet -func (tr *Fleet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Fleet -func (tr *Fleet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Fleet -func (tr *Fleet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Fleet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Fleet) LateInitialize(attrs []byte) (bool, error) { - params := &FleetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Fleet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GameSessionQueue -func (mg *GameSessionQueue) GetTerraformResourceType() string { - return "aws_gamelift_game_session_queue" -} - -// GetConnectionDetailsMapping for this GameSessionQueue -func (tr *GameSessionQueue) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GameSessionQueue -func (tr *GameSessionQueue) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GameSessionQueue -func (tr *GameSessionQueue) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GameSessionQueue -func (tr *GameSessionQueue) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GameSessionQueue -func (tr *GameSessionQueue) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GameSessionQueue -func (tr *GameSessionQueue) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GameSessionQueue -func (tr *GameSessionQueue) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GameSessionQueue -func (tr *GameSessionQueue) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GameSessionQueue using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GameSessionQueue) LateInitialize(attrs []byte) (bool, error) { - params := &GameSessionQueueParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GameSessionQueue) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Script -func (mg *Script) GetTerraformResourceType() string { - return "aws_gamelift_script" -} - -// GetConnectionDetailsMapping for this Script -func (tr *Script) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Script -func (tr *Script) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Script -func (tr *Script) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Script -func (tr *Script) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Script -func (tr *Script) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Script -func (tr *Script) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Script -func (tr *Script) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Script -func (tr *Script) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Script using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Script) LateInitialize(attrs []byte) (bool, error) { - params := &ScriptParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Script) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/gamelift/v1beta1/zz_script_terraformed.go b/apis/gamelift/v1beta1/zz_script_terraformed.go new file mode 100755 index 0000000000..3e846a0cd3 --- /dev/null +++ b/apis/gamelift/v1beta1/zz_script_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Script +func (mg *Script) GetTerraformResourceType() string { + return "aws_gamelift_script" +} + +// GetConnectionDetailsMapping for this Script +func (tr *Script) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Script +func (tr *Script) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Script +func (tr *Script) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Script +func (tr *Script) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Script +func (tr *Script) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Script +func (tr *Script) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Script +func (tr *Script) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Script +func (tr *Script) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Script using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Script) LateInitialize(attrs []byte) (bool, error) { + params := &ScriptParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Script) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/gamelift/v1beta1/zz_script_types.go b/apis/gamelift/v1beta1/zz_script_types.go index ffa1fbac39..99292a27e3 100755 --- a/apis/gamelift/v1beta1/zz_script_types.go +++ b/apis/gamelift/v1beta1/zz_script_types.go @@ -225,13 +225,14 @@ type ScriptStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Script is the Schema for the Scripts API. Provides a GameLift Script resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Script struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glacier/v1beta1/zz_generated.conversion_hubs.go b/apis/glacier/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..43a344e820 --- /dev/null +++ b/apis/glacier/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Vault) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VaultLock) Hub() {} diff --git a/apis/glacier/v1beta1/zz_vault_terraformed.go b/apis/glacier/v1beta1/zz_vault_terraformed.go new file mode 100755 index 0000000000..0ee29b093d --- /dev/null +++ b/apis/glacier/v1beta1/zz_vault_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Vault +func (mg *Vault) GetTerraformResourceType() string { + return "aws_glacier_vault" +} + +// GetConnectionDetailsMapping for this Vault +func (tr *Vault) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Vault +func (tr *Vault) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Vault +func (tr *Vault) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Vault +func (tr *Vault) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Vault +func (tr *Vault) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Vault +func (tr *Vault) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Vault +func (tr *Vault) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Vault +func (tr *Vault) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Vault using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Vault) LateInitialize(attrs []byte) (bool, error) { + params := &VaultParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Vault) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glacier/v1beta1/zz_vault_types.go b/apis/glacier/v1beta1/zz_vault_types.go index 5cfd5fb050..387da7d81f 100755 --- a/apis/glacier/v1beta1/zz_vault_types.go +++ b/apis/glacier/v1beta1/zz_vault_types.go @@ -155,13 +155,14 @@ type VaultStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Vault is the Schema for the Vaults API. Provides a Glacier Vault. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Vault struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glacier/v1beta1/zz_generated_terraformed.go b/apis/glacier/v1beta1/zz_vaultlock_terraformed.go similarity index 53% rename from apis/glacier/v1beta1/zz_generated_terraformed.go rename to apis/glacier/v1beta1/zz_vaultlock_terraformed.go index 5f499145e0..1e7b5be806 100755 --- a/apis/glacier/v1beta1/zz_generated_terraformed.go +++ b/apis/glacier/v1beta1/zz_vaultlock_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Vault -func (mg *Vault) GetTerraformResourceType() string { - return "aws_glacier_vault" -} - -// GetConnectionDetailsMapping for this Vault -func (tr *Vault) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Vault -func (tr *Vault) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Vault -func (tr *Vault) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Vault -func (tr *Vault) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Vault -func (tr *Vault) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Vault -func (tr *Vault) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Vault -func (tr *Vault) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Vault -func (tr *Vault) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Vault using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Vault) LateInitialize(attrs []byte) (bool, error) { - params := &VaultParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Vault) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this VaultLock func (mg *VaultLock) GetTerraformResourceType() string { return "aws_glacier_vault_lock" diff --git a/apis/glacier/v1beta1/zz_vaultlock_types.go b/apis/glacier/v1beta1/zz_vaultlock_types.go index 24ad234543..2834fc6e91 100755 --- a/apis/glacier/v1beta1/zz_vaultlock_types.go +++ b/apis/glacier/v1beta1/zz_vaultlock_types.go @@ -116,13 +116,14 @@ type VaultLockStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VaultLock is the Schema for the VaultLocks API. Manages a Glacier Vault Lock. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VaultLock struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/globalaccelerator/v1beta1/zz_accelerator_terraformed.go b/apis/globalaccelerator/v1beta1/zz_accelerator_terraformed.go new file mode 100755 index 0000000000..23447da580 --- /dev/null +++ b/apis/globalaccelerator/v1beta1/zz_accelerator_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Accelerator +func (mg *Accelerator) GetTerraformResourceType() string { + return "aws_globalaccelerator_accelerator" +} + +// GetConnectionDetailsMapping for this Accelerator +func (tr *Accelerator) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Accelerator +func (tr *Accelerator) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Accelerator +func (tr *Accelerator) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Accelerator +func (tr *Accelerator) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Accelerator +func (tr *Accelerator) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Accelerator +func (tr *Accelerator) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Accelerator +func (tr *Accelerator) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Accelerator +func (tr *Accelerator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Accelerator using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Accelerator) LateInitialize(attrs []byte) (bool, error) { + params := &AcceleratorParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Accelerator) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/globalaccelerator/v1beta1/zz_accelerator_types.go b/apis/globalaccelerator/v1beta1/zz_accelerator_types.go index 7e10482a6c..a61fd0488b 100755 --- a/apis/globalaccelerator/v1beta1/zz_accelerator_types.go +++ b/apis/globalaccelerator/v1beta1/zz_accelerator_types.go @@ -193,13 +193,14 @@ type AcceleratorStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Accelerator is the Schema for the Accelerators API. Provides a Global Accelerator accelerator. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Accelerator struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/globalaccelerator/v1beta1/zz_endpointgroup_terraformed.go b/apis/globalaccelerator/v1beta1/zz_endpointgroup_terraformed.go new file mode 100755 index 0000000000..7f68684439 --- /dev/null +++ b/apis/globalaccelerator/v1beta1/zz_endpointgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EndpointGroup +func (mg *EndpointGroup) GetTerraformResourceType() string { + return "aws_globalaccelerator_endpoint_group" +} + +// GetConnectionDetailsMapping for this EndpointGroup +func (tr *EndpointGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EndpointGroup +func (tr *EndpointGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EndpointGroup +func (tr *EndpointGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EndpointGroup +func (tr *EndpointGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EndpointGroup +func (tr *EndpointGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EndpointGroup +func (tr *EndpointGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EndpointGroup +func (tr *EndpointGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EndpointGroup +func (tr *EndpointGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EndpointGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EndpointGroup) LateInitialize(attrs []byte) (bool, error) { + params := &EndpointGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EndpointGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/globalaccelerator/v1beta1/zz_endpointgroup_types.go b/apis/globalaccelerator/v1beta1/zz_endpointgroup_types.go index 645d5dc0a6..b4421ff9d2 100755 --- a/apis/globalaccelerator/v1beta1/zz_endpointgroup_types.go +++ b/apis/globalaccelerator/v1beta1/zz_endpointgroup_types.go @@ -247,13 +247,14 @@ type EndpointGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EndpointGroup is the Schema for the EndpointGroups API. Provides a Global Accelerator endpoint group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EndpointGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/globalaccelerator/v1beta1/zz_generated.conversion_hubs.go b/apis/globalaccelerator/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..75952764e9 --- /dev/null +++ b/apis/globalaccelerator/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Accelerator) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EndpointGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Listener) Hub() {} diff --git a/apis/globalaccelerator/v1beta1/zz_generated_terraformed.go b/apis/globalaccelerator/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index ca2038801e..0000000000 --- a/apis/globalaccelerator/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Accelerator -func (mg *Accelerator) GetTerraformResourceType() string { - return "aws_globalaccelerator_accelerator" -} - -// GetConnectionDetailsMapping for this Accelerator -func (tr *Accelerator) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Accelerator -func (tr *Accelerator) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Accelerator -func (tr *Accelerator) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Accelerator -func (tr *Accelerator) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Accelerator -func (tr *Accelerator) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Accelerator -func (tr *Accelerator) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Accelerator -func (tr *Accelerator) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Accelerator -func (tr *Accelerator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Accelerator using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Accelerator) LateInitialize(attrs []byte) (bool, error) { - params := &AcceleratorParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Accelerator) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EndpointGroup -func (mg *EndpointGroup) GetTerraformResourceType() string { - return "aws_globalaccelerator_endpoint_group" -} - -// GetConnectionDetailsMapping for this EndpointGroup -func (tr *EndpointGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EndpointGroup -func (tr *EndpointGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EndpointGroup -func (tr *EndpointGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EndpointGroup -func (tr *EndpointGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EndpointGroup -func (tr *EndpointGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EndpointGroup -func (tr *EndpointGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EndpointGroup -func (tr *EndpointGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EndpointGroup -func (tr *EndpointGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EndpointGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EndpointGroup) LateInitialize(attrs []byte) (bool, error) { - params := &EndpointGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EndpointGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Listener -func (mg *Listener) GetTerraformResourceType() string { - return "aws_globalaccelerator_listener" -} - -// GetConnectionDetailsMapping for this Listener -func (tr *Listener) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Listener -func (tr *Listener) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Listener -func (tr *Listener) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Listener -func (tr *Listener) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Listener -func (tr *Listener) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Listener -func (tr *Listener) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Listener -func (tr *Listener) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Listener -func (tr *Listener) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Listener using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Listener) LateInitialize(attrs []byte) (bool, error) { - params := &ListenerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Listener) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/globalaccelerator/v1beta1/zz_listener_terraformed.go b/apis/globalaccelerator/v1beta1/zz_listener_terraformed.go new file mode 100755 index 0000000000..cf6dc3265b --- /dev/null +++ b/apis/globalaccelerator/v1beta1/zz_listener_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Listener +func (mg *Listener) GetTerraformResourceType() string { + return "aws_globalaccelerator_listener" +} + +// GetConnectionDetailsMapping for this Listener +func (tr *Listener) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Listener +func (tr *Listener) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Listener +func (tr *Listener) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Listener +func (tr *Listener) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Listener +func (tr *Listener) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Listener +func (tr *Listener) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Listener +func (tr *Listener) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Listener +func (tr *Listener) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Listener using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Listener) LateInitialize(attrs []byte) (bool, error) { + params := &ListenerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Listener) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/globalaccelerator/v1beta1/zz_listener_types.go b/apis/globalaccelerator/v1beta1/zz_listener_types.go index b20b955eb9..ed659f5597 100755 --- a/apis/globalaccelerator/v1beta1/zz_listener_types.go +++ b/apis/globalaccelerator/v1beta1/zz_listener_types.go @@ -145,13 +145,14 @@ type ListenerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Listener is the Schema for the Listeners API. Provides a Global Accelerator listener. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Listener struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_catalogdatabase_terraformed.go b/apis/glue/v1beta1/zz_catalogdatabase_terraformed.go new file mode 100755 index 0000000000..4ec7c3ccde --- /dev/null +++ b/apis/glue/v1beta1/zz_catalogdatabase_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CatalogDatabase +func (mg *CatalogDatabase) GetTerraformResourceType() string { + return "aws_glue_catalog_database" +} + +// GetConnectionDetailsMapping for this CatalogDatabase +func (tr *CatalogDatabase) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CatalogDatabase +func (tr *CatalogDatabase) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CatalogDatabase +func (tr *CatalogDatabase) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CatalogDatabase +func (tr *CatalogDatabase) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CatalogDatabase +func (tr *CatalogDatabase) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CatalogDatabase +func (tr *CatalogDatabase) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CatalogDatabase +func (tr *CatalogDatabase) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CatalogDatabase +func (tr *CatalogDatabase) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CatalogDatabase using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CatalogDatabase) LateInitialize(attrs []byte) (bool, error) { + params := &CatalogDatabaseParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CatalogDatabase) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_catalogdatabase_types.go b/apis/glue/v1beta1/zz_catalogdatabase_types.go index ac953c3202..1fb7b41bbc 100755 --- a/apis/glue/v1beta1/zz_catalogdatabase_types.go +++ b/apis/glue/v1beta1/zz_catalogdatabase_types.go @@ -215,13 +215,14 @@ type CatalogDatabaseStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CatalogDatabase is the Schema for the CatalogDatabases API. Provides a Glue Catalog Database. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CatalogDatabase struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_catalogtable_terraformed.go b/apis/glue/v1beta1/zz_catalogtable_terraformed.go new file mode 100755 index 0000000000..9155080283 --- /dev/null +++ b/apis/glue/v1beta1/zz_catalogtable_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CatalogTable +func (mg *CatalogTable) GetTerraformResourceType() string { + return "aws_glue_catalog_table" +} + +// GetConnectionDetailsMapping for this CatalogTable +func (tr *CatalogTable) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CatalogTable +func (tr *CatalogTable) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CatalogTable +func (tr *CatalogTable) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CatalogTable +func (tr *CatalogTable) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CatalogTable +func (tr *CatalogTable) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CatalogTable +func (tr *CatalogTable) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CatalogTable +func (tr *CatalogTable) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CatalogTable +func (tr *CatalogTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CatalogTable using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CatalogTable) LateInitialize(attrs []byte) (bool, error) { + params := &CatalogTableParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CatalogTable) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_catalogtable_types.go b/apis/glue/v1beta1/zz_catalogtable_types.go index 6e5e784931..fa49af22e6 100755 --- a/apis/glue/v1beta1/zz_catalogtable_types.go +++ b/apis/glue/v1beta1/zz_catalogtable_types.go @@ -685,13 +685,14 @@ type CatalogTableStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CatalogTable is the Schema for the CatalogTables API. Provides a Glue Catalog Table. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CatalogTable struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_classifier_terraformed.go b/apis/glue/v1beta1/zz_classifier_terraformed.go new file mode 100755 index 0000000000..2f4db76162 --- /dev/null +++ b/apis/glue/v1beta1/zz_classifier_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Classifier +func (mg *Classifier) GetTerraformResourceType() string { + return "aws_glue_classifier" +} + +// GetConnectionDetailsMapping for this Classifier +func (tr *Classifier) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Classifier +func (tr *Classifier) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Classifier +func (tr *Classifier) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Classifier +func (tr *Classifier) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Classifier +func (tr *Classifier) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Classifier +func (tr *Classifier) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Classifier +func (tr *Classifier) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Classifier +func (tr *Classifier) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Classifier using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Classifier) LateInitialize(attrs []byte) (bool, error) { + params := &ClassifierParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Classifier) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_classifier_types.go b/apis/glue/v1beta1/zz_classifier_types.go index 865ca0dad0..e41e07bf0a 100755 --- a/apis/glue/v1beta1/zz_classifier_types.go +++ b/apis/glue/v1beta1/zz_classifier_types.go @@ -274,13 +274,14 @@ type ClassifierStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Classifier is the Schema for the Classifiers API. Provides an Glue Classifier resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Classifier struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_connection_terraformed.go b/apis/glue/v1beta1/zz_connection_terraformed.go new file mode 100755 index 0000000000..eca2a156a8 --- /dev/null +++ b/apis/glue/v1beta1/zz_connection_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Connection +func (mg *Connection) GetTerraformResourceType() string { + return "aws_glue_connection" +} + +// GetConnectionDetailsMapping for this Connection +func (tr *Connection) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"connection_properties": "spec.forProvider.connectionPropertiesSecretRef"} +} + +// GetObservation of this Connection +func (tr *Connection) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Connection +func (tr *Connection) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Connection +func (tr *Connection) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Connection +func (tr *Connection) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Connection +func (tr *Connection) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Connection +func (tr *Connection) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Connection +func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Connection using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { + params := &ConnectionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Connection) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_connection_types.go b/apis/glue/v1beta1/zz_connection_types.go index ad9ff30f4d..938794ec5c 100755 --- a/apis/glue/v1beta1/zz_connection_types.go +++ b/apis/glue/v1beta1/zz_connection_types.go @@ -211,13 +211,14 @@ type ConnectionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Connection is the Schema for the Connections API. Provides an Glue Connection resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Connection struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_crawler_terraformed.go b/apis/glue/v1beta1/zz_crawler_terraformed.go new file mode 100755 index 0000000000..3758b09da2 --- /dev/null +++ b/apis/glue/v1beta1/zz_crawler_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Crawler +func (mg *Crawler) GetTerraformResourceType() string { + return "aws_glue_crawler" +} + +// GetConnectionDetailsMapping for this Crawler +func (tr *Crawler) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Crawler +func (tr *Crawler) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Crawler +func (tr *Crawler) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Crawler +func (tr *Crawler) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Crawler +func (tr *Crawler) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Crawler +func (tr *Crawler) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Crawler +func (tr *Crawler) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Crawler +func (tr *Crawler) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Crawler using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Crawler) LateInitialize(attrs []byte) (bool, error) { + params := &CrawlerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Crawler) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_crawler_types.go b/apis/glue/v1beta1/zz_crawler_types.go index 1b85276bbd..cf0df5eec0 100755 --- a/apis/glue/v1beta1/zz_crawler_types.go +++ b/apis/glue/v1beta1/zz_crawler_types.go @@ -746,13 +746,14 @@ type CrawlerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Crawler is the Schema for the Crawlers API. Manages a Glue Crawler // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Crawler struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_datacatalogencryptionsettings_terraformed.go b/apis/glue/v1beta1/zz_datacatalogencryptionsettings_terraformed.go new file mode 100755 index 0000000000..784c72828c --- /dev/null +++ b/apis/glue/v1beta1/zz_datacatalogencryptionsettings_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DataCatalogEncryptionSettings +func (mg *DataCatalogEncryptionSettings) GetTerraformResourceType() string { + return "aws_glue_data_catalog_encryption_settings" +} + +// GetConnectionDetailsMapping for this DataCatalogEncryptionSettings +func (tr *DataCatalogEncryptionSettings) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DataCatalogEncryptionSettings +func (tr *DataCatalogEncryptionSettings) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DataCatalogEncryptionSettings +func (tr *DataCatalogEncryptionSettings) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DataCatalogEncryptionSettings +func (tr *DataCatalogEncryptionSettings) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DataCatalogEncryptionSettings +func (tr *DataCatalogEncryptionSettings) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DataCatalogEncryptionSettings +func (tr *DataCatalogEncryptionSettings) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DataCatalogEncryptionSettings +func (tr *DataCatalogEncryptionSettings) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DataCatalogEncryptionSettings +func (tr *DataCatalogEncryptionSettings) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DataCatalogEncryptionSettings using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DataCatalogEncryptionSettings) LateInitialize(attrs []byte) (bool, error) { + params := &DataCatalogEncryptionSettingsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DataCatalogEncryptionSettings) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_datacatalogencryptionsettings_types.go b/apis/glue/v1beta1/zz_datacatalogencryptionsettings_types.go index c3a9127a6f..f9adca73ce 100755 --- a/apis/glue/v1beta1/zz_datacatalogencryptionsettings_types.go +++ b/apis/glue/v1beta1/zz_datacatalogencryptionsettings_types.go @@ -205,13 +205,14 @@ type DataCatalogEncryptionSettingsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DataCatalogEncryptionSettings is the Schema for the DataCatalogEncryptionSettingss API. Provides a Glue Data Catalog Encryption Settings resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DataCatalogEncryptionSettings struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_generated.conversion_hubs.go b/apis/glue/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..978ee1b334 --- /dev/null +++ b/apis/glue/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *CatalogDatabase) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CatalogTable) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Classifier) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Connection) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Crawler) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DataCatalogEncryptionSettings) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Job) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Registry) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResourcePolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Schema) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SecurityConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Trigger) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserDefinedFunction) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Workflow) Hub() {} diff --git a/apis/glue/v1beta1/zz_generated_terraformed.go b/apis/glue/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 4b712dae0f..0000000000 --- a/apis/glue/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1618 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this CatalogDatabase -func (mg *CatalogDatabase) GetTerraformResourceType() string { - return "aws_glue_catalog_database" -} - -// GetConnectionDetailsMapping for this CatalogDatabase -func (tr *CatalogDatabase) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CatalogDatabase -func (tr *CatalogDatabase) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CatalogDatabase -func (tr *CatalogDatabase) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CatalogDatabase -func (tr *CatalogDatabase) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CatalogDatabase -func (tr *CatalogDatabase) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CatalogDatabase -func (tr *CatalogDatabase) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CatalogDatabase -func (tr *CatalogDatabase) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CatalogDatabase -func (tr *CatalogDatabase) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CatalogDatabase using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CatalogDatabase) LateInitialize(attrs []byte) (bool, error) { - params := &CatalogDatabaseParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CatalogDatabase) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CatalogTable -func (mg *CatalogTable) GetTerraformResourceType() string { - return "aws_glue_catalog_table" -} - -// GetConnectionDetailsMapping for this CatalogTable -func (tr *CatalogTable) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CatalogTable -func (tr *CatalogTable) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CatalogTable -func (tr *CatalogTable) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CatalogTable -func (tr *CatalogTable) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CatalogTable -func (tr *CatalogTable) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CatalogTable -func (tr *CatalogTable) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CatalogTable -func (tr *CatalogTable) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CatalogTable -func (tr *CatalogTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CatalogTable using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CatalogTable) LateInitialize(attrs []byte) (bool, error) { - params := &CatalogTableParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CatalogTable) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Classifier -func (mg *Classifier) GetTerraformResourceType() string { - return "aws_glue_classifier" -} - -// GetConnectionDetailsMapping for this Classifier -func (tr *Classifier) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Classifier -func (tr *Classifier) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Classifier -func (tr *Classifier) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Classifier -func (tr *Classifier) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Classifier -func (tr *Classifier) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Classifier -func (tr *Classifier) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Classifier -func (tr *Classifier) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Classifier -func (tr *Classifier) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Classifier using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Classifier) LateInitialize(attrs []byte) (bool, error) { - params := &ClassifierParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Classifier) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Connection -func (mg *Connection) GetTerraformResourceType() string { - return "aws_glue_connection" -} - -// GetConnectionDetailsMapping for this Connection -func (tr *Connection) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"connection_properties": "spec.forProvider.connectionPropertiesSecretRef"} -} - -// GetObservation of this Connection -func (tr *Connection) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Connection -func (tr *Connection) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Connection -func (tr *Connection) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Connection -func (tr *Connection) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Connection -func (tr *Connection) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Connection -func (tr *Connection) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Connection -func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Connection using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { - params := &ConnectionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Connection) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Crawler -func (mg *Crawler) GetTerraformResourceType() string { - return "aws_glue_crawler" -} - -// GetConnectionDetailsMapping for this Crawler -func (tr *Crawler) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Crawler -func (tr *Crawler) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Crawler -func (tr *Crawler) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Crawler -func (tr *Crawler) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Crawler -func (tr *Crawler) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Crawler -func (tr *Crawler) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Crawler -func (tr *Crawler) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Crawler -func (tr *Crawler) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Crawler using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Crawler) LateInitialize(attrs []byte) (bool, error) { - params := &CrawlerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Crawler) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DataCatalogEncryptionSettings -func (mg *DataCatalogEncryptionSettings) GetTerraformResourceType() string { - return "aws_glue_data_catalog_encryption_settings" -} - -// GetConnectionDetailsMapping for this DataCatalogEncryptionSettings -func (tr *DataCatalogEncryptionSettings) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DataCatalogEncryptionSettings -func (tr *DataCatalogEncryptionSettings) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DataCatalogEncryptionSettings -func (tr *DataCatalogEncryptionSettings) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DataCatalogEncryptionSettings -func (tr *DataCatalogEncryptionSettings) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DataCatalogEncryptionSettings -func (tr *DataCatalogEncryptionSettings) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DataCatalogEncryptionSettings -func (tr *DataCatalogEncryptionSettings) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DataCatalogEncryptionSettings -func (tr *DataCatalogEncryptionSettings) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DataCatalogEncryptionSettings -func (tr *DataCatalogEncryptionSettings) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DataCatalogEncryptionSettings using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DataCatalogEncryptionSettings) LateInitialize(attrs []byte) (bool, error) { - params := &DataCatalogEncryptionSettingsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DataCatalogEncryptionSettings) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Job -func (mg *Job) GetTerraformResourceType() string { - return "aws_glue_job" -} - -// GetConnectionDetailsMapping for this Job -func (tr *Job) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Job -func (tr *Job) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Job -func (tr *Job) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Job -func (tr *Job) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Job -func (tr *Job) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Job -func (tr *Job) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Job -func (tr *Job) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Job -func (tr *Job) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Job using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Job) LateInitialize(attrs []byte) (bool, error) { - params := &JobParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("MaxCapacity")) - opts = append(opts, resource.WithNameFilter("NumberOfWorkers")) - opts = append(opts, resource.WithNameFilter("WorkerType")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Job) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Registry -func (mg *Registry) GetTerraformResourceType() string { - return "aws_glue_registry" -} - -// GetConnectionDetailsMapping for this Registry -func (tr *Registry) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Registry -func (tr *Registry) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Registry -func (tr *Registry) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Registry -func (tr *Registry) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Registry -func (tr *Registry) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Registry -func (tr *Registry) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Registry -func (tr *Registry) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Registry -func (tr *Registry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Registry using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Registry) LateInitialize(attrs []byte) (bool, error) { - params := &RegistryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Registry) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ResourcePolicy -func (mg *ResourcePolicy) GetTerraformResourceType() string { - return "aws_glue_resource_policy" -} - -// GetConnectionDetailsMapping for this ResourcePolicy -func (tr *ResourcePolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResourcePolicy -func (tr *ResourcePolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResourcePolicy -func (tr *ResourcePolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResourcePolicy -func (tr *ResourcePolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResourcePolicy -func (tr *ResourcePolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResourcePolicy -func (tr *ResourcePolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResourcePolicy -func (tr *ResourcePolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResourcePolicy -func (tr *ResourcePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResourcePolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResourcePolicy) LateInitialize(attrs []byte) (bool, error) { - params := &ResourcePolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResourcePolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Schema -func (mg *Schema) GetTerraformResourceType() string { - return "aws_glue_schema" -} - -// GetConnectionDetailsMapping for this Schema -func (tr *Schema) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Schema -func (tr *Schema) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Schema -func (tr *Schema) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Schema -func (tr *Schema) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Schema -func (tr *Schema) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Schema -func (tr *Schema) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Schema -func (tr *Schema) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Schema -func (tr *Schema) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Schema using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Schema) LateInitialize(attrs []byte) (bool, error) { - params := &SchemaParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Schema) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SecurityConfiguration -func (mg *SecurityConfiguration) GetTerraformResourceType() string { - return "aws_glue_security_configuration" -} - -// GetConnectionDetailsMapping for this SecurityConfiguration -func (tr *SecurityConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SecurityConfiguration -func (tr *SecurityConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SecurityConfiguration -func (tr *SecurityConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SecurityConfiguration -func (tr *SecurityConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SecurityConfiguration -func (tr *SecurityConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SecurityConfiguration -func (tr *SecurityConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SecurityConfiguration -func (tr *SecurityConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SecurityConfiguration -func (tr *SecurityConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SecurityConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SecurityConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &SecurityConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SecurityConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Trigger -func (mg *Trigger) GetTerraformResourceType() string { - return "aws_glue_trigger" -} - -// GetConnectionDetailsMapping for this Trigger -func (tr *Trigger) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Trigger -func (tr *Trigger) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Trigger -func (tr *Trigger) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Trigger -func (tr *Trigger) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Trigger -func (tr *Trigger) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Trigger -func (tr *Trigger) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Trigger -func (tr *Trigger) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Trigger -func (tr *Trigger) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Trigger using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Trigger) LateInitialize(attrs []byte) (bool, error) { - params := &TriggerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Trigger) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserDefinedFunction -func (mg *UserDefinedFunction) GetTerraformResourceType() string { - return "aws_glue_user_defined_function" -} - -// GetConnectionDetailsMapping for this UserDefinedFunction -func (tr *UserDefinedFunction) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserDefinedFunction -func (tr *UserDefinedFunction) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserDefinedFunction -func (tr *UserDefinedFunction) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserDefinedFunction -func (tr *UserDefinedFunction) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserDefinedFunction -func (tr *UserDefinedFunction) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserDefinedFunction -func (tr *UserDefinedFunction) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserDefinedFunction -func (tr *UserDefinedFunction) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserDefinedFunction -func (tr *UserDefinedFunction) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserDefinedFunction using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserDefinedFunction) LateInitialize(attrs []byte) (bool, error) { - params := &UserDefinedFunctionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserDefinedFunction) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Workflow -func (mg *Workflow) GetTerraformResourceType() string { - return "aws_glue_workflow" -} - -// GetConnectionDetailsMapping for this Workflow -func (tr *Workflow) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Workflow -func (tr *Workflow) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Workflow -func (tr *Workflow) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Workflow -func (tr *Workflow) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Workflow -func (tr *Workflow) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Workflow -func (tr *Workflow) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Workflow -func (tr *Workflow) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Workflow -func (tr *Workflow) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Workflow using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Workflow) LateInitialize(attrs []byte) (bool, error) { - params := &WorkflowParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Workflow) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/glue/v1beta1/zz_job_terraformed.go b/apis/glue/v1beta1/zz_job_terraformed.go new file mode 100755 index 0000000000..1e45817c33 --- /dev/null +++ b/apis/glue/v1beta1/zz_job_terraformed.go @@ -0,0 +1,136 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Job +func (mg *Job) GetTerraformResourceType() string { + return "aws_glue_job" +} + +// GetConnectionDetailsMapping for this Job +func (tr *Job) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Job +func (tr *Job) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Job +func (tr *Job) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Job +func (tr *Job) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Job +func (tr *Job) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Job +func (tr *Job) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Job +func (tr *Job) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Job +func (tr *Job) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Job using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Job) LateInitialize(attrs []byte) (bool, error) { + params := &JobParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("MaxCapacity")) + opts = append(opts, resource.WithNameFilter("NumberOfWorkers")) + opts = append(opts, resource.WithNameFilter("WorkerType")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Job) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_job_types.go b/apis/glue/v1beta1/zz_job_types.go index e18a686724..231d3a8c00 100755 --- a/apis/glue/v1beta1/zz_job_types.go +++ b/apis/glue/v1beta1/zz_job_types.go @@ -341,13 +341,14 @@ type JobStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Job is the Schema for the Jobs API. Provides an Glue Job resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Job struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_registry_terraformed.go b/apis/glue/v1beta1/zz_registry_terraformed.go new file mode 100755 index 0000000000..01e32fabea --- /dev/null +++ b/apis/glue/v1beta1/zz_registry_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Registry +func (mg *Registry) GetTerraformResourceType() string { + return "aws_glue_registry" +} + +// GetConnectionDetailsMapping for this Registry +func (tr *Registry) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Registry +func (tr *Registry) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Registry +func (tr *Registry) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Registry +func (tr *Registry) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Registry +func (tr *Registry) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Registry +func (tr *Registry) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Registry +func (tr *Registry) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Registry +func (tr *Registry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Registry using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Registry) LateInitialize(attrs []byte) (bool, error) { + params := &RegistryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Registry) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_registry_types.go b/apis/glue/v1beta1/zz_registry_types.go index 75fb801f24..ab15f7f34c 100755 --- a/apis/glue/v1beta1/zz_registry_types.go +++ b/apis/glue/v1beta1/zz_registry_types.go @@ -88,13 +88,14 @@ type RegistryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Registry is the Schema for the Registrys API. Provides a Glue Registry resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Registry struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_resourcepolicy_terraformed.go b/apis/glue/v1beta1/zz_resourcepolicy_terraformed.go new file mode 100755 index 0000000000..309f2c8186 --- /dev/null +++ b/apis/glue/v1beta1/zz_resourcepolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResourcePolicy +func (mg *ResourcePolicy) GetTerraformResourceType() string { + return "aws_glue_resource_policy" +} + +// GetConnectionDetailsMapping for this ResourcePolicy +func (tr *ResourcePolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResourcePolicy +func (tr *ResourcePolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResourcePolicy +func (tr *ResourcePolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResourcePolicy +func (tr *ResourcePolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResourcePolicy +func (tr *ResourcePolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResourcePolicy +func (tr *ResourcePolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResourcePolicy +func (tr *ResourcePolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResourcePolicy +func (tr *ResourcePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResourcePolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResourcePolicy) LateInitialize(attrs []byte) (bool, error) { + params := &ResourcePolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResourcePolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_resourcepolicy_types.go b/apis/glue/v1beta1/zz_resourcepolicy_types.go index 1c8963d2fc..8faa3eee28 100755 --- a/apis/glue/v1beta1/zz_resourcepolicy_types.go +++ b/apis/glue/v1beta1/zz_resourcepolicy_types.go @@ -77,13 +77,14 @@ type ResourcePolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResourcePolicy is the Schema for the ResourcePolicys API. Provides a resource to configure the aws glue resource policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResourcePolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_schema_terraformed.go b/apis/glue/v1beta1/zz_schema_terraformed.go new file mode 100755 index 0000000000..f4932e9baf --- /dev/null +++ b/apis/glue/v1beta1/zz_schema_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Schema +func (mg *Schema) GetTerraformResourceType() string { + return "aws_glue_schema" +} + +// GetConnectionDetailsMapping for this Schema +func (tr *Schema) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Schema +func (tr *Schema) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Schema +func (tr *Schema) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Schema +func (tr *Schema) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Schema +func (tr *Schema) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Schema +func (tr *Schema) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Schema +func (tr *Schema) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Schema +func (tr *Schema) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Schema using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Schema) LateInitialize(attrs []byte) (bool, error) { + params := &SchemaParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Schema) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_schema_types.go b/apis/glue/v1beta1/zz_schema_types.go index 0ef837bbbc..cf90c1dc0b 100755 --- a/apis/glue/v1beta1/zz_schema_types.go +++ b/apis/glue/v1beta1/zz_schema_types.go @@ -170,13 +170,14 @@ type SchemaStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Schema is the Schema for the Schemas API. Provides a Glue Schema resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Schema struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_securityconfiguration_terraformed.go b/apis/glue/v1beta1/zz_securityconfiguration_terraformed.go new file mode 100755 index 0000000000..b5b34d25f2 --- /dev/null +++ b/apis/glue/v1beta1/zz_securityconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SecurityConfiguration +func (mg *SecurityConfiguration) GetTerraformResourceType() string { + return "aws_glue_security_configuration" +} + +// GetConnectionDetailsMapping for this SecurityConfiguration +func (tr *SecurityConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SecurityConfiguration +func (tr *SecurityConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SecurityConfiguration +func (tr *SecurityConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SecurityConfiguration +func (tr *SecurityConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SecurityConfiguration +func (tr *SecurityConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SecurityConfiguration +func (tr *SecurityConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SecurityConfiguration +func (tr *SecurityConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SecurityConfiguration +func (tr *SecurityConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SecurityConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SecurityConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &SecurityConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SecurityConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_securityconfiguration_types.go b/apis/glue/v1beta1/zz_securityconfiguration_types.go index 00440f995a..17472c6a80 100755 --- a/apis/glue/v1beta1/zz_securityconfiguration_types.go +++ b/apis/glue/v1beta1/zz_securityconfiguration_types.go @@ -246,13 +246,14 @@ type SecurityConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SecurityConfiguration is the Schema for the SecurityConfigurations API. Manages a Glue Security Configuration // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SecurityConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_trigger_terraformed.go b/apis/glue/v1beta1/zz_trigger_terraformed.go new file mode 100755 index 0000000000..2ce581cf0e --- /dev/null +++ b/apis/glue/v1beta1/zz_trigger_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Trigger +func (mg *Trigger) GetTerraformResourceType() string { + return "aws_glue_trigger" +} + +// GetConnectionDetailsMapping for this Trigger +func (tr *Trigger) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Trigger +func (tr *Trigger) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Trigger +func (tr *Trigger) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Trigger +func (tr *Trigger) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Trigger +func (tr *Trigger) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Trigger +func (tr *Trigger) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Trigger +func (tr *Trigger) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Trigger +func (tr *Trigger) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Trigger using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Trigger) LateInitialize(attrs []byte) (bool, error) { + params := &TriggerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Trigger) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_trigger_types.go b/apis/glue/v1beta1/zz_trigger_types.go index 485708feca..0b059a04c3 100755 --- a/apis/glue/v1beta1/zz_trigger_types.go +++ b/apis/glue/v1beta1/zz_trigger_types.go @@ -451,13 +451,14 @@ type TriggerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Trigger is the Schema for the Triggers API. Manages a Glue Trigger resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Trigger struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_userdefinedfunction_terraformed.go b/apis/glue/v1beta1/zz_userdefinedfunction_terraformed.go new file mode 100755 index 0000000000..688e71d509 --- /dev/null +++ b/apis/glue/v1beta1/zz_userdefinedfunction_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserDefinedFunction +func (mg *UserDefinedFunction) GetTerraformResourceType() string { + return "aws_glue_user_defined_function" +} + +// GetConnectionDetailsMapping for this UserDefinedFunction +func (tr *UserDefinedFunction) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserDefinedFunction +func (tr *UserDefinedFunction) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserDefinedFunction +func (tr *UserDefinedFunction) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserDefinedFunction +func (tr *UserDefinedFunction) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserDefinedFunction +func (tr *UserDefinedFunction) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserDefinedFunction +func (tr *UserDefinedFunction) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserDefinedFunction +func (tr *UserDefinedFunction) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserDefinedFunction +func (tr *UserDefinedFunction) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserDefinedFunction using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserDefinedFunction) LateInitialize(attrs []byte) (bool, error) { + params := &UserDefinedFunctionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserDefinedFunction) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_userdefinedfunction_types.go b/apis/glue/v1beta1/zz_userdefinedfunction_types.go index 9fb12ae45d..878804d6c2 100755 --- a/apis/glue/v1beta1/zz_userdefinedfunction_types.go +++ b/apis/glue/v1beta1/zz_userdefinedfunction_types.go @@ -156,13 +156,14 @@ type UserDefinedFunctionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserDefinedFunction is the Schema for the UserDefinedFunctions API. Provides a Glue User Defined Function. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserDefinedFunction struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/glue/v1beta1/zz_workflow_terraformed.go b/apis/glue/v1beta1/zz_workflow_terraformed.go new file mode 100755 index 0000000000..d532358b55 --- /dev/null +++ b/apis/glue/v1beta1/zz_workflow_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Workflow +func (mg *Workflow) GetTerraformResourceType() string { + return "aws_glue_workflow" +} + +// GetConnectionDetailsMapping for this Workflow +func (tr *Workflow) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Workflow +func (tr *Workflow) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Workflow +func (tr *Workflow) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Workflow +func (tr *Workflow) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Workflow +func (tr *Workflow) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Workflow +func (tr *Workflow) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Workflow +func (tr *Workflow) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Workflow +func (tr *Workflow) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Workflow using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Workflow) LateInitialize(attrs []byte) (bool, error) { + params := &WorkflowParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Workflow) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/glue/v1beta1/zz_workflow_types.go b/apis/glue/v1beta1/zz_workflow_types.go index b6b19a585b..a9132932fb 100755 --- a/apis/glue/v1beta1/zz_workflow_types.go +++ b/apis/glue/v1beta1/zz_workflow_types.go @@ -111,13 +111,14 @@ type WorkflowStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Workflow is the Schema for the Workflows API. Provides a Glue Workflow resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Workflow struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/grafana/v1beta1/zz_generated.conversion_hubs.go b/apis/grafana/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..9ac75b2420 --- /dev/null +++ b/apis/grafana/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *LicenseAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RoleAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Workspace) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *WorkspaceAPIKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *WorkspaceSAMLConfiguration) Hub() {} diff --git a/apis/grafana/v1beta1/zz_generated_terraformed.go b/apis/grafana/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 5357165172..0000000000 --- a/apis/grafana/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,589 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this LicenseAssociation -func (mg *LicenseAssociation) GetTerraformResourceType() string { - return "aws_grafana_license_association" -} - -// GetConnectionDetailsMapping for this LicenseAssociation -func (tr *LicenseAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LicenseAssociation -func (tr *LicenseAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LicenseAssociation -func (tr *LicenseAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LicenseAssociation -func (tr *LicenseAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LicenseAssociation -func (tr *LicenseAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LicenseAssociation -func (tr *LicenseAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LicenseAssociation -func (tr *LicenseAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LicenseAssociation -func (tr *LicenseAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LicenseAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LicenseAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &LicenseAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LicenseAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RoleAssociation -func (mg *RoleAssociation) GetTerraformResourceType() string { - return "aws_grafana_role_association" -} - -// GetConnectionDetailsMapping for this RoleAssociation -func (tr *RoleAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RoleAssociation -func (tr *RoleAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RoleAssociation -func (tr *RoleAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RoleAssociation -func (tr *RoleAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RoleAssociation -func (tr *RoleAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RoleAssociation -func (tr *RoleAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RoleAssociation -func (tr *RoleAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RoleAssociation -func (tr *RoleAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RoleAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RoleAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &RoleAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RoleAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Workspace -func (mg *Workspace) GetTerraformResourceType() string { - return "aws_grafana_workspace" -} - -// GetConnectionDetailsMapping for this Workspace -func (tr *Workspace) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Workspace -func (tr *Workspace) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Workspace -func (tr *Workspace) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Workspace -func (tr *Workspace) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Workspace -func (tr *Workspace) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Workspace -func (tr *Workspace) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Workspace -func (tr *Workspace) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Workspace -func (tr *Workspace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Workspace using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Workspace) LateInitialize(attrs []byte) (bool, error) { - params := &WorkspaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Workspace) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this WorkspaceAPIKey -func (mg *WorkspaceAPIKey) GetTerraformResourceType() string { - return "aws_grafana_workspace_api_key" -} - -// GetConnectionDetailsMapping for this WorkspaceAPIKey -func (tr *WorkspaceAPIKey) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this WorkspaceAPIKey -func (tr *WorkspaceAPIKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this WorkspaceAPIKey -func (tr *WorkspaceAPIKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this WorkspaceAPIKey -func (tr *WorkspaceAPIKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this WorkspaceAPIKey -func (tr *WorkspaceAPIKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this WorkspaceAPIKey -func (tr *WorkspaceAPIKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this WorkspaceAPIKey -func (tr *WorkspaceAPIKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this WorkspaceAPIKey -func (tr *WorkspaceAPIKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this WorkspaceAPIKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *WorkspaceAPIKey) LateInitialize(attrs []byte) (bool, error) { - params := &WorkspaceAPIKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *WorkspaceAPIKey) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this WorkspaceSAMLConfiguration -func (mg *WorkspaceSAMLConfiguration) GetTerraformResourceType() string { - return "aws_grafana_workspace_saml_configuration" -} - -// GetConnectionDetailsMapping for this WorkspaceSAMLConfiguration -func (tr *WorkspaceSAMLConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this WorkspaceSAMLConfiguration -func (tr *WorkspaceSAMLConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this WorkspaceSAMLConfiguration -func (tr *WorkspaceSAMLConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this WorkspaceSAMLConfiguration -func (tr *WorkspaceSAMLConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this WorkspaceSAMLConfiguration -func (tr *WorkspaceSAMLConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this WorkspaceSAMLConfiguration -func (tr *WorkspaceSAMLConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this WorkspaceSAMLConfiguration -func (tr *WorkspaceSAMLConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this WorkspaceSAMLConfiguration -func (tr *WorkspaceSAMLConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this WorkspaceSAMLConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *WorkspaceSAMLConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &WorkspaceSAMLConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *WorkspaceSAMLConfiguration) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/grafana/v1beta1/zz_licenseassociation_terraformed.go b/apis/grafana/v1beta1/zz_licenseassociation_terraformed.go new file mode 100755 index 0000000000..ebcec329af --- /dev/null +++ b/apis/grafana/v1beta1/zz_licenseassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LicenseAssociation +func (mg *LicenseAssociation) GetTerraformResourceType() string { + return "aws_grafana_license_association" +} + +// GetConnectionDetailsMapping for this LicenseAssociation +func (tr *LicenseAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LicenseAssociation +func (tr *LicenseAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LicenseAssociation +func (tr *LicenseAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LicenseAssociation +func (tr *LicenseAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LicenseAssociation +func (tr *LicenseAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LicenseAssociation +func (tr *LicenseAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LicenseAssociation +func (tr *LicenseAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LicenseAssociation +func (tr *LicenseAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LicenseAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LicenseAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &LicenseAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LicenseAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/grafana/v1beta1/zz_licenseassociation_types.go b/apis/grafana/v1beta1/zz_licenseassociation_types.go index 53c179a7f3..65a7c052d6 100755 --- a/apis/grafana/v1beta1/zz_licenseassociation_types.go +++ b/apis/grafana/v1beta1/zz_licenseassociation_types.go @@ -103,13 +103,14 @@ type LicenseAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LicenseAssociation is the Schema for the LicenseAssociations API. Provides an Amazon Managed Grafana workspace license association resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LicenseAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/grafana/v1beta1/zz_roleassociation_terraformed.go b/apis/grafana/v1beta1/zz_roleassociation_terraformed.go new file mode 100755 index 0000000000..dbd67ba23d --- /dev/null +++ b/apis/grafana/v1beta1/zz_roleassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RoleAssociation +func (mg *RoleAssociation) GetTerraformResourceType() string { + return "aws_grafana_role_association" +} + +// GetConnectionDetailsMapping for this RoleAssociation +func (tr *RoleAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RoleAssociation +func (tr *RoleAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RoleAssociation +func (tr *RoleAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RoleAssociation +func (tr *RoleAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RoleAssociation +func (tr *RoleAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RoleAssociation +func (tr *RoleAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RoleAssociation +func (tr *RoleAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RoleAssociation +func (tr *RoleAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RoleAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RoleAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &RoleAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RoleAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/grafana/v1beta1/zz_roleassociation_types.go b/apis/grafana/v1beta1/zz_roleassociation_types.go index 90745e620f..5c26a3006d 100755 --- a/apis/grafana/v1beta1/zz_roleassociation_types.go +++ b/apis/grafana/v1beta1/zz_roleassociation_types.go @@ -121,13 +121,14 @@ type RoleAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RoleAssociation is the Schema for the RoleAssociations API. Provides an Amazon Managed Grafana workspace role association resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RoleAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/grafana/v1beta1/zz_workspace_terraformed.go b/apis/grafana/v1beta1/zz_workspace_terraformed.go new file mode 100755 index 0000000000..8994817b0e --- /dev/null +++ b/apis/grafana/v1beta1/zz_workspace_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Workspace +func (mg *Workspace) GetTerraformResourceType() string { + return "aws_grafana_workspace" +} + +// GetConnectionDetailsMapping for this Workspace +func (tr *Workspace) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Workspace +func (tr *Workspace) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Workspace +func (tr *Workspace) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Workspace +func (tr *Workspace) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Workspace +func (tr *Workspace) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Workspace +func (tr *Workspace) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Workspace +func (tr *Workspace) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Workspace +func (tr *Workspace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Workspace using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Workspace) LateInitialize(attrs []byte) (bool, error) { + params := &WorkspaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Workspace) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/grafana/v1beta1/zz_workspace_types.go b/apis/grafana/v1beta1/zz_workspace_types.go index 5ff6105f0d..157a8ce21a 100755 --- a/apis/grafana/v1beta1/zz_workspace_types.go +++ b/apis/grafana/v1beta1/zz_workspace_types.go @@ -322,13 +322,14 @@ type WorkspaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Workspace is the Schema for the Workspaces API. Provides an Amazon Managed Grafana workspace resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Workspace struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/grafana/v1beta1/zz_workspaceapikey_terraformed.go b/apis/grafana/v1beta1/zz_workspaceapikey_terraformed.go new file mode 100755 index 0000000000..7f5a0fe499 --- /dev/null +++ b/apis/grafana/v1beta1/zz_workspaceapikey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this WorkspaceAPIKey +func (mg *WorkspaceAPIKey) GetTerraformResourceType() string { + return "aws_grafana_workspace_api_key" +} + +// GetConnectionDetailsMapping for this WorkspaceAPIKey +func (tr *WorkspaceAPIKey) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this WorkspaceAPIKey +func (tr *WorkspaceAPIKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this WorkspaceAPIKey +func (tr *WorkspaceAPIKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this WorkspaceAPIKey +func (tr *WorkspaceAPIKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this WorkspaceAPIKey +func (tr *WorkspaceAPIKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this WorkspaceAPIKey +func (tr *WorkspaceAPIKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this WorkspaceAPIKey +func (tr *WorkspaceAPIKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this WorkspaceAPIKey +func (tr *WorkspaceAPIKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this WorkspaceAPIKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *WorkspaceAPIKey) LateInitialize(attrs []byte) (bool, error) { + params := &WorkspaceAPIKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *WorkspaceAPIKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/grafana/v1beta1/zz_workspaceapikey_types.go b/apis/grafana/v1beta1/zz_workspaceapikey_types.go index 1b184d819f..e265ac8b97 100755 --- a/apis/grafana/v1beta1/zz_workspaceapikey_types.go +++ b/apis/grafana/v1beta1/zz_workspaceapikey_types.go @@ -119,13 +119,14 @@ type WorkspaceAPIKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // WorkspaceAPIKey is the Schema for the WorkspaceAPIKeys API. Creates a Grafana API key for the workspace. This key can be used to authenticate requests sent to the workspace's HTTP API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type WorkspaceAPIKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/grafana/v1beta1/zz_workspacesamlconfiguration_terraformed.go b/apis/grafana/v1beta1/zz_workspacesamlconfiguration_terraformed.go new file mode 100755 index 0000000000..5141fbd4e9 --- /dev/null +++ b/apis/grafana/v1beta1/zz_workspacesamlconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this WorkspaceSAMLConfiguration +func (mg *WorkspaceSAMLConfiguration) GetTerraformResourceType() string { + return "aws_grafana_workspace_saml_configuration" +} + +// GetConnectionDetailsMapping for this WorkspaceSAMLConfiguration +func (tr *WorkspaceSAMLConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this WorkspaceSAMLConfiguration +func (tr *WorkspaceSAMLConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this WorkspaceSAMLConfiguration +func (tr *WorkspaceSAMLConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this WorkspaceSAMLConfiguration +func (tr *WorkspaceSAMLConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this WorkspaceSAMLConfiguration +func (tr *WorkspaceSAMLConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this WorkspaceSAMLConfiguration +func (tr *WorkspaceSAMLConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this WorkspaceSAMLConfiguration +func (tr *WorkspaceSAMLConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this WorkspaceSAMLConfiguration +func (tr *WorkspaceSAMLConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this WorkspaceSAMLConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *WorkspaceSAMLConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &WorkspaceSAMLConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *WorkspaceSAMLConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/grafana/v1beta1/zz_workspacesamlconfiguration_types.go b/apis/grafana/v1beta1/zz_workspacesamlconfiguration_types.go index 768d557e94..8eb1f6b887 100755 --- a/apis/grafana/v1beta1/zz_workspacesamlconfiguration_types.go +++ b/apis/grafana/v1beta1/zz_workspacesamlconfiguration_types.go @@ -208,13 +208,14 @@ type WorkspaceSAMLConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // WorkspaceSAMLConfiguration is the Schema for the WorkspaceSAMLConfigurations API. Provides an Amazon Managed Grafana workspace SAML configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type WorkspaceSAMLConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/guardduty/v1beta1/zz_detector_terraformed.go b/apis/guardduty/v1beta1/zz_detector_terraformed.go new file mode 100755 index 0000000000..af74d824b5 --- /dev/null +++ b/apis/guardduty/v1beta1/zz_detector_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Detector +func (mg *Detector) GetTerraformResourceType() string { + return "aws_guardduty_detector" +} + +// GetConnectionDetailsMapping for this Detector +func (tr *Detector) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Detector +func (tr *Detector) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Detector +func (tr *Detector) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Detector +func (tr *Detector) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Detector +func (tr *Detector) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Detector +func (tr *Detector) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Detector +func (tr *Detector) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Detector +func (tr *Detector) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Detector using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Detector) LateInitialize(attrs []byte) (bool, error) { + params := &DetectorParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Detector) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/guardduty/v1beta1/zz_detector_types.go b/apis/guardduty/v1beta1/zz_detector_types.go index 9ef828a73b..8d9757f2a7 100755 --- a/apis/guardduty/v1beta1/zz_detector_types.go +++ b/apis/guardduty/v1beta1/zz_detector_types.go @@ -291,13 +291,14 @@ type DetectorStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Detector is the Schema for the Detectors API. Provides a resource to manage a GuardDuty detector // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Detector struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/guardduty/v1beta1/zz_filter_terraformed.go b/apis/guardduty/v1beta1/zz_filter_terraformed.go new file mode 100755 index 0000000000..6990e10c6b --- /dev/null +++ b/apis/guardduty/v1beta1/zz_filter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Filter +func (mg *Filter) GetTerraformResourceType() string { + return "aws_guardduty_filter" +} + +// GetConnectionDetailsMapping for this Filter +func (tr *Filter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Filter +func (tr *Filter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Filter +func (tr *Filter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Filter +func (tr *Filter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Filter +func (tr *Filter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Filter +func (tr *Filter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Filter +func (tr *Filter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Filter +func (tr *Filter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Filter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Filter) LateInitialize(attrs []byte) (bool, error) { + params := &FilterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Filter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/guardduty/v1beta1/zz_filter_types.go b/apis/guardduty/v1beta1/zz_filter_types.go index 705fda22b1..14ff9ce930 100755 --- a/apis/guardduty/v1beta1/zz_filter_types.go +++ b/apis/guardduty/v1beta1/zz_filter_types.go @@ -228,13 +228,14 @@ type FilterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Filter is the Schema for the Filters API. Provides a resource to manage a GuardDuty filter // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Filter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/guardduty/v1beta1/zz_generated.conversion_hubs.go b/apis/guardduty/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..e5972befe2 --- /dev/null +++ b/apis/guardduty/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Detector) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Filter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Member) Hub() {} diff --git a/apis/guardduty/v1beta1/zz_generated_terraformed.go b/apis/guardduty/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 145f327f1d..0000000000 --- a/apis/guardduty/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Detector -func (mg *Detector) GetTerraformResourceType() string { - return "aws_guardduty_detector" -} - -// GetConnectionDetailsMapping for this Detector -func (tr *Detector) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Detector -func (tr *Detector) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Detector -func (tr *Detector) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Detector -func (tr *Detector) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Detector -func (tr *Detector) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Detector -func (tr *Detector) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Detector -func (tr *Detector) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Detector -func (tr *Detector) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Detector using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Detector) LateInitialize(attrs []byte) (bool, error) { - params := &DetectorParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Detector) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Filter -func (mg *Filter) GetTerraformResourceType() string { - return "aws_guardduty_filter" -} - -// GetConnectionDetailsMapping for this Filter -func (tr *Filter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Filter -func (tr *Filter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Filter -func (tr *Filter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Filter -func (tr *Filter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Filter -func (tr *Filter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Filter -func (tr *Filter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Filter -func (tr *Filter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Filter -func (tr *Filter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Filter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Filter) LateInitialize(attrs []byte) (bool, error) { - params := &FilterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Filter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Member -func (mg *Member) GetTerraformResourceType() string { - return "aws_guardduty_member" -} - -// GetConnectionDetailsMapping for this Member -func (tr *Member) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Member -func (tr *Member) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Member -func (tr *Member) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Member -func (tr *Member) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Member -func (tr *Member) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Member -func (tr *Member) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Member -func (tr *Member) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Member -func (tr *Member) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Member using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Member) LateInitialize(attrs []byte) (bool, error) { - params := &MemberParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Member) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/guardduty/v1beta1/zz_member_terraformed.go b/apis/guardduty/v1beta1/zz_member_terraformed.go new file mode 100755 index 0000000000..58950be703 --- /dev/null +++ b/apis/guardduty/v1beta1/zz_member_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Member +func (mg *Member) GetTerraformResourceType() string { + return "aws_guardduty_member" +} + +// GetConnectionDetailsMapping for this Member +func (tr *Member) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Member +func (tr *Member) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Member +func (tr *Member) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Member +func (tr *Member) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Member +func (tr *Member) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Member +func (tr *Member) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Member +func (tr *Member) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Member +func (tr *Member) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Member using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Member) LateInitialize(attrs []byte) (bool, error) { + params := &MemberParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Member) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/guardduty/v1beta1/zz_member_types.go b/apis/guardduty/v1beta1/zz_member_types.go index 25718afd4f..2fbb80a0c2 100755 --- a/apis/guardduty/v1beta1/zz_member_types.go +++ b/apis/guardduty/v1beta1/zz_member_types.go @@ -161,13 +161,14 @@ type MemberStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Member is the Schema for the Members API. Provides a resource to manage a GuardDuty member // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Member struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_accesskey_terraformed.go b/apis/iam/v1beta1/zz_accesskey_terraformed.go new file mode 100755 index 0000000000..fc4e0c4f1c --- /dev/null +++ b/apis/iam/v1beta1/zz_accesskey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AccessKey +func (mg *AccessKey) GetTerraformResourceType() string { + return "aws_iam_access_key" +} + +// GetConnectionDetailsMapping for this AccessKey +func (tr *AccessKey) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"secret": "status.atProvider.secret", "ses_smtp_password_v4": "status.atProvider.sesSmtpPasswordV4"} +} + +// GetObservation of this AccessKey +func (tr *AccessKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AccessKey +func (tr *AccessKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AccessKey +func (tr *AccessKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AccessKey +func (tr *AccessKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AccessKey +func (tr *AccessKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AccessKey +func (tr *AccessKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AccessKey +func (tr *AccessKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AccessKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AccessKey) LateInitialize(attrs []byte) (bool, error) { + params := &AccessKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AccessKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_accesskey_types.go b/apis/iam/v1beta1/zz_accesskey_types.go index e58d548991..e703980f6b 100755 --- a/apis/iam/v1beta1/zz_accesskey_types.go +++ b/apis/iam/v1beta1/zz_accesskey_types.go @@ -113,13 +113,14 @@ type AccessKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AccessKey is the Schema for the AccessKeys API. Provides an IAM access key. This is a set of credentials that allow API requests to be made as an IAM user. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AccessKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_accountalias_terraformed.go b/apis/iam/v1beta1/zz_accountalias_terraformed.go new file mode 100755 index 0000000000..99c7e1ec6b --- /dev/null +++ b/apis/iam/v1beta1/zz_accountalias_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AccountAlias +func (mg *AccountAlias) GetTerraformResourceType() string { + return "aws_iam_account_alias" +} + +// GetConnectionDetailsMapping for this AccountAlias +func (tr *AccountAlias) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AccountAlias +func (tr *AccountAlias) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AccountAlias +func (tr *AccountAlias) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AccountAlias +func (tr *AccountAlias) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AccountAlias +func (tr *AccountAlias) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AccountAlias +func (tr *AccountAlias) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AccountAlias +func (tr *AccountAlias) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AccountAlias +func (tr *AccountAlias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AccountAlias using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AccountAlias) LateInitialize(attrs []byte) (bool, error) { + params := &AccountAliasParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AccountAlias) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_accountalias_types.go b/apis/iam/v1beta1/zz_accountalias_types.go index 86ea1809f9..37c8932bef 100755 --- a/apis/iam/v1beta1/zz_accountalias_types.go +++ b/apis/iam/v1beta1/zz_accountalias_types.go @@ -51,13 +51,14 @@ type AccountAliasStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AccountAlias is the Schema for the AccountAliass API. Manages the account alias for the AWS Account. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AccountAlias struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_accountpasswordpolicy_terraformed.go b/apis/iam/v1beta1/zz_accountpasswordpolicy_terraformed.go new file mode 100755 index 0000000000..7784b2e5e8 --- /dev/null +++ b/apis/iam/v1beta1/zz_accountpasswordpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AccountPasswordPolicy +func (mg *AccountPasswordPolicy) GetTerraformResourceType() string { + return "aws_iam_account_password_policy" +} + +// GetConnectionDetailsMapping for this AccountPasswordPolicy +func (tr *AccountPasswordPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AccountPasswordPolicy +func (tr *AccountPasswordPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AccountPasswordPolicy +func (tr *AccountPasswordPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AccountPasswordPolicy +func (tr *AccountPasswordPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AccountPasswordPolicy +func (tr *AccountPasswordPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AccountPasswordPolicy +func (tr *AccountPasswordPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AccountPasswordPolicy +func (tr *AccountPasswordPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AccountPasswordPolicy +func (tr *AccountPasswordPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AccountPasswordPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AccountPasswordPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &AccountPasswordPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AccountPasswordPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_accountpasswordpolicy_types.go b/apis/iam/v1beta1/zz_accountpasswordpolicy_types.go index c3e4e7408b..56c0eb76d5 100755 --- a/apis/iam/v1beta1/zz_accountpasswordpolicy_types.go +++ b/apis/iam/v1beta1/zz_accountpasswordpolicy_types.go @@ -145,13 +145,14 @@ type AccountPasswordPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AccountPasswordPolicy is the Schema for the AccountPasswordPolicys API. Manages Password Policy for the AWS Account. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AccountPasswordPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_generated.conversion_hubs.go b/apis/iam/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..0dee5ff48f --- /dev/null +++ b/apis/iam/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,80 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AccessKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *AccountAlias) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *AccountPasswordPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Group) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GroupMembership) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GroupPolicyAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InstanceProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *OpenIDConnectProvider) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Policy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Role) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RolePolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RolePolicyAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SAMLProvider) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ServerCertificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ServiceLinkedRole) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ServiceSpecificCredential) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SigningCertificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *User) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserGroupMembership) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserLoginProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserPolicyAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserSSHKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VirtualMfaDevice) Hub() {} diff --git a/apis/iam/v1beta1/zz_generated_terraformed.go b/apis/iam/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index d687a781c3..0000000000 --- a/apis/iam/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,2645 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AccessKey -func (mg *AccessKey) GetTerraformResourceType() string { - return "aws_iam_access_key" -} - -// GetConnectionDetailsMapping for this AccessKey -func (tr *AccessKey) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"secret": "status.atProvider.secret", "ses_smtp_password_v4": "status.atProvider.sesSmtpPasswordV4"} -} - -// GetObservation of this AccessKey -func (tr *AccessKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AccessKey -func (tr *AccessKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AccessKey -func (tr *AccessKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AccessKey -func (tr *AccessKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AccessKey -func (tr *AccessKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AccessKey -func (tr *AccessKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AccessKey -func (tr *AccessKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AccessKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AccessKey) LateInitialize(attrs []byte) (bool, error) { - params := &AccessKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AccessKey) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this AccountAlias -func (mg *AccountAlias) GetTerraformResourceType() string { - return "aws_iam_account_alias" -} - -// GetConnectionDetailsMapping for this AccountAlias -func (tr *AccountAlias) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AccountAlias -func (tr *AccountAlias) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AccountAlias -func (tr *AccountAlias) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AccountAlias -func (tr *AccountAlias) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AccountAlias -func (tr *AccountAlias) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AccountAlias -func (tr *AccountAlias) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AccountAlias -func (tr *AccountAlias) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AccountAlias -func (tr *AccountAlias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AccountAlias using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AccountAlias) LateInitialize(attrs []byte) (bool, error) { - params := &AccountAliasParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AccountAlias) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this AccountPasswordPolicy -func (mg *AccountPasswordPolicy) GetTerraformResourceType() string { - return "aws_iam_account_password_policy" -} - -// GetConnectionDetailsMapping for this AccountPasswordPolicy -func (tr *AccountPasswordPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AccountPasswordPolicy -func (tr *AccountPasswordPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AccountPasswordPolicy -func (tr *AccountPasswordPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AccountPasswordPolicy -func (tr *AccountPasswordPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AccountPasswordPolicy -func (tr *AccountPasswordPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AccountPasswordPolicy -func (tr *AccountPasswordPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AccountPasswordPolicy -func (tr *AccountPasswordPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AccountPasswordPolicy -func (tr *AccountPasswordPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AccountPasswordPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AccountPasswordPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &AccountPasswordPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AccountPasswordPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Group -func (mg *Group) GetTerraformResourceType() string { - return "aws_iam_group" -} - -// GetConnectionDetailsMapping for this Group -func (tr *Group) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Group -func (tr *Group) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Group -func (tr *Group) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Group -func (tr *Group) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Group -func (tr *Group) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Group -func (tr *Group) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Group -func (tr *Group) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Group -func (tr *Group) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Group using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Group) LateInitialize(attrs []byte) (bool, error) { - params := &GroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Group) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GroupMembership -func (mg *GroupMembership) GetTerraformResourceType() string { - return "aws_iam_group_membership" -} - -// GetConnectionDetailsMapping for this GroupMembership -func (tr *GroupMembership) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GroupMembership -func (tr *GroupMembership) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GroupMembership -func (tr *GroupMembership) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GroupMembership -func (tr *GroupMembership) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GroupMembership -func (tr *GroupMembership) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GroupMembership -func (tr *GroupMembership) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GroupMembership -func (tr *GroupMembership) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GroupMembership -func (tr *GroupMembership) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GroupMembership using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GroupMembership) LateInitialize(attrs []byte) (bool, error) { - params := &GroupMembershipParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GroupMembership) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GroupPolicyAttachment -func (mg *GroupPolicyAttachment) GetTerraformResourceType() string { - return "aws_iam_group_policy_attachment" -} - -// GetConnectionDetailsMapping for this GroupPolicyAttachment -func (tr *GroupPolicyAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GroupPolicyAttachment -func (tr *GroupPolicyAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GroupPolicyAttachment -func (tr *GroupPolicyAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GroupPolicyAttachment -func (tr *GroupPolicyAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GroupPolicyAttachment -func (tr *GroupPolicyAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GroupPolicyAttachment -func (tr *GroupPolicyAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GroupPolicyAttachment -func (tr *GroupPolicyAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GroupPolicyAttachment -func (tr *GroupPolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GroupPolicyAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GroupPolicyAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &GroupPolicyAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GroupPolicyAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InstanceProfile -func (mg *InstanceProfile) GetTerraformResourceType() string { - return "aws_iam_instance_profile" -} - -// GetConnectionDetailsMapping for this InstanceProfile -func (tr *InstanceProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InstanceProfile -func (tr *InstanceProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InstanceProfile -func (tr *InstanceProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InstanceProfile -func (tr *InstanceProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InstanceProfile -func (tr *InstanceProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InstanceProfile -func (tr *InstanceProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InstanceProfile -func (tr *InstanceProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InstanceProfile -func (tr *InstanceProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InstanceProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InstanceProfile) LateInitialize(attrs []byte) (bool, error) { - params := &InstanceProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InstanceProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this OpenIDConnectProvider -func (mg *OpenIDConnectProvider) GetTerraformResourceType() string { - return "aws_iam_openid_connect_provider" -} - -// GetConnectionDetailsMapping for this OpenIDConnectProvider -func (tr *OpenIDConnectProvider) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this OpenIDConnectProvider -func (tr *OpenIDConnectProvider) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this OpenIDConnectProvider -func (tr *OpenIDConnectProvider) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this OpenIDConnectProvider -func (tr *OpenIDConnectProvider) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this OpenIDConnectProvider -func (tr *OpenIDConnectProvider) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this OpenIDConnectProvider -func (tr *OpenIDConnectProvider) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this OpenIDConnectProvider -func (tr *OpenIDConnectProvider) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this OpenIDConnectProvider -func (tr *OpenIDConnectProvider) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this OpenIDConnectProvider using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *OpenIDConnectProvider) LateInitialize(attrs []byte) (bool, error) { - params := &OpenIDConnectProviderParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *OpenIDConnectProvider) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Policy -func (mg *Policy) GetTerraformResourceType() string { - return "aws_iam_policy" -} - -// GetConnectionDetailsMapping for this Policy -func (tr *Policy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Policy -func (tr *Policy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Policy -func (tr *Policy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Policy -func (tr *Policy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Policy -func (tr *Policy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Policy -func (tr *Policy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Policy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { - params := &PolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Policy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Role -func (mg *Role) GetTerraformResourceType() string { - return "aws_iam_role" -} - -// GetConnectionDetailsMapping for this Role -func (tr *Role) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Role -func (tr *Role) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Role -func (tr *Role) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Role -func (tr *Role) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Role -func (tr *Role) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Role -func (tr *Role) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Role -func (tr *Role) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Role -func (tr *Role) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Role using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Role) LateInitialize(attrs []byte) (bool, error) { - params := &RoleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("ManagedPolicyArns")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Role) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RolePolicy -func (mg *RolePolicy) GetTerraformResourceType() string { - return "aws_iam_role_policy" -} - -// GetConnectionDetailsMapping for this RolePolicy -func (tr *RolePolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RolePolicy -func (tr *RolePolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RolePolicy -func (tr *RolePolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RolePolicy -func (tr *RolePolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RolePolicy -func (tr *RolePolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RolePolicy -func (tr *RolePolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RolePolicy -func (tr *RolePolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RolePolicy -func (tr *RolePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RolePolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RolePolicy) LateInitialize(attrs []byte) (bool, error) { - params := &RolePolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RolePolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RolePolicyAttachment -func (mg *RolePolicyAttachment) GetTerraformResourceType() string { - return "aws_iam_role_policy_attachment" -} - -// GetConnectionDetailsMapping for this RolePolicyAttachment -func (tr *RolePolicyAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RolePolicyAttachment -func (tr *RolePolicyAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RolePolicyAttachment -func (tr *RolePolicyAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RolePolicyAttachment -func (tr *RolePolicyAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RolePolicyAttachment -func (tr *RolePolicyAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RolePolicyAttachment -func (tr *RolePolicyAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RolePolicyAttachment -func (tr *RolePolicyAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RolePolicyAttachment -func (tr *RolePolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RolePolicyAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RolePolicyAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &RolePolicyAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RolePolicyAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SAMLProvider -func (mg *SAMLProvider) GetTerraformResourceType() string { - return "aws_iam_saml_provider" -} - -// GetConnectionDetailsMapping for this SAMLProvider -func (tr *SAMLProvider) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SAMLProvider -func (tr *SAMLProvider) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SAMLProvider -func (tr *SAMLProvider) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SAMLProvider -func (tr *SAMLProvider) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SAMLProvider -func (tr *SAMLProvider) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SAMLProvider -func (tr *SAMLProvider) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SAMLProvider -func (tr *SAMLProvider) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SAMLProvider -func (tr *SAMLProvider) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SAMLProvider using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SAMLProvider) LateInitialize(attrs []byte) (bool, error) { - params := &SAMLProviderParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SAMLProvider) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ServerCertificate -func (mg *ServerCertificate) GetTerraformResourceType() string { - return "aws_iam_server_certificate" -} - -// GetConnectionDetailsMapping for this ServerCertificate -func (tr *ServerCertificate) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"private_key": "spec.forProvider.privateKeySecretRef"} -} - -// GetObservation of this ServerCertificate -func (tr *ServerCertificate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ServerCertificate -func (tr *ServerCertificate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ServerCertificate -func (tr *ServerCertificate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ServerCertificate -func (tr *ServerCertificate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ServerCertificate -func (tr *ServerCertificate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ServerCertificate -func (tr *ServerCertificate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ServerCertificate -func (tr *ServerCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ServerCertificate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ServerCertificate) LateInitialize(attrs []byte) (bool, error) { - params := &ServerCertificateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ServerCertificate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ServiceLinkedRole -func (mg *ServiceLinkedRole) GetTerraformResourceType() string { - return "aws_iam_service_linked_role" -} - -// GetConnectionDetailsMapping for this ServiceLinkedRole -func (tr *ServiceLinkedRole) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ServiceLinkedRole -func (tr *ServiceLinkedRole) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ServiceLinkedRole -func (tr *ServiceLinkedRole) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ServiceLinkedRole -func (tr *ServiceLinkedRole) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ServiceLinkedRole -func (tr *ServiceLinkedRole) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ServiceLinkedRole -func (tr *ServiceLinkedRole) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ServiceLinkedRole -func (tr *ServiceLinkedRole) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ServiceLinkedRole -func (tr *ServiceLinkedRole) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ServiceLinkedRole using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ServiceLinkedRole) LateInitialize(attrs []byte) (bool, error) { - params := &ServiceLinkedRoleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ServiceLinkedRole) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ServiceSpecificCredential -func (mg *ServiceSpecificCredential) GetTerraformResourceType() string { - return "aws_iam_service_specific_credential" -} - -// GetConnectionDetailsMapping for this ServiceSpecificCredential -func (tr *ServiceSpecificCredential) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"service_password": "status.atProvider.servicePassword"} -} - -// GetObservation of this ServiceSpecificCredential -func (tr *ServiceSpecificCredential) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ServiceSpecificCredential -func (tr *ServiceSpecificCredential) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ServiceSpecificCredential -func (tr *ServiceSpecificCredential) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ServiceSpecificCredential -func (tr *ServiceSpecificCredential) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ServiceSpecificCredential -func (tr *ServiceSpecificCredential) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ServiceSpecificCredential -func (tr *ServiceSpecificCredential) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ServiceSpecificCredential -func (tr *ServiceSpecificCredential) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ServiceSpecificCredential using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ServiceSpecificCredential) LateInitialize(attrs []byte) (bool, error) { - params := &ServiceSpecificCredentialParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ServiceSpecificCredential) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SigningCertificate -func (mg *SigningCertificate) GetTerraformResourceType() string { - return "aws_iam_signing_certificate" -} - -// GetConnectionDetailsMapping for this SigningCertificate -func (tr *SigningCertificate) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SigningCertificate -func (tr *SigningCertificate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SigningCertificate -func (tr *SigningCertificate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SigningCertificate -func (tr *SigningCertificate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SigningCertificate -func (tr *SigningCertificate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SigningCertificate -func (tr *SigningCertificate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SigningCertificate -func (tr *SigningCertificate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SigningCertificate -func (tr *SigningCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SigningCertificate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SigningCertificate) LateInitialize(attrs []byte) (bool, error) { - params := &SigningCertificateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SigningCertificate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this User -func (mg *User) GetTerraformResourceType() string { - return "aws_iam_user" -} - -// GetConnectionDetailsMapping for this User -func (tr *User) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this User -func (tr *User) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this User -func (tr *User) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this User -func (tr *User) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this User -func (tr *User) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this User -func (tr *User) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this User -func (tr *User) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this User -func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this User using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *User) LateInitialize(attrs []byte) (bool, error) { - params := &UserParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *User) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserGroupMembership -func (mg *UserGroupMembership) GetTerraformResourceType() string { - return "aws_iam_user_group_membership" -} - -// GetConnectionDetailsMapping for this UserGroupMembership -func (tr *UserGroupMembership) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserGroupMembership -func (tr *UserGroupMembership) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserGroupMembership -func (tr *UserGroupMembership) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserGroupMembership -func (tr *UserGroupMembership) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserGroupMembership -func (tr *UserGroupMembership) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserGroupMembership -func (tr *UserGroupMembership) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserGroupMembership -func (tr *UserGroupMembership) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserGroupMembership -func (tr *UserGroupMembership) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserGroupMembership using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserGroupMembership) LateInitialize(attrs []byte) (bool, error) { - params := &UserGroupMembershipParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserGroupMembership) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserLoginProfile -func (mg *UserLoginProfile) GetTerraformResourceType() string { - return "aws_iam_user_login_profile" -} - -// GetConnectionDetailsMapping for this UserLoginProfile -func (tr *UserLoginProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserLoginProfile -func (tr *UserLoginProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserLoginProfile -func (tr *UserLoginProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserLoginProfile -func (tr *UserLoginProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserLoginProfile -func (tr *UserLoginProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserLoginProfile -func (tr *UserLoginProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserLoginProfile -func (tr *UserLoginProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserLoginProfile -func (tr *UserLoginProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserLoginProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserLoginProfile) LateInitialize(attrs []byte) (bool, error) { - params := &UserLoginProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("PasswordLength")) - opts = append(opts, resource.WithNameFilter("PasswordResetRequired")) - opts = append(opts, resource.WithNameFilter("PgpKey")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserLoginProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserPolicyAttachment -func (mg *UserPolicyAttachment) GetTerraformResourceType() string { - return "aws_iam_user_policy_attachment" -} - -// GetConnectionDetailsMapping for this UserPolicyAttachment -func (tr *UserPolicyAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserPolicyAttachment -func (tr *UserPolicyAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserPolicyAttachment -func (tr *UserPolicyAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserPolicyAttachment -func (tr *UserPolicyAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserPolicyAttachment -func (tr *UserPolicyAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserPolicyAttachment -func (tr *UserPolicyAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserPolicyAttachment -func (tr *UserPolicyAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserPolicyAttachment -func (tr *UserPolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserPolicyAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserPolicyAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &UserPolicyAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserPolicyAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserSSHKey -func (mg *UserSSHKey) GetTerraformResourceType() string { - return "aws_iam_user_ssh_key" -} - -// GetConnectionDetailsMapping for this UserSSHKey -func (tr *UserSSHKey) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserSSHKey -func (tr *UserSSHKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserSSHKey -func (tr *UserSSHKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserSSHKey -func (tr *UserSSHKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserSSHKey -func (tr *UserSSHKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserSSHKey -func (tr *UserSSHKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserSSHKey -func (tr *UserSSHKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserSSHKey -func (tr *UserSSHKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserSSHKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserSSHKey) LateInitialize(attrs []byte) (bool, error) { - params := &UserSSHKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserSSHKey) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VirtualMfaDevice -func (mg *VirtualMfaDevice) GetTerraformResourceType() string { - return "aws_iam_virtual_mfa_device" -} - -// GetConnectionDetailsMapping for this VirtualMfaDevice -func (tr *VirtualMfaDevice) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VirtualMfaDevice -func (tr *VirtualMfaDevice) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VirtualMfaDevice -func (tr *VirtualMfaDevice) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VirtualMfaDevice -func (tr *VirtualMfaDevice) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VirtualMfaDevice -func (tr *VirtualMfaDevice) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VirtualMfaDevice -func (tr *VirtualMfaDevice) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VirtualMfaDevice -func (tr *VirtualMfaDevice) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VirtualMfaDevice -func (tr *VirtualMfaDevice) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VirtualMfaDevice using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VirtualMfaDevice) LateInitialize(attrs []byte) (bool, error) { - params := &VirtualMfaDeviceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VirtualMfaDevice) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/iam/v1beta1/zz_group_terraformed.go b/apis/iam/v1beta1/zz_group_terraformed.go new file mode 100755 index 0000000000..e682588da4 --- /dev/null +++ b/apis/iam/v1beta1/zz_group_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Group +func (mg *Group) GetTerraformResourceType() string { + return "aws_iam_group" +} + +// GetConnectionDetailsMapping for this Group +func (tr *Group) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Group +func (tr *Group) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Group +func (tr *Group) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Group +func (tr *Group) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Group +func (tr *Group) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Group +func (tr *Group) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Group +func (tr *Group) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Group +func (tr *Group) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Group using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Group) LateInitialize(attrs []byte) (bool, error) { + params := &GroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Group) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_group_types.go b/apis/iam/v1beta1/zz_group_types.go index fa79af7c79..e7a41bcaa4 100755 --- a/apis/iam/v1beta1/zz_group_types.go +++ b/apis/iam/v1beta1/zz_group_types.go @@ -69,13 +69,14 @@ type GroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Group is the Schema for the Groups API. Provides an IAM group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Group struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_groupmembership_terraformed.go b/apis/iam/v1beta1/zz_groupmembership_terraformed.go new file mode 100755 index 0000000000..fb932db08a --- /dev/null +++ b/apis/iam/v1beta1/zz_groupmembership_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GroupMembership +func (mg *GroupMembership) GetTerraformResourceType() string { + return "aws_iam_group_membership" +} + +// GetConnectionDetailsMapping for this GroupMembership +func (tr *GroupMembership) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GroupMembership +func (tr *GroupMembership) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GroupMembership +func (tr *GroupMembership) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GroupMembership +func (tr *GroupMembership) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GroupMembership +func (tr *GroupMembership) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GroupMembership +func (tr *GroupMembership) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GroupMembership +func (tr *GroupMembership) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GroupMembership +func (tr *GroupMembership) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GroupMembership using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GroupMembership) LateInitialize(attrs []byte) (bool, error) { + params := &GroupMembershipParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GroupMembership) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_groupmembership_types.go b/apis/iam/v1beta1/zz_groupmembership_types.go index 135827fa84..ed8167bc87 100755 --- a/apis/iam/v1beta1/zz_groupmembership_types.go +++ b/apis/iam/v1beta1/zz_groupmembership_types.go @@ -125,13 +125,14 @@ type GroupMembershipStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GroupMembership is the Schema for the GroupMemberships API. Provides a top level resource to manage IAM Group membership for IAM Users. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GroupMembership struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_grouppolicyattachment_terraformed.go b/apis/iam/v1beta1/zz_grouppolicyattachment_terraformed.go new file mode 100755 index 0000000000..3e1b83fd5d --- /dev/null +++ b/apis/iam/v1beta1/zz_grouppolicyattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GroupPolicyAttachment +func (mg *GroupPolicyAttachment) GetTerraformResourceType() string { + return "aws_iam_group_policy_attachment" +} + +// GetConnectionDetailsMapping for this GroupPolicyAttachment +func (tr *GroupPolicyAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GroupPolicyAttachment +func (tr *GroupPolicyAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GroupPolicyAttachment +func (tr *GroupPolicyAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GroupPolicyAttachment +func (tr *GroupPolicyAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GroupPolicyAttachment +func (tr *GroupPolicyAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GroupPolicyAttachment +func (tr *GroupPolicyAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GroupPolicyAttachment +func (tr *GroupPolicyAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GroupPolicyAttachment +func (tr *GroupPolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GroupPolicyAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GroupPolicyAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &GroupPolicyAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GroupPolicyAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_grouppolicyattachment_types.go b/apis/iam/v1beta1/zz_grouppolicyattachment_types.go index daa7deb367..34ab25d9a8 100755 --- a/apis/iam/v1beta1/zz_grouppolicyattachment_types.go +++ b/apis/iam/v1beta1/zz_grouppolicyattachment_types.go @@ -110,13 +110,14 @@ type GroupPolicyAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GroupPolicyAttachment is the Schema for the GroupPolicyAttachments API. Attaches a Managed IAM Policy to an IAM group // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GroupPolicyAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_instanceprofile_terraformed.go b/apis/iam/v1beta1/zz_instanceprofile_terraformed.go new file mode 100755 index 0000000000..aa8c2b6a30 --- /dev/null +++ b/apis/iam/v1beta1/zz_instanceprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InstanceProfile +func (mg *InstanceProfile) GetTerraformResourceType() string { + return "aws_iam_instance_profile" +} + +// GetConnectionDetailsMapping for this InstanceProfile +func (tr *InstanceProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InstanceProfile +func (tr *InstanceProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InstanceProfile +func (tr *InstanceProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InstanceProfile +func (tr *InstanceProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InstanceProfile +func (tr *InstanceProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InstanceProfile +func (tr *InstanceProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InstanceProfile +func (tr *InstanceProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InstanceProfile +func (tr *InstanceProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InstanceProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InstanceProfile) LateInitialize(attrs []byte) (bool, error) { + params := &InstanceProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InstanceProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_instanceprofile_types.go b/apis/iam/v1beta1/zz_instanceprofile_types.go index 85f214df06..6bb6cfcd06 100755 --- a/apis/iam/v1beta1/zz_instanceprofile_types.go +++ b/apis/iam/v1beta1/zz_instanceprofile_types.go @@ -117,13 +117,14 @@ type InstanceProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InstanceProfile is the Schema for the InstanceProfiles API. Provides an IAM instance profile. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InstanceProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_openidconnectprovider_terraformed.go b/apis/iam/v1beta1/zz_openidconnectprovider_terraformed.go new file mode 100755 index 0000000000..73258a5b6a --- /dev/null +++ b/apis/iam/v1beta1/zz_openidconnectprovider_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this OpenIDConnectProvider +func (mg *OpenIDConnectProvider) GetTerraformResourceType() string { + return "aws_iam_openid_connect_provider" +} + +// GetConnectionDetailsMapping for this OpenIDConnectProvider +func (tr *OpenIDConnectProvider) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this OpenIDConnectProvider +func (tr *OpenIDConnectProvider) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this OpenIDConnectProvider +func (tr *OpenIDConnectProvider) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this OpenIDConnectProvider +func (tr *OpenIDConnectProvider) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this OpenIDConnectProvider +func (tr *OpenIDConnectProvider) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this OpenIDConnectProvider +func (tr *OpenIDConnectProvider) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this OpenIDConnectProvider +func (tr *OpenIDConnectProvider) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this OpenIDConnectProvider +func (tr *OpenIDConnectProvider) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this OpenIDConnectProvider using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *OpenIDConnectProvider) LateInitialize(attrs []byte) (bool, error) { + params := &OpenIDConnectProviderParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *OpenIDConnectProvider) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_openidconnectprovider_types.go b/apis/iam/v1beta1/zz_openidconnectprovider_types.go index 20c1609350..9a99b439ac 100755 --- a/apis/iam/v1beta1/zz_openidconnectprovider_types.go +++ b/apis/iam/v1beta1/zz_openidconnectprovider_types.go @@ -105,13 +105,14 @@ type OpenIDConnectProviderStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // OpenIDConnectProvider is the Schema for the OpenIDConnectProviders API. Provides an IAM OpenID Connect provider. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type OpenIDConnectProvider struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_policy_terraformed.go b/apis/iam/v1beta1/zz_policy_terraformed.go new file mode 100755 index 0000000000..6b495ce04f --- /dev/null +++ b/apis/iam/v1beta1/zz_policy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Policy +func (mg *Policy) GetTerraformResourceType() string { + return "aws_iam_policy" +} + +// GetConnectionDetailsMapping for this Policy +func (tr *Policy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Policy +func (tr *Policy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Policy +func (tr *Policy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Policy +func (tr *Policy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Policy +func (tr *Policy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Policy +func (tr *Policy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Policy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { + params := &PolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Policy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_policy_types.go b/apis/iam/v1beta1/zz_policy_types.go index 1ca0756297..24e4863bb7 100755 --- a/apis/iam/v1beta1/zz_policy_types.go +++ b/apis/iam/v1beta1/zz_policy_types.go @@ -109,13 +109,14 @@ type PolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Policy is the Schema for the Policys API. Provides an IAM policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Policy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_role_terraformed.go b/apis/iam/v1beta1/zz_role_terraformed.go new file mode 100755 index 0000000000..1daa839556 --- /dev/null +++ b/apis/iam/v1beta1/zz_role_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Role +func (mg *Role) GetTerraformResourceType() string { + return "aws_iam_role" +} + +// GetConnectionDetailsMapping for this Role +func (tr *Role) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Role +func (tr *Role) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Role +func (tr *Role) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Role +func (tr *Role) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Role +func (tr *Role) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Role +func (tr *Role) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Role +func (tr *Role) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Role +func (tr *Role) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Role using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Role) LateInitialize(attrs []byte) (bool, error) { + params := &RoleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("ManagedPolicyArns")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Role) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_role_types.go b/apis/iam/v1beta1/zz_role_types.go index 2ce3839c5f..6439e5e6b2 100755 --- a/apis/iam/v1beta1/zz_role_types.go +++ b/apis/iam/v1beta1/zz_role_types.go @@ -207,13 +207,14 @@ type RoleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Role is the Schema for the Roles API. Provides an IAM role. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Role struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_rolepolicy_terraformed.go b/apis/iam/v1beta1/zz_rolepolicy_terraformed.go new file mode 100755 index 0000000000..1f4ac9f644 --- /dev/null +++ b/apis/iam/v1beta1/zz_rolepolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RolePolicy +func (mg *RolePolicy) GetTerraformResourceType() string { + return "aws_iam_role_policy" +} + +// GetConnectionDetailsMapping for this RolePolicy +func (tr *RolePolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RolePolicy +func (tr *RolePolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RolePolicy +func (tr *RolePolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RolePolicy +func (tr *RolePolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RolePolicy +func (tr *RolePolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RolePolicy +func (tr *RolePolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RolePolicy +func (tr *RolePolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RolePolicy +func (tr *RolePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RolePolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RolePolicy) LateInitialize(attrs []byte) (bool, error) { + params := &RolePolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RolePolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_rolepolicy_types.go b/apis/iam/v1beta1/zz_rolepolicy_types.go index 550a378850..41b24f9a50 100755 --- a/apis/iam/v1beta1/zz_rolepolicy_types.go +++ b/apis/iam/v1beta1/zz_rolepolicy_types.go @@ -80,13 +80,14 @@ type RolePolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RolePolicy is the Schema for the RolePolicys API. Provides an IAM role policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RolePolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_rolepolicyattachment_terraformed.go b/apis/iam/v1beta1/zz_rolepolicyattachment_terraformed.go new file mode 100755 index 0000000000..2e03db0452 --- /dev/null +++ b/apis/iam/v1beta1/zz_rolepolicyattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RolePolicyAttachment +func (mg *RolePolicyAttachment) GetTerraformResourceType() string { + return "aws_iam_role_policy_attachment" +} + +// GetConnectionDetailsMapping for this RolePolicyAttachment +func (tr *RolePolicyAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RolePolicyAttachment +func (tr *RolePolicyAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RolePolicyAttachment +func (tr *RolePolicyAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RolePolicyAttachment +func (tr *RolePolicyAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RolePolicyAttachment +func (tr *RolePolicyAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RolePolicyAttachment +func (tr *RolePolicyAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RolePolicyAttachment +func (tr *RolePolicyAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RolePolicyAttachment +func (tr *RolePolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RolePolicyAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RolePolicyAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &RolePolicyAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RolePolicyAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_rolepolicyattachment_types.go b/apis/iam/v1beta1/zz_rolepolicyattachment_types.go index 99f99d8baf..fc606b2af1 100755 --- a/apis/iam/v1beta1/zz_rolepolicyattachment_types.go +++ b/apis/iam/v1beta1/zz_rolepolicyattachment_types.go @@ -109,13 +109,14 @@ type RolePolicyAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RolePolicyAttachment is the Schema for the RolePolicyAttachments API. Attaches a Managed IAM Policy to an IAM role // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RolePolicyAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_samlprovider_terraformed.go b/apis/iam/v1beta1/zz_samlprovider_terraformed.go new file mode 100755 index 0000000000..e6c72f41e2 --- /dev/null +++ b/apis/iam/v1beta1/zz_samlprovider_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SAMLProvider +func (mg *SAMLProvider) GetTerraformResourceType() string { + return "aws_iam_saml_provider" +} + +// GetConnectionDetailsMapping for this SAMLProvider +func (tr *SAMLProvider) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SAMLProvider +func (tr *SAMLProvider) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SAMLProvider +func (tr *SAMLProvider) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SAMLProvider +func (tr *SAMLProvider) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SAMLProvider +func (tr *SAMLProvider) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SAMLProvider +func (tr *SAMLProvider) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SAMLProvider +func (tr *SAMLProvider) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SAMLProvider +func (tr *SAMLProvider) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SAMLProvider using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SAMLProvider) LateInitialize(attrs []byte) (bool, error) { + params := &SAMLProviderParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SAMLProvider) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_samlprovider_types.go b/apis/iam/v1beta1/zz_samlprovider_types.go index dcd460599b..9d61914c17 100755 --- a/apis/iam/v1beta1/zz_samlprovider_types.go +++ b/apis/iam/v1beta1/zz_samlprovider_types.go @@ -85,13 +85,14 @@ type SAMLProviderStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SAMLProvider is the Schema for the SAMLProviders API. Provides an IAM SAML provider. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SAMLProvider struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_servercertificate_terraformed.go b/apis/iam/v1beta1/zz_servercertificate_terraformed.go new file mode 100755 index 0000000000..9dd9bf554c --- /dev/null +++ b/apis/iam/v1beta1/zz_servercertificate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ServerCertificate +func (mg *ServerCertificate) GetTerraformResourceType() string { + return "aws_iam_server_certificate" +} + +// GetConnectionDetailsMapping for this ServerCertificate +func (tr *ServerCertificate) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"private_key": "spec.forProvider.privateKeySecretRef"} +} + +// GetObservation of this ServerCertificate +func (tr *ServerCertificate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ServerCertificate +func (tr *ServerCertificate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ServerCertificate +func (tr *ServerCertificate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ServerCertificate +func (tr *ServerCertificate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ServerCertificate +func (tr *ServerCertificate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ServerCertificate +func (tr *ServerCertificate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ServerCertificate +func (tr *ServerCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ServerCertificate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ServerCertificate) LateInitialize(attrs []byte) (bool, error) { + params := &ServerCertificateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ServerCertificate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_servercertificate_types.go b/apis/iam/v1beta1/zz_servercertificate_types.go index 86878e8d68..6a2886455f 100755 --- a/apis/iam/v1beta1/zz_servercertificate_types.go +++ b/apis/iam/v1beta1/zz_servercertificate_types.go @@ -125,13 +125,14 @@ type ServerCertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ServerCertificate is the Schema for the ServerCertificates API. Provides an IAM Server Certificate // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ServerCertificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_servicelinkedrole_terraformed.go b/apis/iam/v1beta1/zz_servicelinkedrole_terraformed.go new file mode 100755 index 0000000000..8c9c888460 --- /dev/null +++ b/apis/iam/v1beta1/zz_servicelinkedrole_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ServiceLinkedRole +func (mg *ServiceLinkedRole) GetTerraformResourceType() string { + return "aws_iam_service_linked_role" +} + +// GetConnectionDetailsMapping for this ServiceLinkedRole +func (tr *ServiceLinkedRole) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ServiceLinkedRole +func (tr *ServiceLinkedRole) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ServiceLinkedRole +func (tr *ServiceLinkedRole) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ServiceLinkedRole +func (tr *ServiceLinkedRole) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ServiceLinkedRole +func (tr *ServiceLinkedRole) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ServiceLinkedRole +func (tr *ServiceLinkedRole) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ServiceLinkedRole +func (tr *ServiceLinkedRole) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ServiceLinkedRole +func (tr *ServiceLinkedRole) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ServiceLinkedRole using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ServiceLinkedRole) LateInitialize(attrs []byte) (bool, error) { + params := &ServiceLinkedRoleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ServiceLinkedRole) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_servicelinkedrole_types.go b/apis/iam/v1beta1/zz_servicelinkedrole_types.go index 046a556bc9..2c8dee5335 100755 --- a/apis/iam/v1beta1/zz_servicelinkedrole_types.go +++ b/apis/iam/v1beta1/zz_servicelinkedrole_types.go @@ -115,13 +115,14 @@ type ServiceLinkedRoleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ServiceLinkedRole is the Schema for the ServiceLinkedRoles API. Provides an IAM service-linked role. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ServiceLinkedRole struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_servicespecificcredential_terraformed.go b/apis/iam/v1beta1/zz_servicespecificcredential_terraformed.go new file mode 100755 index 0000000000..0c985d2397 --- /dev/null +++ b/apis/iam/v1beta1/zz_servicespecificcredential_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ServiceSpecificCredential +func (mg *ServiceSpecificCredential) GetTerraformResourceType() string { + return "aws_iam_service_specific_credential" +} + +// GetConnectionDetailsMapping for this ServiceSpecificCredential +func (tr *ServiceSpecificCredential) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"service_password": "status.atProvider.servicePassword"} +} + +// GetObservation of this ServiceSpecificCredential +func (tr *ServiceSpecificCredential) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ServiceSpecificCredential +func (tr *ServiceSpecificCredential) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ServiceSpecificCredential +func (tr *ServiceSpecificCredential) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ServiceSpecificCredential +func (tr *ServiceSpecificCredential) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ServiceSpecificCredential +func (tr *ServiceSpecificCredential) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ServiceSpecificCredential +func (tr *ServiceSpecificCredential) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ServiceSpecificCredential +func (tr *ServiceSpecificCredential) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ServiceSpecificCredential using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ServiceSpecificCredential) LateInitialize(attrs []byte) (bool, error) { + params := &ServiceSpecificCredentialParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ServiceSpecificCredential) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_servicespecificcredential_types.go b/apis/iam/v1beta1/zz_servicespecificcredential_types.go index 09a22ed43a..4acd29dbf3 100755 --- a/apis/iam/v1beta1/zz_servicespecificcredential_types.go +++ b/apis/iam/v1beta1/zz_servicespecificcredential_types.go @@ -107,13 +107,14 @@ type ServiceSpecificCredentialStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ServiceSpecificCredential is the Schema for the ServiceSpecificCredentials API. Provides an IAM Service Specific Credential. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ServiceSpecificCredential struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_signingcertificate_terraformed.go b/apis/iam/v1beta1/zz_signingcertificate_terraformed.go new file mode 100755 index 0000000000..d1e8e42f51 --- /dev/null +++ b/apis/iam/v1beta1/zz_signingcertificate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SigningCertificate +func (mg *SigningCertificate) GetTerraformResourceType() string { + return "aws_iam_signing_certificate" +} + +// GetConnectionDetailsMapping for this SigningCertificate +func (tr *SigningCertificate) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SigningCertificate +func (tr *SigningCertificate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SigningCertificate +func (tr *SigningCertificate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SigningCertificate +func (tr *SigningCertificate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SigningCertificate +func (tr *SigningCertificate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SigningCertificate +func (tr *SigningCertificate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SigningCertificate +func (tr *SigningCertificate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SigningCertificate +func (tr *SigningCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SigningCertificate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SigningCertificate) LateInitialize(attrs []byte) (bool, error) { + params := &SigningCertificateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SigningCertificate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_signingcertificate_types.go b/apis/iam/v1beta1/zz_signingcertificate_types.go index d056fc549c..063728b2c4 100755 --- a/apis/iam/v1beta1/zz_signingcertificate_types.go +++ b/apis/iam/v1beta1/zz_signingcertificate_types.go @@ -86,13 +86,14 @@ type SigningCertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SigningCertificate is the Schema for the SigningCertificates API. Provides an IAM Signing Certificate // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SigningCertificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_user_terraformed.go b/apis/iam/v1beta1/zz_user_terraformed.go new file mode 100755 index 0000000000..b336c16af9 --- /dev/null +++ b/apis/iam/v1beta1/zz_user_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this User +func (mg *User) GetTerraformResourceType() string { + return "aws_iam_user" +} + +// GetConnectionDetailsMapping for this User +func (tr *User) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this User +func (tr *User) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this User +func (tr *User) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this User +func (tr *User) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this User +func (tr *User) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this User +func (tr *User) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this User +func (tr *User) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this User +func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this User using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *User) LateInitialize(attrs []byte) (bool, error) { + params := &UserParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *User) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_user_types.go b/apis/iam/v1beta1/zz_user_types.go index 9f88107bee..8035e5dfef 100755 --- a/apis/iam/v1beta1/zz_user_types.go +++ b/apis/iam/v1beta1/zz_user_types.go @@ -114,13 +114,14 @@ type UserStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // User is the Schema for the Users API. Provides an IAM user. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type User struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_usergroupmembership_terraformed.go b/apis/iam/v1beta1/zz_usergroupmembership_terraformed.go new file mode 100755 index 0000000000..c294b3649a --- /dev/null +++ b/apis/iam/v1beta1/zz_usergroupmembership_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserGroupMembership +func (mg *UserGroupMembership) GetTerraformResourceType() string { + return "aws_iam_user_group_membership" +} + +// GetConnectionDetailsMapping for this UserGroupMembership +func (tr *UserGroupMembership) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserGroupMembership +func (tr *UserGroupMembership) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserGroupMembership +func (tr *UserGroupMembership) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserGroupMembership +func (tr *UserGroupMembership) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserGroupMembership +func (tr *UserGroupMembership) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserGroupMembership +func (tr *UserGroupMembership) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserGroupMembership +func (tr *UserGroupMembership) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserGroupMembership +func (tr *UserGroupMembership) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserGroupMembership using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserGroupMembership) LateInitialize(attrs []byte) (bool, error) { + params := &UserGroupMembershipParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserGroupMembership) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_usergroupmembership_types.go b/apis/iam/v1beta1/zz_usergroupmembership_types.go index 6481e4f660..452979965a 100755 --- a/apis/iam/v1beta1/zz_usergroupmembership_types.go +++ b/apis/iam/v1beta1/zz_usergroupmembership_types.go @@ -115,13 +115,14 @@ type UserGroupMembershipStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserGroupMembership is the Schema for the UserGroupMemberships API. Provides a resource for adding an IAM User to IAM Groups without conflicting with itself. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserGroupMembership struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_userloginprofile_terraformed.go b/apis/iam/v1beta1/zz_userloginprofile_terraformed.go new file mode 100755 index 0000000000..68f80a2571 --- /dev/null +++ b/apis/iam/v1beta1/zz_userloginprofile_terraformed.go @@ -0,0 +1,136 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserLoginProfile +func (mg *UserLoginProfile) GetTerraformResourceType() string { + return "aws_iam_user_login_profile" +} + +// GetConnectionDetailsMapping for this UserLoginProfile +func (tr *UserLoginProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserLoginProfile +func (tr *UserLoginProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserLoginProfile +func (tr *UserLoginProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserLoginProfile +func (tr *UserLoginProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserLoginProfile +func (tr *UserLoginProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserLoginProfile +func (tr *UserLoginProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserLoginProfile +func (tr *UserLoginProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserLoginProfile +func (tr *UserLoginProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserLoginProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserLoginProfile) LateInitialize(attrs []byte) (bool, error) { + params := &UserLoginProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("PasswordLength")) + opts = append(opts, resource.WithNameFilter("PasswordResetRequired")) + opts = append(opts, resource.WithNameFilter("PgpKey")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserLoginProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_userloginprofile_types.go b/apis/iam/v1beta1/zz_userloginprofile_types.go index 8a7b6a4380..d2c1408a6a 100755 --- a/apis/iam/v1beta1/zz_userloginprofile_types.go +++ b/apis/iam/v1beta1/zz_userloginprofile_types.go @@ -119,13 +119,14 @@ type UserLoginProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserLoginProfile is the Schema for the UserLoginProfiles API. Manages an IAM User Login Profile // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserLoginProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_userpolicyattachment_terraformed.go b/apis/iam/v1beta1/zz_userpolicyattachment_terraformed.go new file mode 100755 index 0000000000..0535b45d4d --- /dev/null +++ b/apis/iam/v1beta1/zz_userpolicyattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserPolicyAttachment +func (mg *UserPolicyAttachment) GetTerraformResourceType() string { + return "aws_iam_user_policy_attachment" +} + +// GetConnectionDetailsMapping for this UserPolicyAttachment +func (tr *UserPolicyAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserPolicyAttachment +func (tr *UserPolicyAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserPolicyAttachment +func (tr *UserPolicyAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserPolicyAttachment +func (tr *UserPolicyAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserPolicyAttachment +func (tr *UserPolicyAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserPolicyAttachment +func (tr *UserPolicyAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserPolicyAttachment +func (tr *UserPolicyAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserPolicyAttachment +func (tr *UserPolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserPolicyAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserPolicyAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &UserPolicyAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserPolicyAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_userpolicyattachment_types.go b/apis/iam/v1beta1/zz_userpolicyattachment_types.go index 11b4c3c404..709b0d28e7 100755 --- a/apis/iam/v1beta1/zz_userpolicyattachment_types.go +++ b/apis/iam/v1beta1/zz_userpolicyattachment_types.go @@ -109,13 +109,14 @@ type UserPolicyAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserPolicyAttachment is the Schema for the UserPolicyAttachments API. Attaches a Managed IAM Policy to an IAM user // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserPolicyAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_usersshkey_terraformed.go b/apis/iam/v1beta1/zz_usersshkey_terraformed.go new file mode 100755 index 0000000000..ed59ff2b7f --- /dev/null +++ b/apis/iam/v1beta1/zz_usersshkey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserSSHKey +func (mg *UserSSHKey) GetTerraformResourceType() string { + return "aws_iam_user_ssh_key" +} + +// GetConnectionDetailsMapping for this UserSSHKey +func (tr *UserSSHKey) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserSSHKey +func (tr *UserSSHKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserSSHKey +func (tr *UserSSHKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserSSHKey +func (tr *UserSSHKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserSSHKey +func (tr *UserSSHKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserSSHKey +func (tr *UserSSHKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserSSHKey +func (tr *UserSSHKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserSSHKey +func (tr *UserSSHKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserSSHKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserSSHKey) LateInitialize(attrs []byte) (bool, error) { + params := &UserSSHKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserSSHKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_usersshkey_types.go b/apis/iam/v1beta1/zz_usersshkey_types.go index 79638884a7..ed5b64b01f 100755 --- a/apis/iam/v1beta1/zz_usersshkey_types.go +++ b/apis/iam/v1beta1/zz_usersshkey_types.go @@ -116,13 +116,14 @@ type UserSSHKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserSSHKey is the Schema for the UserSSHKeys API. Uploads an SSH public key and associates it with the specified IAM user. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserSSHKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iam/v1beta1/zz_virtualmfadevice_terraformed.go b/apis/iam/v1beta1/zz_virtualmfadevice_terraformed.go new file mode 100755 index 0000000000..8cbe5dbf32 --- /dev/null +++ b/apis/iam/v1beta1/zz_virtualmfadevice_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VirtualMfaDevice +func (mg *VirtualMfaDevice) GetTerraformResourceType() string { + return "aws_iam_virtual_mfa_device" +} + +// GetConnectionDetailsMapping for this VirtualMfaDevice +func (tr *VirtualMfaDevice) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VirtualMfaDevice +func (tr *VirtualMfaDevice) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VirtualMfaDevice +func (tr *VirtualMfaDevice) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VirtualMfaDevice +func (tr *VirtualMfaDevice) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VirtualMfaDevice +func (tr *VirtualMfaDevice) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VirtualMfaDevice +func (tr *VirtualMfaDevice) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VirtualMfaDevice +func (tr *VirtualMfaDevice) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VirtualMfaDevice +func (tr *VirtualMfaDevice) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VirtualMfaDevice using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VirtualMfaDevice) LateInitialize(attrs []byte) (bool, error) { + params := &VirtualMfaDeviceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VirtualMfaDevice) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iam/v1beta1/zz_virtualmfadevice_types.go b/apis/iam/v1beta1/zz_virtualmfadevice_types.go index 9fcfce68d8..4d9c1edf95 100755 --- a/apis/iam/v1beta1/zz_virtualmfadevice_types.go +++ b/apis/iam/v1beta1/zz_virtualmfadevice_types.go @@ -98,13 +98,14 @@ type VirtualMfaDeviceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VirtualMfaDevice is the Schema for the VirtualMfaDevices API. Provides an IAM Virtual MFA Device // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VirtualMfaDevice struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/identitystore/v1beta1/zz_generated.conversion_hubs.go b/apis/identitystore/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..69f9da97e5 --- /dev/null +++ b/apis/identitystore/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Group) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GroupMembership) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *User) Hub() {} diff --git a/apis/identitystore/v1beta1/zz_generated_terraformed.go b/apis/identitystore/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 630478c34a..0000000000 --- a/apis/identitystore/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Group -func (mg *Group) GetTerraformResourceType() string { - return "aws_identitystore_group" -} - -// GetConnectionDetailsMapping for this Group -func (tr *Group) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Group -func (tr *Group) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Group -func (tr *Group) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Group -func (tr *Group) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Group -func (tr *Group) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Group -func (tr *Group) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Group -func (tr *Group) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Group -func (tr *Group) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Group using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Group) LateInitialize(attrs []byte) (bool, error) { - params := &GroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Group) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GroupMembership -func (mg *GroupMembership) GetTerraformResourceType() string { - return "aws_identitystore_group_membership" -} - -// GetConnectionDetailsMapping for this GroupMembership -func (tr *GroupMembership) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GroupMembership -func (tr *GroupMembership) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GroupMembership -func (tr *GroupMembership) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GroupMembership -func (tr *GroupMembership) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GroupMembership -func (tr *GroupMembership) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GroupMembership -func (tr *GroupMembership) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GroupMembership -func (tr *GroupMembership) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GroupMembership -func (tr *GroupMembership) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GroupMembership using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GroupMembership) LateInitialize(attrs []byte) (bool, error) { - params := &GroupMembershipParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GroupMembership) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this User -func (mg *User) GetTerraformResourceType() string { - return "aws_identitystore_user" -} - -// GetConnectionDetailsMapping for this User -func (tr *User) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this User -func (tr *User) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this User -func (tr *User) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this User -func (tr *User) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this User -func (tr *User) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this User -func (tr *User) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this User -func (tr *User) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this User -func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this User using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *User) LateInitialize(attrs []byte) (bool, error) { - params := &UserParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *User) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/identitystore/v1beta1/zz_group_terraformed.go b/apis/identitystore/v1beta1/zz_group_terraformed.go new file mode 100755 index 0000000000..2b2aa53803 --- /dev/null +++ b/apis/identitystore/v1beta1/zz_group_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Group +func (mg *Group) GetTerraformResourceType() string { + return "aws_identitystore_group" +} + +// GetConnectionDetailsMapping for this Group +func (tr *Group) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Group +func (tr *Group) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Group +func (tr *Group) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Group +func (tr *Group) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Group +func (tr *Group) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Group +func (tr *Group) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Group +func (tr *Group) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Group +func (tr *Group) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Group using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Group) LateInitialize(attrs []byte) (bool, error) { + params := &GroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Group) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/identitystore/v1beta1/zz_group_types.go b/apis/identitystore/v1beta1/zz_group_types.go index 258ea8ab4d..94d67c0ab6 100755 --- a/apis/identitystore/v1beta1/zz_group_types.go +++ b/apis/identitystore/v1beta1/zz_group_types.go @@ -103,13 +103,14 @@ type GroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Group is the Schema for the Groups API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Group struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/identitystore/v1beta1/zz_groupmembership_terraformed.go b/apis/identitystore/v1beta1/zz_groupmembership_terraformed.go new file mode 100755 index 0000000000..55e7a2f08f --- /dev/null +++ b/apis/identitystore/v1beta1/zz_groupmembership_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GroupMembership +func (mg *GroupMembership) GetTerraformResourceType() string { + return "aws_identitystore_group_membership" +} + +// GetConnectionDetailsMapping for this GroupMembership +func (tr *GroupMembership) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GroupMembership +func (tr *GroupMembership) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GroupMembership +func (tr *GroupMembership) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GroupMembership +func (tr *GroupMembership) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GroupMembership +func (tr *GroupMembership) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GroupMembership +func (tr *GroupMembership) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GroupMembership +func (tr *GroupMembership) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GroupMembership +func (tr *GroupMembership) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GroupMembership using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GroupMembership) LateInitialize(attrs []byte) (bool, error) { + params := &GroupMembershipParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GroupMembership) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/identitystore/v1beta1/zz_groupmembership_types.go b/apis/identitystore/v1beta1/zz_groupmembership_types.go index 8957bd72c6..126ab0ce91 100755 --- a/apis/identitystore/v1beta1/zz_groupmembership_types.go +++ b/apis/identitystore/v1beta1/zz_groupmembership_types.go @@ -127,13 +127,14 @@ type GroupMembershipStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GroupMembership is the Schema for the GroupMemberships API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GroupMembership struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/identitystore/v1beta1/zz_user_terraformed.go b/apis/identitystore/v1beta1/zz_user_terraformed.go new file mode 100755 index 0000000000..766bf458b2 --- /dev/null +++ b/apis/identitystore/v1beta1/zz_user_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this User +func (mg *User) GetTerraformResourceType() string { + return "aws_identitystore_user" +} + +// GetConnectionDetailsMapping for this User +func (tr *User) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this User +func (tr *User) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this User +func (tr *User) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this User +func (tr *User) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this User +func (tr *User) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this User +func (tr *User) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this User +func (tr *User) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this User +func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this User using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *User) LateInitialize(attrs []byte) (bool, error) { + params := &UserParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *User) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/identitystore/v1beta1/zz_user_types.go b/apis/identitystore/v1beta1/zz_user_types.go index 4b80107a7c..53e1ed7330 100755 --- a/apis/identitystore/v1beta1/zz_user_types.go +++ b/apis/identitystore/v1beta1/zz_user_types.go @@ -450,13 +450,14 @@ type UserStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // User is the Schema for the Users API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type User struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/imagebuilder/v1beta1/zz_component_terraformed.go b/apis/imagebuilder/v1beta1/zz_component_terraformed.go new file mode 100755 index 0000000000..4a86dff303 --- /dev/null +++ b/apis/imagebuilder/v1beta1/zz_component_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Component +func (mg *Component) GetTerraformResourceType() string { + return "aws_imagebuilder_component" +} + +// GetConnectionDetailsMapping for this Component +func (tr *Component) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Component +func (tr *Component) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Component +func (tr *Component) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Component +func (tr *Component) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Component +func (tr *Component) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Component +func (tr *Component) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Component +func (tr *Component) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Component +func (tr *Component) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Component using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Component) LateInitialize(attrs []byte) (bool, error) { + params := &ComponentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Component) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/imagebuilder/v1beta1/zz_component_types.go b/apis/imagebuilder/v1beta1/zz_component_types.go index f85de88e41..647e803163 100755 --- a/apis/imagebuilder/v1beta1/zz_component_types.go +++ b/apis/imagebuilder/v1beta1/zz_component_types.go @@ -210,13 +210,14 @@ type ComponentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Component is the Schema for the Components API. Manage an Image Builder Component // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Component struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/imagebuilder/v1beta1/zz_containerrecipe_terraformed.go b/apis/imagebuilder/v1beta1/zz_containerrecipe_terraformed.go new file mode 100755 index 0000000000..6d32a3e507 --- /dev/null +++ b/apis/imagebuilder/v1beta1/zz_containerrecipe_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ContainerRecipe +func (mg *ContainerRecipe) GetTerraformResourceType() string { + return "aws_imagebuilder_container_recipe" +} + +// GetConnectionDetailsMapping for this ContainerRecipe +func (tr *ContainerRecipe) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ContainerRecipe +func (tr *ContainerRecipe) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ContainerRecipe +func (tr *ContainerRecipe) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ContainerRecipe +func (tr *ContainerRecipe) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ContainerRecipe +func (tr *ContainerRecipe) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ContainerRecipe +func (tr *ContainerRecipe) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ContainerRecipe +func (tr *ContainerRecipe) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ContainerRecipe +func (tr *ContainerRecipe) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ContainerRecipe using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ContainerRecipe) LateInitialize(attrs []byte) (bool, error) { + params := &ContainerRecipeParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ContainerRecipe) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/imagebuilder/v1beta1/zz_containerrecipe_types.go b/apis/imagebuilder/v1beta1/zz_containerrecipe_types.go index fd5ff31f69..9478410582 100755 --- a/apis/imagebuilder/v1beta1/zz_containerrecipe_types.go +++ b/apis/imagebuilder/v1beta1/zz_containerrecipe_types.go @@ -529,13 +529,14 @@ type ContainerRecipeStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ContainerRecipe is the Schema for the ContainerRecipes API. Manage an Image Builder Container Recipe // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ContainerRecipe struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/imagebuilder/v1beta1/zz_distributionconfiguration_terraformed.go b/apis/imagebuilder/v1beta1/zz_distributionconfiguration_terraformed.go new file mode 100755 index 0000000000..8fe821aa06 --- /dev/null +++ b/apis/imagebuilder/v1beta1/zz_distributionconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DistributionConfiguration +func (mg *DistributionConfiguration) GetTerraformResourceType() string { + return "aws_imagebuilder_distribution_configuration" +} + +// GetConnectionDetailsMapping for this DistributionConfiguration +func (tr *DistributionConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DistributionConfiguration +func (tr *DistributionConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DistributionConfiguration +func (tr *DistributionConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DistributionConfiguration +func (tr *DistributionConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DistributionConfiguration +func (tr *DistributionConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DistributionConfiguration +func (tr *DistributionConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DistributionConfiguration +func (tr *DistributionConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DistributionConfiguration +func (tr *DistributionConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DistributionConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DistributionConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &DistributionConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DistributionConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/imagebuilder/v1beta1/zz_distributionconfiguration_types.go b/apis/imagebuilder/v1beta1/zz_distributionconfiguration_types.go index bb34e4a780..2b95610c76 100755 --- a/apis/imagebuilder/v1beta1/zz_distributionconfiguration_types.go +++ b/apis/imagebuilder/v1beta1/zz_distributionconfiguration_types.go @@ -546,13 +546,14 @@ type DistributionConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DistributionConfiguration is the Schema for the DistributionConfigurations API. Manage an Image Builder Distribution Configuration // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DistributionConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/imagebuilder/v1beta1/zz_generated.conversion_hubs.go b/apis/imagebuilder/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..9f60d53913 --- /dev/null +++ b/apis/imagebuilder/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Component) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ContainerRecipe) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DistributionConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Image) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ImagePipeline) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ImageRecipe) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InfrastructureConfiguration) Hub() {} diff --git a/apis/imagebuilder/v1beta1/zz_generated_terraformed.go b/apis/imagebuilder/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 282ad06f27..0000000000 --- a/apis/imagebuilder/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,817 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Component -func (mg *Component) GetTerraformResourceType() string { - return "aws_imagebuilder_component" -} - -// GetConnectionDetailsMapping for this Component -func (tr *Component) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Component -func (tr *Component) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Component -func (tr *Component) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Component -func (tr *Component) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Component -func (tr *Component) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Component -func (tr *Component) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Component -func (tr *Component) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Component -func (tr *Component) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Component using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Component) LateInitialize(attrs []byte) (bool, error) { - params := &ComponentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Component) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ContainerRecipe -func (mg *ContainerRecipe) GetTerraformResourceType() string { - return "aws_imagebuilder_container_recipe" -} - -// GetConnectionDetailsMapping for this ContainerRecipe -func (tr *ContainerRecipe) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ContainerRecipe -func (tr *ContainerRecipe) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ContainerRecipe -func (tr *ContainerRecipe) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ContainerRecipe -func (tr *ContainerRecipe) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ContainerRecipe -func (tr *ContainerRecipe) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ContainerRecipe -func (tr *ContainerRecipe) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ContainerRecipe -func (tr *ContainerRecipe) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ContainerRecipe -func (tr *ContainerRecipe) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ContainerRecipe using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ContainerRecipe) LateInitialize(attrs []byte) (bool, error) { - params := &ContainerRecipeParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ContainerRecipe) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DistributionConfiguration -func (mg *DistributionConfiguration) GetTerraformResourceType() string { - return "aws_imagebuilder_distribution_configuration" -} - -// GetConnectionDetailsMapping for this DistributionConfiguration -func (tr *DistributionConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DistributionConfiguration -func (tr *DistributionConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DistributionConfiguration -func (tr *DistributionConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DistributionConfiguration -func (tr *DistributionConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DistributionConfiguration -func (tr *DistributionConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DistributionConfiguration -func (tr *DistributionConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DistributionConfiguration -func (tr *DistributionConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DistributionConfiguration -func (tr *DistributionConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DistributionConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DistributionConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &DistributionConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DistributionConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Image -func (mg *Image) GetTerraformResourceType() string { - return "aws_imagebuilder_image" -} - -// GetConnectionDetailsMapping for this Image -func (tr *Image) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Image -func (tr *Image) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Image -func (tr *Image) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Image -func (tr *Image) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Image -func (tr *Image) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Image -func (tr *Image) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Image -func (tr *Image) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Image -func (tr *Image) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Image using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Image) LateInitialize(attrs []byte) (bool, error) { - params := &ImageParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Image) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ImagePipeline -func (mg *ImagePipeline) GetTerraformResourceType() string { - return "aws_imagebuilder_image_pipeline" -} - -// GetConnectionDetailsMapping for this ImagePipeline -func (tr *ImagePipeline) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ImagePipeline -func (tr *ImagePipeline) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ImagePipeline -func (tr *ImagePipeline) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ImagePipeline -func (tr *ImagePipeline) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ImagePipeline -func (tr *ImagePipeline) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ImagePipeline -func (tr *ImagePipeline) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ImagePipeline -func (tr *ImagePipeline) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ImagePipeline -func (tr *ImagePipeline) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ImagePipeline using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ImagePipeline) LateInitialize(attrs []byte) (bool, error) { - params := &ImagePipelineParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ImagePipeline) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ImageRecipe -func (mg *ImageRecipe) GetTerraformResourceType() string { - return "aws_imagebuilder_image_recipe" -} - -// GetConnectionDetailsMapping for this ImageRecipe -func (tr *ImageRecipe) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ImageRecipe -func (tr *ImageRecipe) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ImageRecipe -func (tr *ImageRecipe) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ImageRecipe -func (tr *ImageRecipe) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ImageRecipe -func (tr *ImageRecipe) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ImageRecipe -func (tr *ImageRecipe) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ImageRecipe -func (tr *ImageRecipe) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ImageRecipe -func (tr *ImageRecipe) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ImageRecipe using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ImageRecipe) LateInitialize(attrs []byte) (bool, error) { - params := &ImageRecipeParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ImageRecipe) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InfrastructureConfiguration -func (mg *InfrastructureConfiguration) GetTerraformResourceType() string { - return "aws_imagebuilder_infrastructure_configuration" -} - -// GetConnectionDetailsMapping for this InfrastructureConfiguration -func (tr *InfrastructureConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InfrastructureConfiguration -func (tr *InfrastructureConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InfrastructureConfiguration -func (tr *InfrastructureConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InfrastructureConfiguration -func (tr *InfrastructureConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InfrastructureConfiguration -func (tr *InfrastructureConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InfrastructureConfiguration -func (tr *InfrastructureConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InfrastructureConfiguration -func (tr *InfrastructureConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InfrastructureConfiguration -func (tr *InfrastructureConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InfrastructureConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InfrastructureConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &InfrastructureConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InfrastructureConfiguration) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/imagebuilder/v1beta1/zz_image_terraformed.go b/apis/imagebuilder/v1beta1/zz_image_terraformed.go new file mode 100755 index 0000000000..202175abd7 --- /dev/null +++ b/apis/imagebuilder/v1beta1/zz_image_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Image +func (mg *Image) GetTerraformResourceType() string { + return "aws_imagebuilder_image" +} + +// GetConnectionDetailsMapping for this Image +func (tr *Image) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Image +func (tr *Image) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Image +func (tr *Image) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Image +func (tr *Image) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Image +func (tr *Image) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Image +func (tr *Image) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Image +func (tr *Image) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Image +func (tr *Image) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Image using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Image) LateInitialize(attrs []byte) (bool, error) { + params := &ImageParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Image) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/imagebuilder/v1beta1/zz_image_types.go b/apis/imagebuilder/v1beta1/zz_image_types.go index 455fd6de4c..c89ad36c6e 100755 --- a/apis/imagebuilder/v1beta1/zz_image_types.go +++ b/apis/imagebuilder/v1beta1/zz_image_types.go @@ -300,13 +300,14 @@ type ImageStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Image is the Schema for the Images API. Manages an Image Builder Image // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Image struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/imagebuilder/v1beta1/zz_imagepipeline_terraformed.go b/apis/imagebuilder/v1beta1/zz_imagepipeline_terraformed.go new file mode 100755 index 0000000000..1304603680 --- /dev/null +++ b/apis/imagebuilder/v1beta1/zz_imagepipeline_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ImagePipeline +func (mg *ImagePipeline) GetTerraformResourceType() string { + return "aws_imagebuilder_image_pipeline" +} + +// GetConnectionDetailsMapping for this ImagePipeline +func (tr *ImagePipeline) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ImagePipeline +func (tr *ImagePipeline) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ImagePipeline +func (tr *ImagePipeline) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ImagePipeline +func (tr *ImagePipeline) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ImagePipeline +func (tr *ImagePipeline) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ImagePipeline +func (tr *ImagePipeline) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ImagePipeline +func (tr *ImagePipeline) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ImagePipeline +func (tr *ImagePipeline) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ImagePipeline using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ImagePipeline) LateInitialize(attrs []byte) (bool, error) { + params := &ImagePipelineParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ImagePipeline) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/imagebuilder/v1beta1/zz_imagepipeline_types.go b/apis/imagebuilder/v1beta1/zz_imagepipeline_types.go index 00cb27d0f1..125af9db5d 100755 --- a/apis/imagebuilder/v1beta1/zz_imagepipeline_types.go +++ b/apis/imagebuilder/v1beta1/zz_imagepipeline_types.go @@ -300,13 +300,14 @@ type ImagePipelineStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ImagePipeline is the Schema for the ImagePipelines API. Manages an Image Builder Image Pipeline // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ImagePipeline struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/imagebuilder/v1beta1/zz_imagerecipe_terraformed.go b/apis/imagebuilder/v1beta1/zz_imagerecipe_terraformed.go new file mode 100755 index 0000000000..f4c5205381 --- /dev/null +++ b/apis/imagebuilder/v1beta1/zz_imagerecipe_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ImageRecipe +func (mg *ImageRecipe) GetTerraformResourceType() string { + return "aws_imagebuilder_image_recipe" +} + +// GetConnectionDetailsMapping for this ImageRecipe +func (tr *ImageRecipe) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ImageRecipe +func (tr *ImageRecipe) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ImageRecipe +func (tr *ImageRecipe) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ImageRecipe +func (tr *ImageRecipe) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ImageRecipe +func (tr *ImageRecipe) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ImageRecipe +func (tr *ImageRecipe) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ImageRecipe +func (tr *ImageRecipe) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ImageRecipe +func (tr *ImageRecipe) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ImageRecipe using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ImageRecipe) LateInitialize(attrs []byte) (bool, error) { + params := &ImageRecipeParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ImageRecipe) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/imagebuilder/v1beta1/zz_imagerecipe_types.go b/apis/imagebuilder/v1beta1/zz_imagerecipe_types.go index 87953db299..94833a5863 100755 --- a/apis/imagebuilder/v1beta1/zz_imagerecipe_types.go +++ b/apis/imagebuilder/v1beta1/zz_imagerecipe_types.go @@ -411,13 +411,14 @@ type ImageRecipeStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ImageRecipe is the Schema for the ImageRecipes API. Manage an Image Builder Image Recipe // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ImageRecipe struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/imagebuilder/v1beta1/zz_infrastructureconfiguration_terraformed.go b/apis/imagebuilder/v1beta1/zz_infrastructureconfiguration_terraformed.go new file mode 100755 index 0000000000..cf3fc7b802 --- /dev/null +++ b/apis/imagebuilder/v1beta1/zz_infrastructureconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InfrastructureConfiguration +func (mg *InfrastructureConfiguration) GetTerraformResourceType() string { + return "aws_imagebuilder_infrastructure_configuration" +} + +// GetConnectionDetailsMapping for this InfrastructureConfiguration +func (tr *InfrastructureConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InfrastructureConfiguration +func (tr *InfrastructureConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InfrastructureConfiguration +func (tr *InfrastructureConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InfrastructureConfiguration +func (tr *InfrastructureConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InfrastructureConfiguration +func (tr *InfrastructureConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InfrastructureConfiguration +func (tr *InfrastructureConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InfrastructureConfiguration +func (tr *InfrastructureConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InfrastructureConfiguration +func (tr *InfrastructureConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InfrastructureConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InfrastructureConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &InfrastructureConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InfrastructureConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/imagebuilder/v1beta1/zz_infrastructureconfiguration_types.go b/apis/imagebuilder/v1beta1/zz_infrastructureconfiguration_types.go index d149bea27a..f93a94aa51 100755 --- a/apis/imagebuilder/v1beta1/zz_infrastructureconfiguration_types.go +++ b/apis/imagebuilder/v1beta1/zz_infrastructureconfiguration_types.go @@ -404,13 +404,14 @@ type InfrastructureConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InfrastructureConfiguration is the Schema for the InfrastructureConfigurations API. Manages an Image Builder Infrastructure Configuration // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InfrastructureConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/inspector/v1beta1/zz_assessmenttarget_terraformed.go b/apis/inspector/v1beta1/zz_assessmenttarget_terraformed.go new file mode 100755 index 0000000000..b45f30db5b --- /dev/null +++ b/apis/inspector/v1beta1/zz_assessmenttarget_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AssessmentTarget +func (mg *AssessmentTarget) GetTerraformResourceType() string { + return "aws_inspector_assessment_target" +} + +// GetConnectionDetailsMapping for this AssessmentTarget +func (tr *AssessmentTarget) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AssessmentTarget +func (tr *AssessmentTarget) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AssessmentTarget +func (tr *AssessmentTarget) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AssessmentTarget +func (tr *AssessmentTarget) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AssessmentTarget +func (tr *AssessmentTarget) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AssessmentTarget +func (tr *AssessmentTarget) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AssessmentTarget +func (tr *AssessmentTarget) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AssessmentTarget +func (tr *AssessmentTarget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AssessmentTarget using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AssessmentTarget) LateInitialize(attrs []byte) (bool, error) { + params := &AssessmentTargetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AssessmentTarget) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/inspector/v1beta1/zz_assessmenttarget_types.go b/apis/inspector/v1beta1/zz_assessmenttarget_types.go index c22b4561cd..24d6864cc1 100755 --- a/apis/inspector/v1beta1/zz_assessmenttarget_types.go +++ b/apis/inspector/v1beta1/zz_assessmenttarget_types.go @@ -100,13 +100,14 @@ type AssessmentTargetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AssessmentTarget is the Schema for the AssessmentTargets API. Provides an Inspector Classic Assessment Target. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AssessmentTarget struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/inspector/v1beta1/zz_assessmenttemplate_terraformed.go b/apis/inspector/v1beta1/zz_assessmenttemplate_terraformed.go new file mode 100755 index 0000000000..6664f76a8d --- /dev/null +++ b/apis/inspector/v1beta1/zz_assessmenttemplate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AssessmentTemplate +func (mg *AssessmentTemplate) GetTerraformResourceType() string { + return "aws_inspector_assessment_template" +} + +// GetConnectionDetailsMapping for this AssessmentTemplate +func (tr *AssessmentTemplate) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AssessmentTemplate +func (tr *AssessmentTemplate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AssessmentTemplate +func (tr *AssessmentTemplate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AssessmentTemplate +func (tr *AssessmentTemplate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AssessmentTemplate +func (tr *AssessmentTemplate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AssessmentTemplate +func (tr *AssessmentTemplate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AssessmentTemplate +func (tr *AssessmentTemplate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AssessmentTemplate +func (tr *AssessmentTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AssessmentTemplate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AssessmentTemplate) LateInitialize(attrs []byte) (bool, error) { + params := &AssessmentTemplateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AssessmentTemplate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/inspector/v1beta1/zz_assessmenttemplate_types.go b/apis/inspector/v1beta1/zz_assessmenttemplate_types.go index ce7acebe94..89d9c63571 100755 --- a/apis/inspector/v1beta1/zz_assessmenttemplate_types.go +++ b/apis/inspector/v1beta1/zz_assessmenttemplate_types.go @@ -199,13 +199,14 @@ type AssessmentTemplateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AssessmentTemplate is the Schema for the AssessmentTemplates API. Provides an Inspector Classic Assessment Template. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AssessmentTemplate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/inspector/v1beta1/zz_generated.conversion_hubs.go b/apis/inspector/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..db0c9d06cd --- /dev/null +++ b/apis/inspector/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AssessmentTarget) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *AssessmentTemplate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResourceGroup) Hub() {} diff --git a/apis/inspector/v1beta1/zz_generated_terraformed.go b/apis/inspector/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index e82fc97c6e..0000000000 --- a/apis/inspector/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AssessmentTarget -func (mg *AssessmentTarget) GetTerraformResourceType() string { - return "aws_inspector_assessment_target" -} - -// GetConnectionDetailsMapping for this AssessmentTarget -func (tr *AssessmentTarget) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AssessmentTarget -func (tr *AssessmentTarget) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AssessmentTarget -func (tr *AssessmentTarget) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AssessmentTarget -func (tr *AssessmentTarget) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AssessmentTarget -func (tr *AssessmentTarget) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AssessmentTarget -func (tr *AssessmentTarget) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AssessmentTarget -func (tr *AssessmentTarget) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AssessmentTarget -func (tr *AssessmentTarget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AssessmentTarget using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AssessmentTarget) LateInitialize(attrs []byte) (bool, error) { - params := &AssessmentTargetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AssessmentTarget) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this AssessmentTemplate -func (mg *AssessmentTemplate) GetTerraformResourceType() string { - return "aws_inspector_assessment_template" -} - -// GetConnectionDetailsMapping for this AssessmentTemplate -func (tr *AssessmentTemplate) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AssessmentTemplate -func (tr *AssessmentTemplate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AssessmentTemplate -func (tr *AssessmentTemplate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AssessmentTemplate -func (tr *AssessmentTemplate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AssessmentTemplate -func (tr *AssessmentTemplate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AssessmentTemplate -func (tr *AssessmentTemplate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AssessmentTemplate -func (tr *AssessmentTemplate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AssessmentTemplate -func (tr *AssessmentTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AssessmentTemplate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AssessmentTemplate) LateInitialize(attrs []byte) (bool, error) { - params := &AssessmentTemplateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AssessmentTemplate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ResourceGroup -func (mg *ResourceGroup) GetTerraformResourceType() string { - return "aws_inspector_resource_group" -} - -// GetConnectionDetailsMapping for this ResourceGroup -func (tr *ResourceGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResourceGroup -func (tr *ResourceGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResourceGroup -func (tr *ResourceGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResourceGroup -func (tr *ResourceGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResourceGroup -func (tr *ResourceGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResourceGroup -func (tr *ResourceGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResourceGroup -func (tr *ResourceGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResourceGroup -func (tr *ResourceGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResourceGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResourceGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ResourceGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResourceGroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/inspector/v1beta1/zz_resourcegroup_terraformed.go b/apis/inspector/v1beta1/zz_resourcegroup_terraformed.go new file mode 100755 index 0000000000..1c3f9d52b7 --- /dev/null +++ b/apis/inspector/v1beta1/zz_resourcegroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResourceGroup +func (mg *ResourceGroup) GetTerraformResourceType() string { + return "aws_inspector_resource_group" +} + +// GetConnectionDetailsMapping for this ResourceGroup +func (tr *ResourceGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResourceGroup +func (tr *ResourceGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResourceGroup +func (tr *ResourceGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResourceGroup +func (tr *ResourceGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResourceGroup +func (tr *ResourceGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResourceGroup +func (tr *ResourceGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResourceGroup +func (tr *ResourceGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResourceGroup +func (tr *ResourceGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResourceGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResourceGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ResourceGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResourceGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/inspector/v1beta1/zz_resourcegroup_types.go b/apis/inspector/v1beta1/zz_resourcegroup_types.go index c62222c2aa..acbc7e469e 100755 --- a/apis/inspector/v1beta1/zz_resourcegroup_types.go +++ b/apis/inspector/v1beta1/zz_resourcegroup_types.go @@ -73,13 +73,14 @@ type ResourceGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResourceGroup is the Schema for the ResourceGroups API. Provides an Amazon Inspector Classic Resource Group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResourceGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/inspector2/v1beta1/zz_generated_terraformed.go b/apis/inspector2/v1beta1/zz_enabler_terraformed.go similarity index 100% rename from apis/inspector2/v1beta1/zz_generated_terraformed.go rename to apis/inspector2/v1beta1/zz_enabler_terraformed.go diff --git a/apis/inspector2/v1beta1/zz_enabler_types.go b/apis/inspector2/v1beta1/zz_enabler_types.go index 5c7b48b55a..2dd387ea43 100755 --- a/apis/inspector2/v1beta1/zz_enabler_types.go +++ b/apis/inspector2/v1beta1/zz_enabler_types.go @@ -92,13 +92,14 @@ type EnablerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Enabler is the Schema for the Enablers API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Enabler struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/inspector2/v1beta1/zz_generated.conversion_hubs.go b/apis/inspector2/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..10360e46d9 --- /dev/null +++ b/apis/inspector2/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Enabler) Hub() {} diff --git a/apis/iot/v1beta1/zz_certificate_terraformed.go b/apis/iot/v1beta1/zz_certificate_terraformed.go new file mode 100755 index 0000000000..cfa93d612b --- /dev/null +++ b/apis/iot/v1beta1/zz_certificate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Certificate +func (mg *Certificate) GetTerraformResourceType() string { + return "aws_iot_certificate" +} + +// GetConnectionDetailsMapping for this Certificate +func (tr *Certificate) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"ca_pem": "spec.forProvider.caPemSecretRef", "certificate_pem": "spec.forProvider.certificatePemSecretRef", "private_key": "status.atProvider.privateKey", "public_key": "status.atProvider.publicKey"} +} + +// GetObservation of this Certificate +func (tr *Certificate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Certificate +func (tr *Certificate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Certificate +func (tr *Certificate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Certificate +func (tr *Certificate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Certificate +func (tr *Certificate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Certificate +func (tr *Certificate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Certificate +func (tr *Certificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Certificate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Certificate) LateInitialize(attrs []byte) (bool, error) { + params := &CertificateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Certificate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_certificate_types.go b/apis/iot/v1beta1/zz_certificate_types.go index bdff95a576..f7214d80c1 100755 --- a/apis/iot/v1beta1/zz_certificate_types.go +++ b/apis/iot/v1beta1/zz_certificate_types.go @@ -105,13 +105,14 @@ type CertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Certificate is the Schema for the Certificates API. Creates and manages an AWS IoT certificate. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Certificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_generated.conversion_hubs.go b/apis/iot/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..a664648471 --- /dev/null +++ b/apis/iot/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Certificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *IndexingConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LoggingOptions) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Policy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PolicyAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ProvisioningTemplate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RoleAlias) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Thing) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ThingGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ThingGroupMembership) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ThingPrincipalAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ThingType) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TopicRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TopicRuleDestination) Hub() {} diff --git a/apis/iot/v1beta1/zz_generated_terraformed.go b/apis/iot/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index c87830512c..0000000000 --- a/apis/iot/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1615 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Certificate -func (mg *Certificate) GetTerraformResourceType() string { - return "aws_iot_certificate" -} - -// GetConnectionDetailsMapping for this Certificate -func (tr *Certificate) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"ca_pem": "spec.forProvider.caPemSecretRef", "certificate_pem": "spec.forProvider.certificatePemSecretRef", "private_key": "status.atProvider.privateKey", "public_key": "status.atProvider.publicKey"} -} - -// GetObservation of this Certificate -func (tr *Certificate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Certificate -func (tr *Certificate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Certificate -func (tr *Certificate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Certificate -func (tr *Certificate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Certificate -func (tr *Certificate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Certificate -func (tr *Certificate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Certificate -func (tr *Certificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Certificate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Certificate) LateInitialize(attrs []byte) (bool, error) { - params := &CertificateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Certificate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this IndexingConfiguration -func (mg *IndexingConfiguration) GetTerraformResourceType() string { - return "aws_iot_indexing_configuration" -} - -// GetConnectionDetailsMapping for this IndexingConfiguration -func (tr *IndexingConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this IndexingConfiguration -func (tr *IndexingConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this IndexingConfiguration -func (tr *IndexingConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this IndexingConfiguration -func (tr *IndexingConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this IndexingConfiguration -func (tr *IndexingConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this IndexingConfiguration -func (tr *IndexingConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this IndexingConfiguration -func (tr *IndexingConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this IndexingConfiguration -func (tr *IndexingConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this IndexingConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *IndexingConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &IndexingConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *IndexingConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LoggingOptions -func (mg *LoggingOptions) GetTerraformResourceType() string { - return "aws_iot_logging_options" -} - -// GetConnectionDetailsMapping for this LoggingOptions -func (tr *LoggingOptions) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LoggingOptions -func (tr *LoggingOptions) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LoggingOptions -func (tr *LoggingOptions) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LoggingOptions -func (tr *LoggingOptions) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LoggingOptions -func (tr *LoggingOptions) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LoggingOptions -func (tr *LoggingOptions) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LoggingOptions -func (tr *LoggingOptions) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LoggingOptions -func (tr *LoggingOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LoggingOptions using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LoggingOptions) LateInitialize(attrs []byte) (bool, error) { - params := &LoggingOptionsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LoggingOptions) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Policy -func (mg *Policy) GetTerraformResourceType() string { - return "aws_iot_policy" -} - -// GetConnectionDetailsMapping for this Policy -func (tr *Policy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Policy -func (tr *Policy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Policy -func (tr *Policy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Policy -func (tr *Policy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Policy -func (tr *Policy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Policy -func (tr *Policy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Policy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { - params := &PolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Policy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PolicyAttachment -func (mg *PolicyAttachment) GetTerraformResourceType() string { - return "aws_iot_policy_attachment" -} - -// GetConnectionDetailsMapping for this PolicyAttachment -func (tr *PolicyAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PolicyAttachment -func (tr *PolicyAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PolicyAttachment -func (tr *PolicyAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PolicyAttachment -func (tr *PolicyAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PolicyAttachment -func (tr *PolicyAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PolicyAttachment -func (tr *PolicyAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PolicyAttachment -func (tr *PolicyAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PolicyAttachment -func (tr *PolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PolicyAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PolicyAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &PolicyAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PolicyAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ProvisioningTemplate -func (mg *ProvisioningTemplate) GetTerraformResourceType() string { - return "aws_iot_provisioning_template" -} - -// GetConnectionDetailsMapping for this ProvisioningTemplate -func (tr *ProvisioningTemplate) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ProvisioningTemplate -func (tr *ProvisioningTemplate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ProvisioningTemplate -func (tr *ProvisioningTemplate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ProvisioningTemplate -func (tr *ProvisioningTemplate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ProvisioningTemplate -func (tr *ProvisioningTemplate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ProvisioningTemplate -func (tr *ProvisioningTemplate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ProvisioningTemplate -func (tr *ProvisioningTemplate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ProvisioningTemplate -func (tr *ProvisioningTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ProvisioningTemplate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ProvisioningTemplate) LateInitialize(attrs []byte) (bool, error) { - params := &ProvisioningTemplateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ProvisioningTemplate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RoleAlias -func (mg *RoleAlias) GetTerraformResourceType() string { - return "aws_iot_role_alias" -} - -// GetConnectionDetailsMapping for this RoleAlias -func (tr *RoleAlias) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RoleAlias -func (tr *RoleAlias) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RoleAlias -func (tr *RoleAlias) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RoleAlias -func (tr *RoleAlias) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RoleAlias -func (tr *RoleAlias) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RoleAlias -func (tr *RoleAlias) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RoleAlias -func (tr *RoleAlias) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RoleAlias -func (tr *RoleAlias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RoleAlias using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RoleAlias) LateInitialize(attrs []byte) (bool, error) { - params := &RoleAliasParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RoleAlias) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Thing -func (mg *Thing) GetTerraformResourceType() string { - return "aws_iot_thing" -} - -// GetConnectionDetailsMapping for this Thing -func (tr *Thing) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Thing -func (tr *Thing) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Thing -func (tr *Thing) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Thing -func (tr *Thing) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Thing -func (tr *Thing) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Thing -func (tr *Thing) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Thing -func (tr *Thing) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Thing -func (tr *Thing) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Thing using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Thing) LateInitialize(attrs []byte) (bool, error) { - params := &ThingParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Thing) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ThingGroup -func (mg *ThingGroup) GetTerraformResourceType() string { - return "aws_iot_thing_group" -} - -// GetConnectionDetailsMapping for this ThingGroup -func (tr *ThingGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ThingGroup -func (tr *ThingGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ThingGroup -func (tr *ThingGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ThingGroup -func (tr *ThingGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ThingGroup -func (tr *ThingGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ThingGroup -func (tr *ThingGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ThingGroup -func (tr *ThingGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ThingGroup -func (tr *ThingGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ThingGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ThingGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ThingGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ThingGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ThingGroupMembership -func (mg *ThingGroupMembership) GetTerraformResourceType() string { - return "aws_iot_thing_group_membership" -} - -// GetConnectionDetailsMapping for this ThingGroupMembership -func (tr *ThingGroupMembership) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ThingGroupMembership -func (tr *ThingGroupMembership) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ThingGroupMembership -func (tr *ThingGroupMembership) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ThingGroupMembership -func (tr *ThingGroupMembership) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ThingGroupMembership -func (tr *ThingGroupMembership) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ThingGroupMembership -func (tr *ThingGroupMembership) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ThingGroupMembership -func (tr *ThingGroupMembership) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ThingGroupMembership -func (tr *ThingGroupMembership) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ThingGroupMembership using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ThingGroupMembership) LateInitialize(attrs []byte) (bool, error) { - params := &ThingGroupMembershipParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ThingGroupMembership) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ThingPrincipalAttachment -func (mg *ThingPrincipalAttachment) GetTerraformResourceType() string { - return "aws_iot_thing_principal_attachment" -} - -// GetConnectionDetailsMapping for this ThingPrincipalAttachment -func (tr *ThingPrincipalAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ThingPrincipalAttachment -func (tr *ThingPrincipalAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ThingPrincipalAttachment -func (tr *ThingPrincipalAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ThingPrincipalAttachment -func (tr *ThingPrincipalAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ThingPrincipalAttachment -func (tr *ThingPrincipalAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ThingPrincipalAttachment -func (tr *ThingPrincipalAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ThingPrincipalAttachment -func (tr *ThingPrincipalAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ThingPrincipalAttachment -func (tr *ThingPrincipalAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ThingPrincipalAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ThingPrincipalAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &ThingPrincipalAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ThingPrincipalAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ThingType -func (mg *ThingType) GetTerraformResourceType() string { - return "aws_iot_thing_type" -} - -// GetConnectionDetailsMapping for this ThingType -func (tr *ThingType) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ThingType -func (tr *ThingType) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ThingType -func (tr *ThingType) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ThingType -func (tr *ThingType) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ThingType -func (tr *ThingType) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ThingType -func (tr *ThingType) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ThingType -func (tr *ThingType) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ThingType -func (tr *ThingType) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ThingType using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ThingType) LateInitialize(attrs []byte) (bool, error) { - params := &ThingTypeParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ThingType) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TopicRule -func (mg *TopicRule) GetTerraformResourceType() string { - return "aws_iot_topic_rule" -} - -// GetConnectionDetailsMapping for this TopicRule -func (tr *TopicRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TopicRule -func (tr *TopicRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TopicRule -func (tr *TopicRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TopicRule -func (tr *TopicRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TopicRule -func (tr *TopicRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TopicRule -func (tr *TopicRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TopicRule -func (tr *TopicRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TopicRule -func (tr *TopicRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TopicRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TopicRule) LateInitialize(attrs []byte) (bool, error) { - params := &TopicRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TopicRule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TopicRuleDestination -func (mg *TopicRuleDestination) GetTerraformResourceType() string { - return "aws_iot_topic_rule_destination" -} - -// GetConnectionDetailsMapping for this TopicRuleDestination -func (tr *TopicRuleDestination) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TopicRuleDestination -func (tr *TopicRuleDestination) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TopicRuleDestination -func (tr *TopicRuleDestination) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TopicRuleDestination -func (tr *TopicRuleDestination) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TopicRuleDestination -func (tr *TopicRuleDestination) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TopicRuleDestination -func (tr *TopicRuleDestination) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TopicRuleDestination -func (tr *TopicRuleDestination) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TopicRuleDestination -func (tr *TopicRuleDestination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TopicRuleDestination using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TopicRuleDestination) LateInitialize(attrs []byte) (bool, error) { - params := &TopicRuleDestinationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TopicRuleDestination) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/iot/v1beta1/zz_indexingconfiguration_terraformed.go b/apis/iot/v1beta1/zz_indexingconfiguration_terraformed.go new file mode 100755 index 0000000000..d6422f54c3 --- /dev/null +++ b/apis/iot/v1beta1/zz_indexingconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this IndexingConfiguration +func (mg *IndexingConfiguration) GetTerraformResourceType() string { + return "aws_iot_indexing_configuration" +} + +// GetConnectionDetailsMapping for this IndexingConfiguration +func (tr *IndexingConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this IndexingConfiguration +func (tr *IndexingConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this IndexingConfiguration +func (tr *IndexingConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this IndexingConfiguration +func (tr *IndexingConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this IndexingConfiguration +func (tr *IndexingConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this IndexingConfiguration +func (tr *IndexingConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this IndexingConfiguration +func (tr *IndexingConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this IndexingConfiguration +func (tr *IndexingConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this IndexingConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *IndexingConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &IndexingConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *IndexingConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_indexingconfiguration_types.go b/apis/iot/v1beta1/zz_indexingconfiguration_types.go index dd2a493875..4a4768cba8 100755 --- a/apis/iot/v1beta1/zz_indexingconfiguration_types.go +++ b/apis/iot/v1beta1/zz_indexingconfiguration_types.go @@ -300,13 +300,14 @@ type IndexingConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IndexingConfiguration is the Schema for the IndexingConfigurations API. Managing IoT Thing indexing. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type IndexingConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_loggingoptions_terraformed.go b/apis/iot/v1beta1/zz_loggingoptions_terraformed.go new file mode 100755 index 0000000000..74781c3499 --- /dev/null +++ b/apis/iot/v1beta1/zz_loggingoptions_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LoggingOptions +func (mg *LoggingOptions) GetTerraformResourceType() string { + return "aws_iot_logging_options" +} + +// GetConnectionDetailsMapping for this LoggingOptions +func (tr *LoggingOptions) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LoggingOptions +func (tr *LoggingOptions) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LoggingOptions +func (tr *LoggingOptions) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LoggingOptions +func (tr *LoggingOptions) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LoggingOptions +func (tr *LoggingOptions) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LoggingOptions +func (tr *LoggingOptions) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LoggingOptions +func (tr *LoggingOptions) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LoggingOptions +func (tr *LoggingOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LoggingOptions using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LoggingOptions) LateInitialize(attrs []byte) (bool, error) { + params := &LoggingOptionsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LoggingOptions) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_loggingoptions_types.go b/apis/iot/v1beta1/zz_loggingoptions_types.go index fd3e521804..dbbe7e8d46 100755 --- a/apis/iot/v1beta1/zz_loggingoptions_types.go +++ b/apis/iot/v1beta1/zz_loggingoptions_types.go @@ -107,13 +107,14 @@ type LoggingOptionsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LoggingOptions is the Schema for the LoggingOptionss API. Provides a resource to manage default logging options. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LoggingOptions struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_policy_terraformed.go b/apis/iot/v1beta1/zz_policy_terraformed.go new file mode 100755 index 0000000000..5feb636b43 --- /dev/null +++ b/apis/iot/v1beta1/zz_policy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Policy +func (mg *Policy) GetTerraformResourceType() string { + return "aws_iot_policy" +} + +// GetConnectionDetailsMapping for this Policy +func (tr *Policy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Policy +func (tr *Policy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Policy +func (tr *Policy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Policy +func (tr *Policy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Policy +func (tr *Policy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Policy +func (tr *Policy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Policy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { + params := &PolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Policy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_policy_types.go b/apis/iot/v1beta1/zz_policy_types.go index 19716509ca..cc9108d17d 100755 --- a/apis/iot/v1beta1/zz_policy_types.go +++ b/apis/iot/v1beta1/zz_policy_types.go @@ -73,13 +73,14 @@ type PolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Policy is the Schema for the Policys API. Provides an IoT policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Policy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_policyattachment_terraformed.go b/apis/iot/v1beta1/zz_policyattachment_terraformed.go new file mode 100755 index 0000000000..6bde65075a --- /dev/null +++ b/apis/iot/v1beta1/zz_policyattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PolicyAttachment +func (mg *PolicyAttachment) GetTerraformResourceType() string { + return "aws_iot_policy_attachment" +} + +// GetConnectionDetailsMapping for this PolicyAttachment +func (tr *PolicyAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PolicyAttachment +func (tr *PolicyAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PolicyAttachment +func (tr *PolicyAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PolicyAttachment +func (tr *PolicyAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PolicyAttachment +func (tr *PolicyAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PolicyAttachment +func (tr *PolicyAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PolicyAttachment +func (tr *PolicyAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PolicyAttachment +func (tr *PolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PolicyAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PolicyAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &PolicyAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PolicyAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_policyattachment_types.go b/apis/iot/v1beta1/zz_policyattachment_types.go index 3651603a74..be31768e0b 100755 --- a/apis/iot/v1beta1/zz_policyattachment_types.go +++ b/apis/iot/v1beta1/zz_policyattachment_types.go @@ -114,13 +114,14 @@ type PolicyAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PolicyAttachment is the Schema for the PolicyAttachments API. Provides an IoT policy attachment. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PolicyAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_provisioningtemplate_terraformed.go b/apis/iot/v1beta1/zz_provisioningtemplate_terraformed.go new file mode 100755 index 0000000000..e64e1eca33 --- /dev/null +++ b/apis/iot/v1beta1/zz_provisioningtemplate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ProvisioningTemplate +func (mg *ProvisioningTemplate) GetTerraformResourceType() string { + return "aws_iot_provisioning_template" +} + +// GetConnectionDetailsMapping for this ProvisioningTemplate +func (tr *ProvisioningTemplate) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ProvisioningTemplate +func (tr *ProvisioningTemplate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ProvisioningTemplate +func (tr *ProvisioningTemplate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ProvisioningTemplate +func (tr *ProvisioningTemplate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ProvisioningTemplate +func (tr *ProvisioningTemplate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ProvisioningTemplate +func (tr *ProvisioningTemplate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ProvisioningTemplate +func (tr *ProvisioningTemplate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ProvisioningTemplate +func (tr *ProvisioningTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ProvisioningTemplate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ProvisioningTemplate) LateInitialize(attrs []byte) (bool, error) { + params := &ProvisioningTemplateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ProvisioningTemplate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_provisioningtemplate_types.go b/apis/iot/v1beta1/zz_provisioningtemplate_types.go index bfcdc91d2c..0882c22b4b 100755 --- a/apis/iot/v1beta1/zz_provisioningtemplate_types.go +++ b/apis/iot/v1beta1/zz_provisioningtemplate_types.go @@ -179,13 +179,14 @@ type ProvisioningTemplateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ProvisioningTemplate is the Schema for the ProvisioningTemplates API. Manages an IoT fleet provisioning template. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ProvisioningTemplate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_rolealias_terraformed.go b/apis/iot/v1beta1/zz_rolealias_terraformed.go new file mode 100755 index 0000000000..c85e60ad0e --- /dev/null +++ b/apis/iot/v1beta1/zz_rolealias_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RoleAlias +func (mg *RoleAlias) GetTerraformResourceType() string { + return "aws_iot_role_alias" +} + +// GetConnectionDetailsMapping for this RoleAlias +func (tr *RoleAlias) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RoleAlias +func (tr *RoleAlias) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RoleAlias +func (tr *RoleAlias) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RoleAlias +func (tr *RoleAlias) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RoleAlias +func (tr *RoleAlias) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RoleAlias +func (tr *RoleAlias) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RoleAlias +func (tr *RoleAlias) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RoleAlias +func (tr *RoleAlias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RoleAlias using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RoleAlias) LateInitialize(attrs []byte) (bool, error) { + params := &RoleAliasParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RoleAlias) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_rolealias_types.go b/apis/iot/v1beta1/zz_rolealias_types.go index 3aca81d3c4..9e23422136 100755 --- a/apis/iot/v1beta1/zz_rolealias_types.go +++ b/apis/iot/v1beta1/zz_rolealias_types.go @@ -110,13 +110,14 @@ type RoleAliasStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RoleAlias is the Schema for the RoleAliass API. Provides an IoT role alias. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RoleAlias struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_thing_terraformed.go b/apis/iot/v1beta1/zz_thing_terraformed.go new file mode 100755 index 0000000000..f2ca6de355 --- /dev/null +++ b/apis/iot/v1beta1/zz_thing_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Thing +func (mg *Thing) GetTerraformResourceType() string { + return "aws_iot_thing" +} + +// GetConnectionDetailsMapping for this Thing +func (tr *Thing) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Thing +func (tr *Thing) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Thing +func (tr *Thing) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Thing +func (tr *Thing) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Thing +func (tr *Thing) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Thing +func (tr *Thing) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Thing +func (tr *Thing) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Thing +func (tr *Thing) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Thing using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Thing) LateInitialize(attrs []byte) (bool, error) { + params := &ThingParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Thing) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_thing_types.go b/apis/iot/v1beta1/zz_thing_types.go index 5a827218d6..2aaebba303 100755 --- a/apis/iot/v1beta1/zz_thing_types.go +++ b/apis/iot/v1beta1/zz_thing_types.go @@ -89,13 +89,14 @@ type ThingStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Thing is the Schema for the Things API. Creates and manages an AWS IoT Thing. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Thing struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_thinggroup_terraformed.go b/apis/iot/v1beta1/zz_thinggroup_terraformed.go new file mode 100755 index 0000000000..47403c127c --- /dev/null +++ b/apis/iot/v1beta1/zz_thinggroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ThingGroup +func (mg *ThingGroup) GetTerraformResourceType() string { + return "aws_iot_thing_group" +} + +// GetConnectionDetailsMapping for this ThingGroup +func (tr *ThingGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ThingGroup +func (tr *ThingGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ThingGroup +func (tr *ThingGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ThingGroup +func (tr *ThingGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ThingGroup +func (tr *ThingGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ThingGroup +func (tr *ThingGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ThingGroup +func (tr *ThingGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ThingGroup +func (tr *ThingGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ThingGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ThingGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ThingGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ThingGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_thinggroup_types.go b/apis/iot/v1beta1/zz_thinggroup_types.go index 869b3be87f..542f4cb209 100755 --- a/apis/iot/v1beta1/zz_thinggroup_types.go +++ b/apis/iot/v1beta1/zz_thinggroup_types.go @@ -201,13 +201,14 @@ type ThingGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ThingGroup is the Schema for the ThingGroups API. Manages an AWS IoT Thing Group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ThingGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_thinggroupmembership_terraformed.go b/apis/iot/v1beta1/zz_thinggroupmembership_terraformed.go new file mode 100755 index 0000000000..f6d72f34f3 --- /dev/null +++ b/apis/iot/v1beta1/zz_thinggroupmembership_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ThingGroupMembership +func (mg *ThingGroupMembership) GetTerraformResourceType() string { + return "aws_iot_thing_group_membership" +} + +// GetConnectionDetailsMapping for this ThingGroupMembership +func (tr *ThingGroupMembership) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ThingGroupMembership +func (tr *ThingGroupMembership) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ThingGroupMembership +func (tr *ThingGroupMembership) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ThingGroupMembership +func (tr *ThingGroupMembership) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ThingGroupMembership +func (tr *ThingGroupMembership) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ThingGroupMembership +func (tr *ThingGroupMembership) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ThingGroupMembership +func (tr *ThingGroupMembership) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ThingGroupMembership +func (tr *ThingGroupMembership) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ThingGroupMembership using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ThingGroupMembership) LateInitialize(attrs []byte) (bool, error) { + params := &ThingGroupMembershipParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ThingGroupMembership) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_thinggroupmembership_types.go b/apis/iot/v1beta1/zz_thinggroupmembership_types.go index 82210bc4fb..41b4d6e2a8 100755 --- a/apis/iot/v1beta1/zz_thinggroupmembership_types.go +++ b/apis/iot/v1beta1/zz_thinggroupmembership_types.go @@ -88,13 +88,14 @@ type ThingGroupMembershipStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ThingGroupMembership is the Schema for the ThingGroupMemberships API. Adds an IoT Thing to an IoT Thing Group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ThingGroupMembership struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_thingprincipalattachment_terraformed.go b/apis/iot/v1beta1/zz_thingprincipalattachment_terraformed.go new file mode 100755 index 0000000000..057baf81f8 --- /dev/null +++ b/apis/iot/v1beta1/zz_thingprincipalattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ThingPrincipalAttachment +func (mg *ThingPrincipalAttachment) GetTerraformResourceType() string { + return "aws_iot_thing_principal_attachment" +} + +// GetConnectionDetailsMapping for this ThingPrincipalAttachment +func (tr *ThingPrincipalAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ThingPrincipalAttachment +func (tr *ThingPrincipalAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ThingPrincipalAttachment +func (tr *ThingPrincipalAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ThingPrincipalAttachment +func (tr *ThingPrincipalAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ThingPrincipalAttachment +func (tr *ThingPrincipalAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ThingPrincipalAttachment +func (tr *ThingPrincipalAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ThingPrincipalAttachment +func (tr *ThingPrincipalAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ThingPrincipalAttachment +func (tr *ThingPrincipalAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ThingPrincipalAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ThingPrincipalAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &ThingPrincipalAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ThingPrincipalAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_thingprincipalattachment_types.go b/apis/iot/v1beta1/zz_thingprincipalattachment_types.go index 31625a3157..769d125ca9 100755 --- a/apis/iot/v1beta1/zz_thingprincipalattachment_types.go +++ b/apis/iot/v1beta1/zz_thingprincipalattachment_types.go @@ -114,13 +114,14 @@ type ThingPrincipalAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ThingPrincipalAttachment is the Schema for the ThingPrincipalAttachments API. Provides AWS IoT Thing Principal attachment. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ThingPrincipalAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_thingtype_terraformed.go b/apis/iot/v1beta1/zz_thingtype_terraformed.go new file mode 100755 index 0000000000..3bdf3a0cdb --- /dev/null +++ b/apis/iot/v1beta1/zz_thingtype_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ThingType +func (mg *ThingType) GetTerraformResourceType() string { + return "aws_iot_thing_type" +} + +// GetConnectionDetailsMapping for this ThingType +func (tr *ThingType) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ThingType +func (tr *ThingType) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ThingType +func (tr *ThingType) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ThingType +func (tr *ThingType) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ThingType +func (tr *ThingType) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ThingType +func (tr *ThingType) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ThingType +func (tr *ThingType) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ThingType +func (tr *ThingType) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ThingType using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ThingType) LateInitialize(attrs []byte) (bool, error) { + params := &ThingTypeParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ThingType) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_thingtype_types.go b/apis/iot/v1beta1/zz_thingtype_types.go index 25e0be57d2..490c5aafb6 100755 --- a/apis/iot/v1beta1/zz_thingtype_types.go +++ b/apis/iot/v1beta1/zz_thingtype_types.go @@ -139,13 +139,14 @@ type ThingTypeStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ThingType is the Schema for the ThingTypes API. Creates and manages an AWS IoT Thing Type. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ThingType struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_topicrule_terraformed.go b/apis/iot/v1beta1/zz_topicrule_terraformed.go new file mode 100755 index 0000000000..b66a253452 --- /dev/null +++ b/apis/iot/v1beta1/zz_topicrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TopicRule +func (mg *TopicRule) GetTerraformResourceType() string { + return "aws_iot_topic_rule" +} + +// GetConnectionDetailsMapping for this TopicRule +func (tr *TopicRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TopicRule +func (tr *TopicRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TopicRule +func (tr *TopicRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TopicRule +func (tr *TopicRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TopicRule +func (tr *TopicRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TopicRule +func (tr *TopicRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TopicRule +func (tr *TopicRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TopicRule +func (tr *TopicRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TopicRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TopicRule) LateInitialize(attrs []byte) (bool, error) { + params := &TopicRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TopicRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_topicrule_types.go b/apis/iot/v1beta1/zz_topicrule_types.go index fb92cd0531..12350a3f70 100755 --- a/apis/iot/v1beta1/zz_topicrule_types.go +++ b/apis/iot/v1beta1/zz_topicrule_types.go @@ -2500,13 +2500,14 @@ type TopicRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TopicRule is the Schema for the TopicRules API. Creates and manages an AWS IoT topic rule // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TopicRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/iot/v1beta1/zz_topicruledestination_terraformed.go b/apis/iot/v1beta1/zz_topicruledestination_terraformed.go new file mode 100755 index 0000000000..7b4f51e17c --- /dev/null +++ b/apis/iot/v1beta1/zz_topicruledestination_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TopicRuleDestination +func (mg *TopicRuleDestination) GetTerraformResourceType() string { + return "aws_iot_topic_rule_destination" +} + +// GetConnectionDetailsMapping for this TopicRuleDestination +func (tr *TopicRuleDestination) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TopicRuleDestination +func (tr *TopicRuleDestination) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TopicRuleDestination +func (tr *TopicRuleDestination) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TopicRuleDestination +func (tr *TopicRuleDestination) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TopicRuleDestination +func (tr *TopicRuleDestination) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TopicRuleDestination +func (tr *TopicRuleDestination) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TopicRuleDestination +func (tr *TopicRuleDestination) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TopicRuleDestination +func (tr *TopicRuleDestination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TopicRuleDestination using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TopicRuleDestination) LateInitialize(attrs []byte) (bool, error) { + params := &TopicRuleDestinationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TopicRuleDestination) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/iot/v1beta1/zz_topicruledestination_types.go b/apis/iot/v1beta1/zz_topicruledestination_types.go index 6689710e8d..4fcac2f6bb 100755 --- a/apis/iot/v1beta1/zz_topicruledestination_types.go +++ b/apis/iot/v1beta1/zz_topicruledestination_types.go @@ -219,13 +219,14 @@ type TopicRuleDestinationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TopicRuleDestination is the Schema for the TopicRuleDestinations API. Creates and manages an AWS IoT topic rule destination // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TopicRuleDestination struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ivs/v1beta1/zz_channel_terraformed.go b/apis/ivs/v1beta1/zz_channel_terraformed.go new file mode 100755 index 0000000000..f0f70f04e1 --- /dev/null +++ b/apis/ivs/v1beta1/zz_channel_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Channel +func (mg *Channel) GetTerraformResourceType() string { + return "aws_ivs_channel" +} + +// GetConnectionDetailsMapping for this Channel +func (tr *Channel) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Channel +func (tr *Channel) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Channel +func (tr *Channel) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Channel +func (tr *Channel) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Channel +func (tr *Channel) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Channel +func (tr *Channel) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Channel +func (tr *Channel) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Channel +func (tr *Channel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Channel using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Channel) LateInitialize(attrs []byte) (bool, error) { + params := &ChannelParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Channel) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ivs/v1beta1/zz_channel_types.go b/apis/ivs/v1beta1/zz_channel_types.go index b2545053af..a501a02452 100755 --- a/apis/ivs/v1beta1/zz_channel_types.go +++ b/apis/ivs/v1beta1/zz_channel_types.go @@ -133,13 +133,14 @@ type ChannelStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Channel is the Schema for the Channels API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Channel struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ivs/v1beta1/zz_generated.conversion_hubs.go b/apis/ivs/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..d8014a3e55 --- /dev/null +++ b/apis/ivs/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Channel) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RecordingConfiguration) Hub() {} diff --git a/apis/ivs/v1beta1/zz_generated_terraformed.go b/apis/ivs/v1beta1/zz_recordingconfiguration_terraformed.go similarity index 54% rename from apis/ivs/v1beta1/zz_generated_terraformed.go rename to apis/ivs/v1beta1/zz_recordingconfiguration_terraformed.go index 3b8d806e0a..fe86686379 100755 --- a/apis/ivs/v1beta1/zz_generated_terraformed.go +++ b/apis/ivs/v1beta1/zz_recordingconfiguration_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Channel -func (mg *Channel) GetTerraformResourceType() string { - return "aws_ivs_channel" -} - -// GetConnectionDetailsMapping for this Channel -func (tr *Channel) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Channel -func (tr *Channel) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Channel -func (tr *Channel) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Channel -func (tr *Channel) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Channel -func (tr *Channel) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Channel -func (tr *Channel) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Channel -func (tr *Channel) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Channel -func (tr *Channel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Channel using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Channel) LateInitialize(attrs []byte) (bool, error) { - params := &ChannelParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Channel) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this RecordingConfiguration func (mg *RecordingConfiguration) GetTerraformResourceType() string { return "aws_ivs_recording_configuration" diff --git a/apis/ivs/v1beta1/zz_recordingconfiguration_types.go b/apis/ivs/v1beta1/zz_recordingconfiguration_types.go index 22c99dbb6f..38742bf951 100755 --- a/apis/ivs/v1beta1/zz_recordingconfiguration_types.go +++ b/apis/ivs/v1beta1/zz_recordingconfiguration_types.go @@ -187,13 +187,14 @@ type RecordingConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RecordingConfiguration is the Schema for the RecordingConfigurations API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RecordingConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kafka/v1beta1/zz_cluster_terraformed.go b/apis/kafka/v1beta1/zz_cluster_terraformed.go new file mode 100755 index 0000000000..0a307ac42d --- /dev/null +++ b/apis/kafka/v1beta1/zz_cluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cluster +func (mg *Cluster) GetTerraformResourceType() string { + return "aws_msk_cluster" +} + +// GetConnectionDetailsMapping for this Cluster +func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Cluster +func (tr *Cluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cluster +func (tr *Cluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cluster +func (tr *Cluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cluster +func (tr *Cluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cluster +func (tr *Cluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kafka/v1beta1/zz_cluster_types.go b/apis/kafka/v1beta1/zz_cluster_types.go index d040b3002c..18ff4e3ab3 100755 --- a/apis/kafka/v1beta1/zz_cluster_types.go +++ b/apis/kafka/v1beta1/zz_cluster_types.go @@ -956,13 +956,14 @@ type ClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cluster is the Schema for the Clusters API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kafka/v1beta1/zz_configuration_terraformed.go b/apis/kafka/v1beta1/zz_configuration_terraformed.go new file mode 100755 index 0000000000..5b38c88f37 --- /dev/null +++ b/apis/kafka/v1beta1/zz_configuration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Configuration +func (mg *Configuration) GetTerraformResourceType() string { + return "aws_msk_configuration" +} + +// GetConnectionDetailsMapping for this Configuration +func (tr *Configuration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Configuration +func (tr *Configuration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Configuration +func (tr *Configuration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Configuration +func (tr *Configuration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Configuration +func (tr *Configuration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Configuration +func (tr *Configuration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Configuration +func (tr *Configuration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Configuration +func (tr *Configuration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Configuration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Configuration) LateInitialize(attrs []byte) (bool, error) { + params := &ConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Configuration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kafka/v1beta1/zz_configuration_types.go b/apis/kafka/v1beta1/zz_configuration_types.go index 01b5cbd76d..348d773d63 100755 --- a/apis/kafka/v1beta1/zz_configuration_types.go +++ b/apis/kafka/v1beta1/zz_configuration_types.go @@ -106,13 +106,14 @@ type ConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Configuration is the Schema for the Configurations API. provider resource for managing an amazon managed streaming for kafka configuration // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Configuration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kafka/v1beta1/zz_generated.conversion_hubs.go b/apis/kafka/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..241a2d3816 --- /dev/null +++ b/apis/kafka/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Cluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Configuration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ScramSecretAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ServerlessCluster) Hub() {} diff --git a/apis/kafka/v1beta1/zz_generated_terraformed.go b/apis/kafka/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 9f79016c87..0000000000 --- a/apis/kafka/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Cluster -func (mg *Cluster) GetTerraformResourceType() string { - return "aws_msk_cluster" -} - -// GetConnectionDetailsMapping for this Cluster -func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Cluster -func (tr *Cluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cluster -func (tr *Cluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cluster -func (tr *Cluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cluster -func (tr *Cluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cluster -func (tr *Cluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Configuration -func (mg *Configuration) GetTerraformResourceType() string { - return "aws_msk_configuration" -} - -// GetConnectionDetailsMapping for this Configuration -func (tr *Configuration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Configuration -func (tr *Configuration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Configuration -func (tr *Configuration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Configuration -func (tr *Configuration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Configuration -func (tr *Configuration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Configuration -func (tr *Configuration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Configuration -func (tr *Configuration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Configuration -func (tr *Configuration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Configuration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Configuration) LateInitialize(attrs []byte) (bool, error) { - params := &ConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Configuration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ScramSecretAssociation -func (mg *ScramSecretAssociation) GetTerraformResourceType() string { - return "aws_msk_scram_secret_association" -} - -// GetConnectionDetailsMapping for this ScramSecretAssociation -func (tr *ScramSecretAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ScramSecretAssociation -func (tr *ScramSecretAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ScramSecretAssociation -func (tr *ScramSecretAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ScramSecretAssociation -func (tr *ScramSecretAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ScramSecretAssociation -func (tr *ScramSecretAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ScramSecretAssociation -func (tr *ScramSecretAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ScramSecretAssociation -func (tr *ScramSecretAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ScramSecretAssociation -func (tr *ScramSecretAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ScramSecretAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ScramSecretAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &ScramSecretAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ScramSecretAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ServerlessCluster -func (mg *ServerlessCluster) GetTerraformResourceType() string { - return "aws_msk_serverless_cluster" -} - -// GetConnectionDetailsMapping for this ServerlessCluster -func (tr *ServerlessCluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ServerlessCluster -func (tr *ServerlessCluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ServerlessCluster -func (tr *ServerlessCluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ServerlessCluster -func (tr *ServerlessCluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ServerlessCluster -func (tr *ServerlessCluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ServerlessCluster -func (tr *ServerlessCluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ServerlessCluster -func (tr *ServerlessCluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ServerlessCluster -func (tr *ServerlessCluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ServerlessCluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ServerlessCluster) LateInitialize(attrs []byte) (bool, error) { - params := &ServerlessClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ServerlessCluster) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/kafka/v1beta1/zz_scramsecretassociation_terraformed.go b/apis/kafka/v1beta1/zz_scramsecretassociation_terraformed.go new file mode 100755 index 0000000000..7389f79873 --- /dev/null +++ b/apis/kafka/v1beta1/zz_scramsecretassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ScramSecretAssociation +func (mg *ScramSecretAssociation) GetTerraformResourceType() string { + return "aws_msk_scram_secret_association" +} + +// GetConnectionDetailsMapping for this ScramSecretAssociation +func (tr *ScramSecretAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ScramSecretAssociation +func (tr *ScramSecretAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ScramSecretAssociation +func (tr *ScramSecretAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ScramSecretAssociation +func (tr *ScramSecretAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ScramSecretAssociation +func (tr *ScramSecretAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ScramSecretAssociation +func (tr *ScramSecretAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ScramSecretAssociation +func (tr *ScramSecretAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ScramSecretAssociation +func (tr *ScramSecretAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ScramSecretAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ScramSecretAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &ScramSecretAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ScramSecretAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kafka/v1beta1/zz_scramsecretassociation_types.go b/apis/kafka/v1beta1/zz_scramsecretassociation_types.go index 85ffcbe498..3cc8e7c789 100755 --- a/apis/kafka/v1beta1/zz_scramsecretassociation_types.go +++ b/apis/kafka/v1beta1/zz_scramsecretassociation_types.go @@ -123,13 +123,14 @@ type ScramSecretAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ScramSecretAssociation is the Schema for the ScramSecretAssociations API. Associates SCRAM secrets with a Managed Streaming for Kafka (MSK) cluster. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ScramSecretAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kafka/v1beta1/zz_serverlesscluster_terraformed.go b/apis/kafka/v1beta1/zz_serverlesscluster_terraformed.go new file mode 100755 index 0000000000..d1bad15dd0 --- /dev/null +++ b/apis/kafka/v1beta1/zz_serverlesscluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ServerlessCluster +func (mg *ServerlessCluster) GetTerraformResourceType() string { + return "aws_msk_serverless_cluster" +} + +// GetConnectionDetailsMapping for this ServerlessCluster +func (tr *ServerlessCluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ServerlessCluster +func (tr *ServerlessCluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ServerlessCluster +func (tr *ServerlessCluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ServerlessCluster +func (tr *ServerlessCluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ServerlessCluster +func (tr *ServerlessCluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ServerlessCluster +func (tr *ServerlessCluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ServerlessCluster +func (tr *ServerlessCluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ServerlessCluster +func (tr *ServerlessCluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ServerlessCluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ServerlessCluster) LateInitialize(attrs []byte) (bool, error) { + params := &ServerlessClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ServerlessCluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kafka/v1beta1/zz_serverlesscluster_types.go b/apis/kafka/v1beta1/zz_serverlesscluster_types.go index 5a1279c7ac..08ea1483ad 100755 --- a/apis/kafka/v1beta1/zz_serverlesscluster_types.go +++ b/apis/kafka/v1beta1/zz_serverlesscluster_types.go @@ -243,13 +243,14 @@ type ServerlessClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ServerlessCluster is the Schema for the ServerlessClusters API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ServerlessCluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kendra/v1beta1/zz_datasource_terraformed.go b/apis/kendra/v1beta1/zz_datasource_terraformed.go new file mode 100755 index 0000000000..8987ab6b1c --- /dev/null +++ b/apis/kendra/v1beta1/zz_datasource_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DataSource +func (mg *DataSource) GetTerraformResourceType() string { + return "aws_kendra_data_source" +} + +// GetConnectionDetailsMapping for this DataSource +func (tr *DataSource) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DataSource +func (tr *DataSource) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DataSource +func (tr *DataSource) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DataSource +func (tr *DataSource) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DataSource +func (tr *DataSource) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DataSource +func (tr *DataSource) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DataSource +func (tr *DataSource) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DataSource +func (tr *DataSource) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DataSource using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DataSource) LateInitialize(attrs []byte) (bool, error) { + params := &DataSourceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DataSource) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kendra/v1beta1/zz_datasource_types.go b/apis/kendra/v1beta1/zz_datasource_types.go index 3a948ca354..2f0b466d7d 100755 --- a/apis/kendra/v1beta1/zz_datasource_types.go +++ b/apis/kendra/v1beta1/zz_datasource_types.go @@ -1234,13 +1234,14 @@ type DataSourceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DataSource is the Schema for the DataSources API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DataSource struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kendra/v1beta1/zz_experience_terraformed.go b/apis/kendra/v1beta1/zz_experience_terraformed.go new file mode 100755 index 0000000000..cc923a64b2 --- /dev/null +++ b/apis/kendra/v1beta1/zz_experience_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Experience +func (mg *Experience) GetTerraformResourceType() string { + return "aws_kendra_experience" +} + +// GetConnectionDetailsMapping for this Experience +func (tr *Experience) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Experience +func (tr *Experience) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Experience +func (tr *Experience) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Experience +func (tr *Experience) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Experience +func (tr *Experience) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Experience +func (tr *Experience) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Experience +func (tr *Experience) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Experience +func (tr *Experience) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Experience using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Experience) LateInitialize(attrs []byte) (bool, error) { + params := &ExperienceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Experience) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kendra/v1beta1/zz_experience_types.go b/apis/kendra/v1beta1/zz_experience_types.go index ed5a297a29..a5a0c9cd5b 100755 --- a/apis/kendra/v1beta1/zz_experience_types.go +++ b/apis/kendra/v1beta1/zz_experience_types.go @@ -268,13 +268,14 @@ type ExperienceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Experience is the Schema for the Experiences API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Experience struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kendra/v1beta1/zz_generated.conversion_hubs.go b/apis/kendra/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..06bd116e8b --- /dev/null +++ b/apis/kendra/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *DataSource) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Experience) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Index) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *QuerySuggestionsBlockList) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Thesaurus) Hub() {} diff --git a/apis/kendra/v1beta1/zz_generated_terraformed.go b/apis/kendra/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 9d2a12a422..0000000000 --- a/apis/kendra/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,589 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this DataSource -func (mg *DataSource) GetTerraformResourceType() string { - return "aws_kendra_data_source" -} - -// GetConnectionDetailsMapping for this DataSource -func (tr *DataSource) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DataSource -func (tr *DataSource) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DataSource -func (tr *DataSource) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DataSource -func (tr *DataSource) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DataSource -func (tr *DataSource) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DataSource -func (tr *DataSource) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DataSource -func (tr *DataSource) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DataSource -func (tr *DataSource) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DataSource using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DataSource) LateInitialize(attrs []byte) (bool, error) { - params := &DataSourceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DataSource) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Experience -func (mg *Experience) GetTerraformResourceType() string { - return "aws_kendra_experience" -} - -// GetConnectionDetailsMapping for this Experience -func (tr *Experience) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Experience -func (tr *Experience) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Experience -func (tr *Experience) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Experience -func (tr *Experience) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Experience -func (tr *Experience) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Experience -func (tr *Experience) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Experience -func (tr *Experience) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Experience -func (tr *Experience) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Experience using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Experience) LateInitialize(attrs []byte) (bool, error) { - params := &ExperienceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Experience) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Index -func (mg *Index) GetTerraformResourceType() string { - return "aws_kendra_index" -} - -// GetConnectionDetailsMapping for this Index -func (tr *Index) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Index -func (tr *Index) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Index -func (tr *Index) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Index -func (tr *Index) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Index -func (tr *Index) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Index -func (tr *Index) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Index -func (tr *Index) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Index -func (tr *Index) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Index using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Index) LateInitialize(attrs []byte) (bool, error) { - params := &IndexParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Index) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this QuerySuggestionsBlockList -func (mg *QuerySuggestionsBlockList) GetTerraformResourceType() string { - return "aws_kendra_query_suggestions_block_list" -} - -// GetConnectionDetailsMapping for this QuerySuggestionsBlockList -func (tr *QuerySuggestionsBlockList) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this QuerySuggestionsBlockList -func (tr *QuerySuggestionsBlockList) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this QuerySuggestionsBlockList -func (tr *QuerySuggestionsBlockList) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this QuerySuggestionsBlockList -func (tr *QuerySuggestionsBlockList) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this QuerySuggestionsBlockList -func (tr *QuerySuggestionsBlockList) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this QuerySuggestionsBlockList -func (tr *QuerySuggestionsBlockList) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this QuerySuggestionsBlockList -func (tr *QuerySuggestionsBlockList) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this QuerySuggestionsBlockList -func (tr *QuerySuggestionsBlockList) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this QuerySuggestionsBlockList using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *QuerySuggestionsBlockList) LateInitialize(attrs []byte) (bool, error) { - params := &QuerySuggestionsBlockListParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *QuerySuggestionsBlockList) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Thesaurus -func (mg *Thesaurus) GetTerraformResourceType() string { - return "aws_kendra_thesaurus" -} - -// GetConnectionDetailsMapping for this Thesaurus -func (tr *Thesaurus) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Thesaurus -func (tr *Thesaurus) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Thesaurus -func (tr *Thesaurus) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Thesaurus -func (tr *Thesaurus) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Thesaurus -func (tr *Thesaurus) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Thesaurus -func (tr *Thesaurus) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Thesaurus -func (tr *Thesaurus) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Thesaurus -func (tr *Thesaurus) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Thesaurus using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Thesaurus) LateInitialize(attrs []byte) (bool, error) { - params := &ThesaurusParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Thesaurus) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/kendra/v1beta1/zz_index_terraformed.go b/apis/kendra/v1beta1/zz_index_terraformed.go new file mode 100755 index 0000000000..56404ac0ce --- /dev/null +++ b/apis/kendra/v1beta1/zz_index_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Index +func (mg *Index) GetTerraformResourceType() string { + return "aws_kendra_index" +} + +// GetConnectionDetailsMapping for this Index +func (tr *Index) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Index +func (tr *Index) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Index +func (tr *Index) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Index +func (tr *Index) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Index +func (tr *Index) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Index +func (tr *Index) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Index +func (tr *Index) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Index +func (tr *Index) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Index using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Index) LateInitialize(attrs []byte) (bool, error) { + params := &IndexParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Index) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kendra/v1beta1/zz_index_types.go b/apis/kendra/v1beta1/zz_index_types.go index 234c231221..5c71e2fa3c 100755 --- a/apis/kendra/v1beta1/zz_index_types.go +++ b/apis/kendra/v1beta1/zz_index_types.go @@ -619,13 +619,14 @@ type IndexStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Index is the Schema for the Indexs API. Provides an Amazon Kendra Index resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Index struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kendra/v1beta1/zz_querysuggestionsblocklist_terraformed.go b/apis/kendra/v1beta1/zz_querysuggestionsblocklist_terraformed.go new file mode 100755 index 0000000000..f5ce6fc8f6 --- /dev/null +++ b/apis/kendra/v1beta1/zz_querysuggestionsblocklist_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this QuerySuggestionsBlockList +func (mg *QuerySuggestionsBlockList) GetTerraformResourceType() string { + return "aws_kendra_query_suggestions_block_list" +} + +// GetConnectionDetailsMapping for this QuerySuggestionsBlockList +func (tr *QuerySuggestionsBlockList) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this QuerySuggestionsBlockList +func (tr *QuerySuggestionsBlockList) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this QuerySuggestionsBlockList +func (tr *QuerySuggestionsBlockList) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this QuerySuggestionsBlockList +func (tr *QuerySuggestionsBlockList) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this QuerySuggestionsBlockList +func (tr *QuerySuggestionsBlockList) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this QuerySuggestionsBlockList +func (tr *QuerySuggestionsBlockList) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this QuerySuggestionsBlockList +func (tr *QuerySuggestionsBlockList) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this QuerySuggestionsBlockList +func (tr *QuerySuggestionsBlockList) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this QuerySuggestionsBlockList using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *QuerySuggestionsBlockList) LateInitialize(attrs []byte) (bool, error) { + params := &QuerySuggestionsBlockListParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *QuerySuggestionsBlockList) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kendra/v1beta1/zz_querysuggestionsblocklist_types.go b/apis/kendra/v1beta1/zz_querysuggestionsblocklist_types.go index 30a70a13ba..5e2e9dcce6 100755 --- a/apis/kendra/v1beta1/zz_querysuggestionsblocklist_types.go +++ b/apis/kendra/v1beta1/zz_querysuggestionsblocklist_types.go @@ -221,13 +221,14 @@ type QuerySuggestionsBlockListStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // QuerySuggestionsBlockList is the Schema for the QuerySuggestionsBlockLists API. provider resource for managing an aws kendra block list used for query suggestions for an index // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type QuerySuggestionsBlockList struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kendra/v1beta1/zz_thesaurus_terraformed.go b/apis/kendra/v1beta1/zz_thesaurus_terraformed.go new file mode 100755 index 0000000000..e13465e9f1 --- /dev/null +++ b/apis/kendra/v1beta1/zz_thesaurus_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Thesaurus +func (mg *Thesaurus) GetTerraformResourceType() string { + return "aws_kendra_thesaurus" +} + +// GetConnectionDetailsMapping for this Thesaurus +func (tr *Thesaurus) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Thesaurus +func (tr *Thesaurus) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Thesaurus +func (tr *Thesaurus) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Thesaurus +func (tr *Thesaurus) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Thesaurus +func (tr *Thesaurus) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Thesaurus +func (tr *Thesaurus) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Thesaurus +func (tr *Thesaurus) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Thesaurus +func (tr *Thesaurus) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Thesaurus using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Thesaurus) LateInitialize(attrs []byte) (bool, error) { + params := &ThesaurusParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Thesaurus) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kendra/v1beta1/zz_thesaurus_types.go b/apis/kendra/v1beta1/zz_thesaurus_types.go index 8c0b414f04..9292870f8a 100755 --- a/apis/kendra/v1beta1/zz_thesaurus_types.go +++ b/apis/kendra/v1beta1/zz_thesaurus_types.go @@ -243,13 +243,14 @@ type ThesaurusStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Thesaurus is the Schema for the Thesauruss API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws},path=thesaurus type Thesaurus struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/keyspaces/v1beta1/zz_generated.conversion_hubs.go b/apis/keyspaces/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..ebdf8d4871 --- /dev/null +++ b/apis/keyspaces/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Keyspace) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Table) Hub() {} diff --git a/apis/keyspaces/v1beta1/zz_generated_terraformed.go b/apis/keyspaces/v1beta1/zz_keyspace_terraformed.go similarity index 52% rename from apis/keyspaces/v1beta1/zz_generated_terraformed.go rename to apis/keyspaces/v1beta1/zz_keyspace_terraformed.go index 8b5509f921..93c660a4e1 100755 --- a/apis/keyspaces/v1beta1/zz_generated_terraformed.go +++ b/apis/keyspaces/v1beta1/zz_keyspace_terraformed.go @@ -131,117 +131,3 @@ func (tr *Keyspace) LateInitialize(attrs []byte) (bool, error) { func (tr *Keyspace) GetTerraformSchemaVersion() int { return 0 } - -// GetTerraformResourceType returns Terraform resource type for this Table -func (mg *Table) GetTerraformResourceType() string { - return "aws_keyspaces_table" -} - -// GetConnectionDetailsMapping for this Table -func (tr *Table) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Table -func (tr *Table) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Table -func (tr *Table) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Table -func (tr *Table) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Table -func (tr *Table) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Table -func (tr *Table) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Table -func (tr *Table) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Table -func (tr *Table) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Table using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Table) LateInitialize(attrs []byte) (bool, error) { - params := &TableParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Table) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/keyspaces/v1beta1/zz_keyspace_types.go b/apis/keyspaces/v1beta1/zz_keyspace_types.go index 83283f0b90..c5eb4f5c03 100755 --- a/apis/keyspaces/v1beta1/zz_keyspace_types.go +++ b/apis/keyspaces/v1beta1/zz_keyspace_types.go @@ -78,13 +78,14 @@ type KeyspaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Keyspace is the Schema for the Keyspaces API. Provides a Keyspaces Keyspace. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Keyspace struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/keyspaces/v1beta1/zz_table_terraformed.go b/apis/keyspaces/v1beta1/zz_table_terraformed.go new file mode 100755 index 0000000000..59eb140a3a --- /dev/null +++ b/apis/keyspaces/v1beta1/zz_table_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Table +func (mg *Table) GetTerraformResourceType() string { + return "aws_keyspaces_table" +} + +// GetConnectionDetailsMapping for this Table +func (tr *Table) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Table +func (tr *Table) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Table +func (tr *Table) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Table +func (tr *Table) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Table +func (tr *Table) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Table +func (tr *Table) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Table +func (tr *Table) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Table +func (tr *Table) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Table using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Table) LateInitialize(attrs []byte) (bool, error) { + params := &TableParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Table) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/keyspaces/v1beta1/zz_table_types.go b/apis/keyspaces/v1beta1/zz_table_types.go index 1b8deaaa65..c30d447f51 100755 --- a/apis/keyspaces/v1beta1/zz_table_types.go +++ b/apis/keyspaces/v1beta1/zz_table_types.go @@ -455,13 +455,14 @@ type TableStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Table is the Schema for the Tables API. Provides a Keyspaces Table. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Table struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kinesis/v1beta1/zz_generated.conversion_hubs.go b/apis/kinesis/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b5d685114d --- /dev/null +++ b/apis/kinesis/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Stream) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *StreamConsumer) Hub() {} diff --git a/apis/kinesis/v1beta1/zz_stream_terraformed.go b/apis/kinesis/v1beta1/zz_stream_terraformed.go new file mode 100755 index 0000000000..a9e2e62a31 --- /dev/null +++ b/apis/kinesis/v1beta1/zz_stream_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Stream +func (mg *Stream) GetTerraformResourceType() string { + return "aws_kinesis_stream" +} + +// GetConnectionDetailsMapping for this Stream +func (tr *Stream) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Stream +func (tr *Stream) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Stream +func (tr *Stream) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Stream +func (tr *Stream) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Stream +func (tr *Stream) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Stream +func (tr *Stream) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Stream +func (tr *Stream) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Stream +func (tr *Stream) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Stream using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Stream) LateInitialize(attrs []byte) (bool, error) { + params := &StreamParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("EnforceConsumerDeletion")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Stream) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/kinesis/v1beta1/zz_stream_types.go b/apis/kinesis/v1beta1/zz_stream_types.go index b22b19628c..ae7bb52ecc 100755 --- a/apis/kinesis/v1beta1/zz_stream_types.go +++ b/apis/kinesis/v1beta1/zz_stream_types.go @@ -191,13 +191,14 @@ type StreamStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Stream is the Schema for the Streams API. Provides a AWS Kinesis Stream // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Stream struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kinesis/v1beta1/zz_generated_terraformed.go b/apis/kinesis/v1beta1/zz_streamconsumer_terraformed.go similarity index 53% rename from apis/kinesis/v1beta1/zz_generated_terraformed.go rename to apis/kinesis/v1beta1/zz_streamconsumer_terraformed.go index df755caee7..3f423e46bb 100755 --- a/apis/kinesis/v1beta1/zz_generated_terraformed.go +++ b/apis/kinesis/v1beta1/zz_streamconsumer_terraformed.go @@ -18,121 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Stream -func (mg *Stream) GetTerraformResourceType() string { - return "aws_kinesis_stream" -} - -// GetConnectionDetailsMapping for this Stream -func (tr *Stream) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Stream -func (tr *Stream) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Stream -func (tr *Stream) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Stream -func (tr *Stream) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Stream -func (tr *Stream) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Stream -func (tr *Stream) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Stream -func (tr *Stream) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Stream -func (tr *Stream) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Stream using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Stream) LateInitialize(attrs []byte) (bool, error) { - params := &StreamParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("EnforceConsumerDeletion")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Stream) GetTerraformSchemaVersion() int { - return 1 -} - // GetTerraformResourceType returns Terraform resource type for this StreamConsumer func (mg *StreamConsumer) GetTerraformResourceType() string { return "aws_kinesis_stream_consumer" diff --git a/apis/kinesis/v1beta1/zz_streamconsumer_types.go b/apis/kinesis/v1beta1/zz_streamconsumer_types.go index 9f04d53c8c..90abb0092e 100755 --- a/apis/kinesis/v1beta1/zz_streamconsumer_types.go +++ b/apis/kinesis/v1beta1/zz_streamconsumer_types.go @@ -104,13 +104,14 @@ type StreamConsumerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // StreamConsumer is the Schema for the StreamConsumers API. Manages a Kinesis Stream Consumer. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type StreamConsumer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kinesisanalytics/v1beta1/zz_generated_terraformed.go b/apis/kinesisanalytics/v1beta1/zz_application_terraformed.go similarity index 100% rename from apis/kinesisanalytics/v1beta1/zz_generated_terraformed.go rename to apis/kinesisanalytics/v1beta1/zz_application_terraformed.go diff --git a/apis/kinesisanalytics/v1beta1/zz_application_types.go b/apis/kinesisanalytics/v1beta1/zz_application_types.go index 72c2ea890f..ed453b977f 100755 --- a/apis/kinesisanalytics/v1beta1/zz_application_types.go +++ b/apis/kinesisanalytics/v1beta1/zz_application_types.go @@ -1203,13 +1203,14 @@ type ApplicationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Application is the Schema for the Applications API. Provides a AWS Kinesis Analytics Application // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Application struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kinesisanalytics/v1beta1/zz_generated.conversion_hubs.go b/apis/kinesisanalytics/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..dfc9ca8265 --- /dev/null +++ b/apis/kinesisanalytics/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Application) Hub() {} diff --git a/apis/kinesisanalyticsv2/v1beta1/zz_application_terraformed.go b/apis/kinesisanalyticsv2/v1beta1/zz_application_terraformed.go new file mode 100755 index 0000000000..e1f4679ed9 --- /dev/null +++ b/apis/kinesisanalyticsv2/v1beta1/zz_application_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Application +func (mg *Application) GetTerraformResourceType() string { + return "aws_kinesisanalyticsv2_application" +} + +// GetConnectionDetailsMapping for this Application +func (tr *Application) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Application +func (tr *Application) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Application +func (tr *Application) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Application +func (tr *Application) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Application +func (tr *Application) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Application +func (tr *Application) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Application +func (tr *Application) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Application +func (tr *Application) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Application using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Application) LateInitialize(attrs []byte) (bool, error) { + params := &ApplicationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Application) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kinesisanalyticsv2/v1beta1/zz_application_types.go b/apis/kinesisanalyticsv2/v1beta1/zz_application_types.go index 55d5cebb5f..65b8e4eee4 100755 --- a/apis/kinesisanalyticsv2/v1beta1/zz_application_types.go +++ b/apis/kinesisanalyticsv2/v1beta1/zz_application_types.go @@ -1698,13 +1698,14 @@ type ApplicationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Application is the Schema for the Applications API. Manages a Kinesis Analytics v2 Application. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Application struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kinesisanalyticsv2/v1beta1/zz_generated_terraformed.go b/apis/kinesisanalyticsv2/v1beta1/zz_applicationsnapshot_terraformed.go similarity index 53% rename from apis/kinesisanalyticsv2/v1beta1/zz_generated_terraformed.go rename to apis/kinesisanalyticsv2/v1beta1/zz_applicationsnapshot_terraformed.go index 22778f5fdd..ab96fa87da 100755 --- a/apis/kinesisanalyticsv2/v1beta1/zz_generated_terraformed.go +++ b/apis/kinesisanalyticsv2/v1beta1/zz_applicationsnapshot_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Application -func (mg *Application) GetTerraformResourceType() string { - return "aws_kinesisanalyticsv2_application" -} - -// GetConnectionDetailsMapping for this Application -func (tr *Application) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Application -func (tr *Application) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Application -func (tr *Application) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Application -func (tr *Application) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Application -func (tr *Application) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Application -func (tr *Application) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Application -func (tr *Application) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Application -func (tr *Application) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Application using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Application) LateInitialize(attrs []byte) (bool, error) { - params := &ApplicationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Application) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this ApplicationSnapshot func (mg *ApplicationSnapshot) GetTerraformResourceType() string { return "aws_kinesisanalyticsv2_application_snapshot" diff --git a/apis/kinesisanalyticsv2/v1beta1/zz_applicationsnapshot_types.go b/apis/kinesisanalyticsv2/v1beta1/zz_applicationsnapshot_types.go index 6766067fab..b47ccc8a3b 100755 --- a/apis/kinesisanalyticsv2/v1beta1/zz_applicationsnapshot_types.go +++ b/apis/kinesisanalyticsv2/v1beta1/zz_applicationsnapshot_types.go @@ -92,13 +92,14 @@ type ApplicationSnapshotStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ApplicationSnapshot is the Schema for the ApplicationSnapshots API. Manages a Kinesis Analytics v2 Application Snapshot. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ApplicationSnapshot struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kinesisanalyticsv2/v1beta1/zz_generated.conversion_hubs.go b/apis/kinesisanalyticsv2/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..170f442211 --- /dev/null +++ b/apis/kinesisanalyticsv2/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Application) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ApplicationSnapshot) Hub() {} diff --git a/apis/kinesisvideo/v1beta1/zz_generated.conversion_hubs.go b/apis/kinesisvideo/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b41a3c6a42 --- /dev/null +++ b/apis/kinesisvideo/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Stream) Hub() {} diff --git a/apis/kinesisvideo/v1beta1/zz_generated_terraformed.go b/apis/kinesisvideo/v1beta1/zz_stream_terraformed.go similarity index 100% rename from apis/kinesisvideo/v1beta1/zz_generated_terraformed.go rename to apis/kinesisvideo/v1beta1/zz_stream_terraformed.go diff --git a/apis/kinesisvideo/v1beta1/zz_stream_types.go b/apis/kinesisvideo/v1beta1/zz_stream_types.go index 66950b8413..97db84f725 100755 --- a/apis/kinesisvideo/v1beta1/zz_stream_types.go +++ b/apis/kinesisvideo/v1beta1/zz_stream_types.go @@ -155,13 +155,14 @@ type StreamStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Stream is the Schema for the Streams API. Provides a AWS Kinesis Video Stream // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Stream struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kms/v1beta1/zz_alias_terraformed.go b/apis/kms/v1beta1/zz_alias_terraformed.go new file mode 100755 index 0000000000..b31eeec125 --- /dev/null +++ b/apis/kms/v1beta1/zz_alias_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Alias +func (mg *Alias) GetTerraformResourceType() string { + return "aws_kms_alias" +} + +// GetConnectionDetailsMapping for this Alias +func (tr *Alias) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Alias +func (tr *Alias) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Alias +func (tr *Alias) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Alias +func (tr *Alias) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Alias +func (tr *Alias) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Alias +func (tr *Alias) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Alias +func (tr *Alias) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Alias +func (tr *Alias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Alias using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Alias) LateInitialize(attrs []byte) (bool, error) { + params := &AliasParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Alias) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kms/v1beta1/zz_alias_types.go b/apis/kms/v1beta1/zz_alias_types.go index aabb510d6f..5366dad515 100755 --- a/apis/kms/v1beta1/zz_alias_types.go +++ b/apis/kms/v1beta1/zz_alias_types.go @@ -91,13 +91,14 @@ type AliasStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Alias is the Schema for the Aliass API. Provides a display name for a customer master key. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Alias struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kms/v1beta1/zz_ciphertext_terraformed.go b/apis/kms/v1beta1/zz_ciphertext_terraformed.go new file mode 100755 index 0000000000..f763d7671e --- /dev/null +++ b/apis/kms/v1beta1/zz_ciphertext_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Ciphertext +func (mg *Ciphertext) GetTerraformResourceType() string { + return "aws_kms_ciphertext" +} + +// GetConnectionDetailsMapping for this Ciphertext +func (tr *Ciphertext) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"plaintext": "spec.forProvider.plaintextSecretRef"} +} + +// GetObservation of this Ciphertext +func (tr *Ciphertext) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Ciphertext +func (tr *Ciphertext) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Ciphertext +func (tr *Ciphertext) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Ciphertext +func (tr *Ciphertext) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Ciphertext +func (tr *Ciphertext) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Ciphertext +func (tr *Ciphertext) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Ciphertext +func (tr *Ciphertext) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Ciphertext using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Ciphertext) LateInitialize(attrs []byte) (bool, error) { + params := &CiphertextParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Ciphertext) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kms/v1beta1/zz_ciphertext_types.go b/apis/kms/v1beta1/zz_ciphertext_types.go index 5cd05fee24..7d33b5c63e 100755 --- a/apis/kms/v1beta1/zz_ciphertext_types.go +++ b/apis/kms/v1beta1/zz_ciphertext_types.go @@ -105,13 +105,14 @@ type CiphertextStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Ciphertext is the Schema for the Ciphertexts API. Provides ciphertext encrypted using a KMS key // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Ciphertext struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kms/v1beta1/zz_externalkey_terraformed.go b/apis/kms/v1beta1/zz_externalkey_terraformed.go new file mode 100755 index 0000000000..9749bb7335 --- /dev/null +++ b/apis/kms/v1beta1/zz_externalkey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ExternalKey +func (mg *ExternalKey) GetTerraformResourceType() string { + return "aws_kms_external_key" +} + +// GetConnectionDetailsMapping for this ExternalKey +func (tr *ExternalKey) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"key_material_base64": "spec.forProvider.keyMaterialBase64SecretRef"} +} + +// GetObservation of this ExternalKey +func (tr *ExternalKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ExternalKey +func (tr *ExternalKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ExternalKey +func (tr *ExternalKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ExternalKey +func (tr *ExternalKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ExternalKey +func (tr *ExternalKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ExternalKey +func (tr *ExternalKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ExternalKey +func (tr *ExternalKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ExternalKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ExternalKey) LateInitialize(attrs []byte) (bool, error) { + params := &ExternalKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ExternalKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kms/v1beta1/zz_externalkey_types.go b/apis/kms/v1beta1/zz_externalkey_types.go index d67b8d7590..f9a8ab6866 100755 --- a/apis/kms/v1beta1/zz_externalkey_types.go +++ b/apis/kms/v1beta1/zz_externalkey_types.go @@ -161,13 +161,14 @@ type ExternalKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ExternalKey is the Schema for the ExternalKeys API. Manages a single-Region or multi-Region primary KMS key that uses external key material. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ExternalKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kms/v1beta1/zz_generated.conversion_hubs.go b/apis/kms/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..93fc03f108 --- /dev/null +++ b/apis/kms/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Alias) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Ciphertext) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ExternalKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Grant) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Key) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReplicaExternalKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReplicaKey) Hub() {} diff --git a/apis/kms/v1beta1/zz_generated_terraformed.go b/apis/kms/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 28a25cefbb..0000000000 --- a/apis/kms/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,817 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Alias -func (mg *Alias) GetTerraformResourceType() string { - return "aws_kms_alias" -} - -// GetConnectionDetailsMapping for this Alias -func (tr *Alias) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Alias -func (tr *Alias) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Alias -func (tr *Alias) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Alias -func (tr *Alias) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Alias -func (tr *Alias) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Alias -func (tr *Alias) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Alias -func (tr *Alias) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Alias -func (tr *Alias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Alias using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Alias) LateInitialize(attrs []byte) (bool, error) { - params := &AliasParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Alias) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Ciphertext -func (mg *Ciphertext) GetTerraformResourceType() string { - return "aws_kms_ciphertext" -} - -// GetConnectionDetailsMapping for this Ciphertext -func (tr *Ciphertext) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"plaintext": "spec.forProvider.plaintextSecretRef"} -} - -// GetObservation of this Ciphertext -func (tr *Ciphertext) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Ciphertext -func (tr *Ciphertext) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Ciphertext -func (tr *Ciphertext) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Ciphertext -func (tr *Ciphertext) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Ciphertext -func (tr *Ciphertext) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Ciphertext -func (tr *Ciphertext) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Ciphertext -func (tr *Ciphertext) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Ciphertext using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Ciphertext) LateInitialize(attrs []byte) (bool, error) { - params := &CiphertextParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Ciphertext) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ExternalKey -func (mg *ExternalKey) GetTerraformResourceType() string { - return "aws_kms_external_key" -} - -// GetConnectionDetailsMapping for this ExternalKey -func (tr *ExternalKey) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"key_material_base64": "spec.forProvider.keyMaterialBase64SecretRef"} -} - -// GetObservation of this ExternalKey -func (tr *ExternalKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ExternalKey -func (tr *ExternalKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ExternalKey -func (tr *ExternalKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ExternalKey -func (tr *ExternalKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ExternalKey -func (tr *ExternalKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ExternalKey -func (tr *ExternalKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ExternalKey -func (tr *ExternalKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ExternalKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ExternalKey) LateInitialize(attrs []byte) (bool, error) { - params := &ExternalKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ExternalKey) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Grant -func (mg *Grant) GetTerraformResourceType() string { - return "aws_kms_grant" -} - -// GetConnectionDetailsMapping for this Grant -func (tr *Grant) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Grant -func (tr *Grant) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Grant -func (tr *Grant) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Grant -func (tr *Grant) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Grant -func (tr *Grant) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Grant -func (tr *Grant) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Grant -func (tr *Grant) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Grant -func (tr *Grant) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Grant using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Grant) LateInitialize(attrs []byte) (bool, error) { - params := &GrantParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Grant) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Key -func (mg *Key) GetTerraformResourceType() string { - return "aws_kms_key" -} - -// GetConnectionDetailsMapping for this Key -func (tr *Key) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Key -func (tr *Key) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Key -func (tr *Key) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Key -func (tr *Key) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Key -func (tr *Key) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Key -func (tr *Key) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Key -func (tr *Key) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Key -func (tr *Key) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Key using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Key) LateInitialize(attrs []byte) (bool, error) { - params := &KeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Key) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReplicaExternalKey -func (mg *ReplicaExternalKey) GetTerraformResourceType() string { - return "aws_kms_replica_external_key" -} - -// GetConnectionDetailsMapping for this ReplicaExternalKey -func (tr *ReplicaExternalKey) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"key_material_base64": "spec.forProvider.keyMaterialBase64SecretRef"} -} - -// GetObservation of this ReplicaExternalKey -func (tr *ReplicaExternalKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReplicaExternalKey -func (tr *ReplicaExternalKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReplicaExternalKey -func (tr *ReplicaExternalKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReplicaExternalKey -func (tr *ReplicaExternalKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReplicaExternalKey -func (tr *ReplicaExternalKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReplicaExternalKey -func (tr *ReplicaExternalKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReplicaExternalKey -func (tr *ReplicaExternalKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReplicaExternalKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReplicaExternalKey) LateInitialize(attrs []byte) (bool, error) { - params := &ReplicaExternalKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReplicaExternalKey) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReplicaKey -func (mg *ReplicaKey) GetTerraformResourceType() string { - return "aws_kms_replica_key" -} - -// GetConnectionDetailsMapping for this ReplicaKey -func (tr *ReplicaKey) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ReplicaKey -func (tr *ReplicaKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReplicaKey -func (tr *ReplicaKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReplicaKey -func (tr *ReplicaKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReplicaKey -func (tr *ReplicaKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReplicaKey -func (tr *ReplicaKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReplicaKey -func (tr *ReplicaKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReplicaKey -func (tr *ReplicaKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReplicaKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReplicaKey) LateInitialize(attrs []byte) (bool, error) { - params := &ReplicaKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReplicaKey) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/kms/v1beta1/zz_grant_terraformed.go b/apis/kms/v1beta1/zz_grant_terraformed.go new file mode 100755 index 0000000000..16adf30adf --- /dev/null +++ b/apis/kms/v1beta1/zz_grant_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Grant +func (mg *Grant) GetTerraformResourceType() string { + return "aws_kms_grant" +} + +// GetConnectionDetailsMapping for this Grant +func (tr *Grant) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Grant +func (tr *Grant) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Grant +func (tr *Grant) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Grant +func (tr *Grant) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Grant +func (tr *Grant) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Grant +func (tr *Grant) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Grant +func (tr *Grant) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Grant +func (tr *Grant) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Grant using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Grant) LateInitialize(attrs []byte) (bool, error) { + params := &GrantParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Grant) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kms/v1beta1/zz_grant_types.go b/apis/kms/v1beta1/zz_grant_types.go index faf3bffb14..3cdd6b5efa 100755 --- a/apis/kms/v1beta1/zz_grant_types.go +++ b/apis/kms/v1beta1/zz_grant_types.go @@ -227,13 +227,14 @@ type GrantStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Grant is the Schema for the Grants API. Provides a resource-based access control mechanism for KMS Customer Master Keys. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Grant struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kms/v1beta1/zz_key_terraformed.go b/apis/kms/v1beta1/zz_key_terraformed.go new file mode 100755 index 0000000000..b4b2da8a89 --- /dev/null +++ b/apis/kms/v1beta1/zz_key_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Key +func (mg *Key) GetTerraformResourceType() string { + return "aws_kms_key" +} + +// GetConnectionDetailsMapping for this Key +func (tr *Key) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Key +func (tr *Key) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Key +func (tr *Key) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Key +func (tr *Key) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Key +func (tr *Key) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Key +func (tr *Key) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Key +func (tr *Key) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Key +func (tr *Key) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Key using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Key) LateInitialize(attrs []byte) (bool, error) { + params := &KeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Key) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kms/v1beta1/zz_key_types.go b/apis/kms/v1beta1/zz_key_types.go index caee502f2a..6e15fa9e5d 100755 --- a/apis/kms/v1beta1/zz_key_types.go +++ b/apis/kms/v1beta1/zz_key_types.go @@ -201,13 +201,14 @@ type KeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Key is the Schema for the Keys API. Manages a single-Region or multi-Region primary KMS key. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Key struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kms/v1beta1/zz_replicaexternalkey_terraformed.go b/apis/kms/v1beta1/zz_replicaexternalkey_terraformed.go new file mode 100755 index 0000000000..84fb892e57 --- /dev/null +++ b/apis/kms/v1beta1/zz_replicaexternalkey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReplicaExternalKey +func (mg *ReplicaExternalKey) GetTerraformResourceType() string { + return "aws_kms_replica_external_key" +} + +// GetConnectionDetailsMapping for this ReplicaExternalKey +func (tr *ReplicaExternalKey) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"key_material_base64": "spec.forProvider.keyMaterialBase64SecretRef"} +} + +// GetObservation of this ReplicaExternalKey +func (tr *ReplicaExternalKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReplicaExternalKey +func (tr *ReplicaExternalKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReplicaExternalKey +func (tr *ReplicaExternalKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReplicaExternalKey +func (tr *ReplicaExternalKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReplicaExternalKey +func (tr *ReplicaExternalKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReplicaExternalKey +func (tr *ReplicaExternalKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReplicaExternalKey +func (tr *ReplicaExternalKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReplicaExternalKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReplicaExternalKey) LateInitialize(attrs []byte) (bool, error) { + params := &ReplicaExternalKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReplicaExternalKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kms/v1beta1/zz_replicaexternalkey_types.go b/apis/kms/v1beta1/zz_replicaexternalkey_types.go index a77a9c9c1d..cd2054c112 100755 --- a/apis/kms/v1beta1/zz_replicaexternalkey_types.go +++ b/apis/kms/v1beta1/zz_replicaexternalkey_types.go @@ -195,13 +195,14 @@ type ReplicaExternalKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReplicaExternalKey is the Schema for the ReplicaExternalKeys API. Manages a KMS multi-Region replica key that uses external key material. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReplicaExternalKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/kms/v1beta1/zz_replicakey_terraformed.go b/apis/kms/v1beta1/zz_replicakey_terraformed.go new file mode 100755 index 0000000000..a0415fceab --- /dev/null +++ b/apis/kms/v1beta1/zz_replicakey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReplicaKey +func (mg *ReplicaKey) GetTerraformResourceType() string { + return "aws_kms_replica_key" +} + +// GetConnectionDetailsMapping for this ReplicaKey +func (tr *ReplicaKey) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReplicaKey +func (tr *ReplicaKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReplicaKey +func (tr *ReplicaKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReplicaKey +func (tr *ReplicaKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReplicaKey +func (tr *ReplicaKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReplicaKey +func (tr *ReplicaKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReplicaKey +func (tr *ReplicaKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReplicaKey +func (tr *ReplicaKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReplicaKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReplicaKey) LateInitialize(attrs []byte) (bool, error) { + params := &ReplicaKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReplicaKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/kms/v1beta1/zz_replicakey_types.go b/apis/kms/v1beta1/zz_replicakey_types.go index ff937e25f0..45f328ec2e 100755 --- a/apis/kms/v1beta1/zz_replicakey_types.go +++ b/apis/kms/v1beta1/zz_replicakey_types.go @@ -181,13 +181,14 @@ type ReplicaKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReplicaKey is the Schema for the ReplicaKeys API. Manages a KMS multi-Region replica key. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReplicaKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lakeformation/v1beta1/zz_datalakesettings_terraformed.go b/apis/lakeformation/v1beta1/zz_datalakesettings_terraformed.go new file mode 100755 index 0000000000..e2a1454ecd --- /dev/null +++ b/apis/lakeformation/v1beta1/zz_datalakesettings_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DataLakeSettings +func (mg *DataLakeSettings) GetTerraformResourceType() string { + return "aws_lakeformation_data_lake_settings" +} + +// GetConnectionDetailsMapping for this DataLakeSettings +func (tr *DataLakeSettings) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DataLakeSettings +func (tr *DataLakeSettings) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DataLakeSettings +func (tr *DataLakeSettings) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DataLakeSettings +func (tr *DataLakeSettings) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DataLakeSettings +func (tr *DataLakeSettings) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DataLakeSettings +func (tr *DataLakeSettings) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DataLakeSettings +func (tr *DataLakeSettings) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DataLakeSettings +func (tr *DataLakeSettings) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DataLakeSettings using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DataLakeSettings) LateInitialize(attrs []byte) (bool, error) { + params := &DataLakeSettingsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DataLakeSettings) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lakeformation/v1beta1/zz_datalakesettings_types.go b/apis/lakeformation/v1beta1/zz_datalakesettings_types.go index 51a0da964e..62e7907f83 100755 --- a/apis/lakeformation/v1beta1/zz_datalakesettings_types.go +++ b/apis/lakeformation/v1beta1/zz_datalakesettings_types.go @@ -207,13 +207,14 @@ type DataLakeSettingsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DataLakeSettings is the Schema for the DataLakeSettingss API. Manages data lake administrators and default database and table permissions // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DataLakeSettings struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lakeformation/v1beta1/zz_generated.conversion_hubs.go b/apis/lakeformation/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..bbf963f6e5 --- /dev/null +++ b/apis/lakeformation/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *DataLakeSettings) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Permissions) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Resource) Hub() {} diff --git a/apis/lakeformation/v1beta1/zz_generated_terraformed.go b/apis/lakeformation/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 13a942f832..0000000000 --- a/apis/lakeformation/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this DataLakeSettings -func (mg *DataLakeSettings) GetTerraformResourceType() string { - return "aws_lakeformation_data_lake_settings" -} - -// GetConnectionDetailsMapping for this DataLakeSettings -func (tr *DataLakeSettings) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DataLakeSettings -func (tr *DataLakeSettings) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DataLakeSettings -func (tr *DataLakeSettings) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DataLakeSettings -func (tr *DataLakeSettings) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DataLakeSettings -func (tr *DataLakeSettings) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DataLakeSettings -func (tr *DataLakeSettings) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DataLakeSettings -func (tr *DataLakeSettings) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DataLakeSettings -func (tr *DataLakeSettings) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DataLakeSettings using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DataLakeSettings) LateInitialize(attrs []byte) (bool, error) { - params := &DataLakeSettingsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DataLakeSettings) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Permissions -func (mg *Permissions) GetTerraformResourceType() string { - return "aws_lakeformation_permissions" -} - -// GetConnectionDetailsMapping for this Permissions -func (tr *Permissions) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Permissions -func (tr *Permissions) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Permissions -func (tr *Permissions) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Permissions -func (tr *Permissions) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Permissions -func (tr *Permissions) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Permissions -func (tr *Permissions) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Permissions -func (tr *Permissions) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Permissions -func (tr *Permissions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Permissions using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Permissions) LateInitialize(attrs []byte) (bool, error) { - params := &PermissionsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Permissions) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Resource -func (mg *Resource) GetTerraformResourceType() string { - return "aws_lakeformation_resource" -} - -// GetConnectionDetailsMapping for this Resource -func (tr *Resource) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Resource -func (tr *Resource) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Resource -func (tr *Resource) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Resource -func (tr *Resource) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Resource -func (tr *Resource) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Resource -func (tr *Resource) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Resource -func (tr *Resource) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Resource -func (tr *Resource) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Resource using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Resource) LateInitialize(attrs []byte) (bool, error) { - params := &ResourceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Resource) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/lakeformation/v1beta1/zz_permissions_terraformed.go b/apis/lakeformation/v1beta1/zz_permissions_terraformed.go new file mode 100755 index 0000000000..7e65e3d64b --- /dev/null +++ b/apis/lakeformation/v1beta1/zz_permissions_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Permissions +func (mg *Permissions) GetTerraformResourceType() string { + return "aws_lakeformation_permissions" +} + +// GetConnectionDetailsMapping for this Permissions +func (tr *Permissions) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Permissions +func (tr *Permissions) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Permissions +func (tr *Permissions) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Permissions +func (tr *Permissions) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Permissions +func (tr *Permissions) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Permissions +func (tr *Permissions) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Permissions +func (tr *Permissions) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Permissions +func (tr *Permissions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Permissions using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Permissions) LateInitialize(attrs []byte) (bool, error) { + params := &PermissionsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Permissions) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lakeformation/v1beta1/zz_permissions_types.go b/apis/lakeformation/v1beta1/zz_permissions_types.go index d598fa6f05..dfb8f0c534 100755 --- a/apis/lakeformation/v1beta1/zz_permissions_types.go +++ b/apis/lakeformation/v1beta1/zz_permissions_types.go @@ -518,13 +518,14 @@ type PermissionsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Permissions is the Schema for the Permissionss API. Grants permissions to the principal to access metadata in the Data Catalog and data organized in underlying data storage such as Amazon S3. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Permissions struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lakeformation/v1beta1/zz_resource_terraformed.go b/apis/lakeformation/v1beta1/zz_resource_terraformed.go new file mode 100755 index 0000000000..1a150483a2 --- /dev/null +++ b/apis/lakeformation/v1beta1/zz_resource_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Resource +func (mg *Resource) GetTerraformResourceType() string { + return "aws_lakeformation_resource" +} + +// GetConnectionDetailsMapping for this Resource +func (tr *Resource) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Resource +func (tr *Resource) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Resource +func (tr *Resource) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Resource +func (tr *Resource) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Resource +func (tr *Resource) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Resource +func (tr *Resource) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Resource +func (tr *Resource) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Resource +func (tr *Resource) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Resource using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Resource) LateInitialize(attrs []byte) (bool, error) { + params := &ResourceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Resource) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lakeformation/v1beta1/zz_resource_types.go b/apis/lakeformation/v1beta1/zz_resource_types.go index ff1db2cf8e..205c435a11 100755 --- a/apis/lakeformation/v1beta1/zz_resource_types.go +++ b/apis/lakeformation/v1beta1/zz_resource_types.go @@ -100,13 +100,14 @@ type ResourceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Resource is the Schema for the Resources API. Registers a Lake Formation resource as managed by the Data Catalog. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Resource struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lambda/v1beta1/zz_alias_terraformed.go b/apis/lambda/v1beta1/zz_alias_terraformed.go new file mode 100755 index 0000000000..9451351f59 --- /dev/null +++ b/apis/lambda/v1beta1/zz_alias_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Alias +func (mg *Alias) GetTerraformResourceType() string { + return "aws_lambda_alias" +} + +// GetConnectionDetailsMapping for this Alias +func (tr *Alias) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Alias +func (tr *Alias) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Alias +func (tr *Alias) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Alias +func (tr *Alias) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Alias +func (tr *Alias) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Alias +func (tr *Alias) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Alias +func (tr *Alias) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Alias +func (tr *Alias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Alias using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Alias) LateInitialize(attrs []byte) (bool, error) { + params := &AliasParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Alias) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lambda/v1beta1/zz_alias_types.go b/apis/lambda/v1beta1/zz_alias_types.go index 3d35b5234f..4ce8d3ee48 100755 --- a/apis/lambda/v1beta1/zz_alias_types.go +++ b/apis/lambda/v1beta1/zz_alias_types.go @@ -131,13 +131,14 @@ type AliasStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Alias is the Schema for the Aliass API. Creates a Lambda function alias. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Alias struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lambda/v1beta1/zz_codesigningconfig_terraformed.go b/apis/lambda/v1beta1/zz_codesigningconfig_terraformed.go new file mode 100755 index 0000000000..8b9274352c --- /dev/null +++ b/apis/lambda/v1beta1/zz_codesigningconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CodeSigningConfig +func (mg *CodeSigningConfig) GetTerraformResourceType() string { + return "aws_lambda_code_signing_config" +} + +// GetConnectionDetailsMapping for this CodeSigningConfig +func (tr *CodeSigningConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CodeSigningConfig +func (tr *CodeSigningConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CodeSigningConfig +func (tr *CodeSigningConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CodeSigningConfig +func (tr *CodeSigningConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CodeSigningConfig +func (tr *CodeSigningConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CodeSigningConfig +func (tr *CodeSigningConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CodeSigningConfig +func (tr *CodeSigningConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CodeSigningConfig +func (tr *CodeSigningConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CodeSigningConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CodeSigningConfig) LateInitialize(attrs []byte) (bool, error) { + params := &CodeSigningConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CodeSigningConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lambda/v1beta1/zz_codesigningconfig_types.go b/apis/lambda/v1beta1/zz_codesigningconfig_types.go index 49ccea20c5..d26dd6729b 100755 --- a/apis/lambda/v1beta1/zz_codesigningconfig_types.go +++ b/apis/lambda/v1beta1/zz_codesigningconfig_types.go @@ -157,13 +157,14 @@ type CodeSigningConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CodeSigningConfig is the Schema for the CodeSigningConfigs API. Provides a Lambda Code Signing Config resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CodeSigningConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lambda/v1beta1/zz_eventsourcemapping_terraformed.go b/apis/lambda/v1beta1/zz_eventsourcemapping_terraformed.go new file mode 100755 index 0000000000..44f03dc619 --- /dev/null +++ b/apis/lambda/v1beta1/zz_eventsourcemapping_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EventSourceMapping +func (mg *EventSourceMapping) GetTerraformResourceType() string { + return "aws_lambda_event_source_mapping" +} + +// GetConnectionDetailsMapping for this EventSourceMapping +func (tr *EventSourceMapping) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EventSourceMapping +func (tr *EventSourceMapping) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EventSourceMapping +func (tr *EventSourceMapping) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EventSourceMapping +func (tr *EventSourceMapping) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EventSourceMapping +func (tr *EventSourceMapping) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EventSourceMapping +func (tr *EventSourceMapping) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EventSourceMapping +func (tr *EventSourceMapping) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EventSourceMapping +func (tr *EventSourceMapping) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EventSourceMapping using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EventSourceMapping) LateInitialize(attrs []byte) (bool, error) { + params := &EventSourceMappingParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EventSourceMapping) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lambda/v1beta1/zz_eventsourcemapping_types.go b/apis/lambda/v1beta1/zz_eventsourcemapping_types.go index e27093fac5..24c76dc494 100755 --- a/apis/lambda/v1beta1/zz_eventsourcemapping_types.go +++ b/apis/lambda/v1beta1/zz_eventsourcemapping_types.go @@ -557,13 +557,14 @@ type EventSourceMappingStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EventSourceMapping is the Schema for the EventSourceMappings API. Provides a Lambda event source mapping. This allows Lambda functions to get events from Kinesis, DynamoDB, SQS, Amazon MQ and Managed Streaming for Apache Kafka (MSK). // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EventSourceMapping struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lambda/v1beta1/zz_function_terraformed.go b/apis/lambda/v1beta1/zz_function_terraformed.go new file mode 100755 index 0000000000..c8bcaca27a --- /dev/null +++ b/apis/lambda/v1beta1/zz_function_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Function +func (mg *Function) GetTerraformResourceType() string { + return "aws_lambda_function" +} + +// GetConnectionDetailsMapping for this Function +func (tr *Function) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Function +func (tr *Function) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Function +func (tr *Function) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Function +func (tr *Function) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Function +func (tr *Function) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Function +func (tr *Function) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Function +func (tr *Function) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Function +func (tr *Function) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Function using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Function) LateInitialize(attrs []byte) (bool, error) { + params := &FunctionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Function) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lambda/v1beta1/zz_function_types.go b/apis/lambda/v1beta1/zz_function_types.go index dbb7ab754a..a481630650 100755 --- a/apis/lambda/v1beta1/zz_function_types.go +++ b/apis/lambda/v1beta1/zz_function_types.go @@ -740,13 +740,14 @@ type FunctionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Function is the Schema for the Functions API. Provides a Lambda Function resource. Lambda allows you to trigger execution of code in response to events in AWS, enabling serverless backend solutions. The Lambda Function itself includes source code and runtime configuration. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Function struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lambda/v1beta1/zz_functioneventinvokeconfig_terraformed.go b/apis/lambda/v1beta1/zz_functioneventinvokeconfig_terraformed.go new file mode 100755 index 0000000000..9b69851cba --- /dev/null +++ b/apis/lambda/v1beta1/zz_functioneventinvokeconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FunctionEventInvokeConfig +func (mg *FunctionEventInvokeConfig) GetTerraformResourceType() string { + return "aws_lambda_function_event_invoke_config" +} + +// GetConnectionDetailsMapping for this FunctionEventInvokeConfig +func (tr *FunctionEventInvokeConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FunctionEventInvokeConfig +func (tr *FunctionEventInvokeConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FunctionEventInvokeConfig +func (tr *FunctionEventInvokeConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FunctionEventInvokeConfig +func (tr *FunctionEventInvokeConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FunctionEventInvokeConfig +func (tr *FunctionEventInvokeConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FunctionEventInvokeConfig +func (tr *FunctionEventInvokeConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FunctionEventInvokeConfig +func (tr *FunctionEventInvokeConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FunctionEventInvokeConfig +func (tr *FunctionEventInvokeConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FunctionEventInvokeConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FunctionEventInvokeConfig) LateInitialize(attrs []byte) (bool, error) { + params := &FunctionEventInvokeConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FunctionEventInvokeConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lambda/v1beta1/zz_functioneventinvokeconfig_types.go b/apis/lambda/v1beta1/zz_functioneventinvokeconfig_types.go index 1a8da9e51b..55b3efa84f 100755 --- a/apis/lambda/v1beta1/zz_functioneventinvokeconfig_types.go +++ b/apis/lambda/v1beta1/zz_functioneventinvokeconfig_types.go @@ -215,13 +215,14 @@ type FunctionEventInvokeConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FunctionEventInvokeConfig is the Schema for the FunctionEventInvokeConfigs API. Manages an asynchronous invocation configuration for a Lambda Function or Alias. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FunctionEventInvokeConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lambda/v1beta1/zz_functionurl_terraformed.go b/apis/lambda/v1beta1/zz_functionurl_terraformed.go new file mode 100755 index 0000000000..3d40d30573 --- /dev/null +++ b/apis/lambda/v1beta1/zz_functionurl_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FunctionURL +func (mg *FunctionURL) GetTerraformResourceType() string { + return "aws_lambda_function_url" +} + +// GetConnectionDetailsMapping for this FunctionURL +func (tr *FunctionURL) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FunctionURL +func (tr *FunctionURL) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FunctionURL +func (tr *FunctionURL) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FunctionURL +func (tr *FunctionURL) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FunctionURL +func (tr *FunctionURL) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FunctionURL +func (tr *FunctionURL) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FunctionURL +func (tr *FunctionURL) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FunctionURL +func (tr *FunctionURL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FunctionURL using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FunctionURL) LateInitialize(attrs []byte) (bool, error) { + params := &FunctionURLParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FunctionURL) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lambda/v1beta1/zz_functionurl_types.go b/apis/lambda/v1beta1/zz_functionurl_types.go index a94bf85b60..c9944784bf 100755 --- a/apis/lambda/v1beta1/zz_functionurl_types.go +++ b/apis/lambda/v1beta1/zz_functionurl_types.go @@ -215,13 +215,14 @@ type FunctionURLStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FunctionURL is the Schema for the FunctionURLs API. Provides a Lambda function URL resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FunctionURL struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lambda/v1beta1/zz_generated.conversion_hubs.go b/apis/lambda/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..d7bab30aa1 --- /dev/null +++ b/apis/lambda/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Alias) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CodeSigningConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EventSourceMapping) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Function) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FunctionEventInvokeConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FunctionURL) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Invocation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LayerVersion) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LayerVersionPermission) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Permission) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ProvisionedConcurrencyConfig) Hub() {} diff --git a/apis/lambda/v1beta1/zz_generated_terraformed.go b/apis/lambda/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index c9b01e36ee..0000000000 --- a/apis/lambda/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1275 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Alias -func (mg *Alias) GetTerraformResourceType() string { - return "aws_lambda_alias" -} - -// GetConnectionDetailsMapping for this Alias -func (tr *Alias) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Alias -func (tr *Alias) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Alias -func (tr *Alias) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Alias -func (tr *Alias) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Alias -func (tr *Alias) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Alias -func (tr *Alias) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Alias -func (tr *Alias) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Alias -func (tr *Alias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Alias using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Alias) LateInitialize(attrs []byte) (bool, error) { - params := &AliasParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Alias) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CodeSigningConfig -func (mg *CodeSigningConfig) GetTerraformResourceType() string { - return "aws_lambda_code_signing_config" -} - -// GetConnectionDetailsMapping for this CodeSigningConfig -func (tr *CodeSigningConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CodeSigningConfig -func (tr *CodeSigningConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CodeSigningConfig -func (tr *CodeSigningConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CodeSigningConfig -func (tr *CodeSigningConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CodeSigningConfig -func (tr *CodeSigningConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CodeSigningConfig -func (tr *CodeSigningConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CodeSigningConfig -func (tr *CodeSigningConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CodeSigningConfig -func (tr *CodeSigningConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CodeSigningConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CodeSigningConfig) LateInitialize(attrs []byte) (bool, error) { - params := &CodeSigningConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CodeSigningConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EventSourceMapping -func (mg *EventSourceMapping) GetTerraformResourceType() string { - return "aws_lambda_event_source_mapping" -} - -// GetConnectionDetailsMapping for this EventSourceMapping -func (tr *EventSourceMapping) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EventSourceMapping -func (tr *EventSourceMapping) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EventSourceMapping -func (tr *EventSourceMapping) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EventSourceMapping -func (tr *EventSourceMapping) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EventSourceMapping -func (tr *EventSourceMapping) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EventSourceMapping -func (tr *EventSourceMapping) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EventSourceMapping -func (tr *EventSourceMapping) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EventSourceMapping -func (tr *EventSourceMapping) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EventSourceMapping using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EventSourceMapping) LateInitialize(attrs []byte) (bool, error) { - params := &EventSourceMappingParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EventSourceMapping) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Function -func (mg *Function) GetTerraformResourceType() string { - return "aws_lambda_function" -} - -// GetConnectionDetailsMapping for this Function -func (tr *Function) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Function -func (tr *Function) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Function -func (tr *Function) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Function -func (tr *Function) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Function -func (tr *Function) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Function -func (tr *Function) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Function -func (tr *Function) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Function -func (tr *Function) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Function using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Function) LateInitialize(attrs []byte) (bool, error) { - params := &FunctionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Function) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FunctionEventInvokeConfig -func (mg *FunctionEventInvokeConfig) GetTerraformResourceType() string { - return "aws_lambda_function_event_invoke_config" -} - -// GetConnectionDetailsMapping for this FunctionEventInvokeConfig -func (tr *FunctionEventInvokeConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FunctionEventInvokeConfig -func (tr *FunctionEventInvokeConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FunctionEventInvokeConfig -func (tr *FunctionEventInvokeConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FunctionEventInvokeConfig -func (tr *FunctionEventInvokeConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FunctionEventInvokeConfig -func (tr *FunctionEventInvokeConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FunctionEventInvokeConfig -func (tr *FunctionEventInvokeConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FunctionEventInvokeConfig -func (tr *FunctionEventInvokeConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FunctionEventInvokeConfig -func (tr *FunctionEventInvokeConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FunctionEventInvokeConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FunctionEventInvokeConfig) LateInitialize(attrs []byte) (bool, error) { - params := &FunctionEventInvokeConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FunctionEventInvokeConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FunctionURL -func (mg *FunctionURL) GetTerraformResourceType() string { - return "aws_lambda_function_url" -} - -// GetConnectionDetailsMapping for this FunctionURL -func (tr *FunctionURL) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FunctionURL -func (tr *FunctionURL) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FunctionURL -func (tr *FunctionURL) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FunctionURL -func (tr *FunctionURL) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FunctionURL -func (tr *FunctionURL) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FunctionURL -func (tr *FunctionURL) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FunctionURL -func (tr *FunctionURL) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FunctionURL -func (tr *FunctionURL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FunctionURL using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FunctionURL) LateInitialize(attrs []byte) (bool, error) { - params := &FunctionURLParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FunctionURL) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Invocation -func (mg *Invocation) GetTerraformResourceType() string { - return "aws_lambda_invocation" -} - -// GetConnectionDetailsMapping for this Invocation -func (tr *Invocation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Invocation -func (tr *Invocation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Invocation -func (tr *Invocation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Invocation -func (tr *Invocation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Invocation -func (tr *Invocation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Invocation -func (tr *Invocation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Invocation -func (tr *Invocation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Invocation -func (tr *Invocation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Invocation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Invocation) LateInitialize(attrs []byte) (bool, error) { - params := &InvocationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Invocation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LayerVersion -func (mg *LayerVersion) GetTerraformResourceType() string { - return "aws_lambda_layer_version" -} - -// GetConnectionDetailsMapping for this LayerVersion -func (tr *LayerVersion) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LayerVersion -func (tr *LayerVersion) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LayerVersion -func (tr *LayerVersion) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LayerVersion -func (tr *LayerVersion) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LayerVersion -func (tr *LayerVersion) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LayerVersion -func (tr *LayerVersion) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LayerVersion -func (tr *LayerVersion) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LayerVersion -func (tr *LayerVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LayerVersion using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LayerVersion) LateInitialize(attrs []byte) (bool, error) { - params := &LayerVersionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LayerVersion) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LayerVersionPermission -func (mg *LayerVersionPermission) GetTerraformResourceType() string { - return "aws_lambda_layer_version_permission" -} - -// GetConnectionDetailsMapping for this LayerVersionPermission -func (tr *LayerVersionPermission) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LayerVersionPermission -func (tr *LayerVersionPermission) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LayerVersionPermission -func (tr *LayerVersionPermission) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LayerVersionPermission -func (tr *LayerVersionPermission) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LayerVersionPermission -func (tr *LayerVersionPermission) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LayerVersionPermission -func (tr *LayerVersionPermission) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LayerVersionPermission -func (tr *LayerVersionPermission) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LayerVersionPermission -func (tr *LayerVersionPermission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LayerVersionPermission using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LayerVersionPermission) LateInitialize(attrs []byte) (bool, error) { - params := &LayerVersionPermissionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LayerVersionPermission) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Permission -func (mg *Permission) GetTerraformResourceType() string { - return "aws_lambda_permission" -} - -// GetConnectionDetailsMapping for this Permission -func (tr *Permission) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Permission -func (tr *Permission) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Permission -func (tr *Permission) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Permission -func (tr *Permission) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Permission -func (tr *Permission) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Permission -func (tr *Permission) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Permission -func (tr *Permission) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Permission -func (tr *Permission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Permission using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Permission) LateInitialize(attrs []byte) (bool, error) { - params := &PermissionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("StatementIDPrefix")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Permission) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ProvisionedConcurrencyConfig -func (mg *ProvisionedConcurrencyConfig) GetTerraformResourceType() string { - return "aws_lambda_provisioned_concurrency_config" -} - -// GetConnectionDetailsMapping for this ProvisionedConcurrencyConfig -func (tr *ProvisionedConcurrencyConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ProvisionedConcurrencyConfig -func (tr *ProvisionedConcurrencyConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ProvisionedConcurrencyConfig -func (tr *ProvisionedConcurrencyConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ProvisionedConcurrencyConfig -func (tr *ProvisionedConcurrencyConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ProvisionedConcurrencyConfig -func (tr *ProvisionedConcurrencyConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ProvisionedConcurrencyConfig -func (tr *ProvisionedConcurrencyConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ProvisionedConcurrencyConfig -func (tr *ProvisionedConcurrencyConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ProvisionedConcurrencyConfig -func (tr *ProvisionedConcurrencyConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ProvisionedConcurrencyConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ProvisionedConcurrencyConfig) LateInitialize(attrs []byte) (bool, error) { - params := &ProvisionedConcurrencyConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("ProvisionedConcurrentExecutions")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ProvisionedConcurrencyConfig) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/lambda/v1beta1/zz_invocation_terraformed.go b/apis/lambda/v1beta1/zz_invocation_terraformed.go new file mode 100755 index 0000000000..2191d6a5fa --- /dev/null +++ b/apis/lambda/v1beta1/zz_invocation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Invocation +func (mg *Invocation) GetTerraformResourceType() string { + return "aws_lambda_invocation" +} + +// GetConnectionDetailsMapping for this Invocation +func (tr *Invocation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Invocation +func (tr *Invocation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Invocation +func (tr *Invocation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Invocation +func (tr *Invocation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Invocation +func (tr *Invocation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Invocation +func (tr *Invocation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Invocation +func (tr *Invocation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Invocation +func (tr *Invocation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Invocation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Invocation) LateInitialize(attrs []byte) (bool, error) { + params := &InvocationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Invocation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lambda/v1beta1/zz_invocation_types.go b/apis/lambda/v1beta1/zz_invocation_types.go index 1b3a9be017..db2f9c0726 100755 --- a/apis/lambda/v1beta1/zz_invocation_types.go +++ b/apis/lambda/v1beta1/zz_invocation_types.go @@ -121,13 +121,14 @@ type InvocationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Invocation is the Schema for the Invocations API. Invoke AWS Lambda Function // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Invocation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lambda/v1beta1/zz_layerversion_terraformed.go b/apis/lambda/v1beta1/zz_layerversion_terraformed.go new file mode 100755 index 0000000000..a5adebf92e --- /dev/null +++ b/apis/lambda/v1beta1/zz_layerversion_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LayerVersion +func (mg *LayerVersion) GetTerraformResourceType() string { + return "aws_lambda_layer_version" +} + +// GetConnectionDetailsMapping for this LayerVersion +func (tr *LayerVersion) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LayerVersion +func (tr *LayerVersion) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LayerVersion +func (tr *LayerVersion) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LayerVersion +func (tr *LayerVersion) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LayerVersion +func (tr *LayerVersion) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LayerVersion +func (tr *LayerVersion) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LayerVersion +func (tr *LayerVersion) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LayerVersion +func (tr *LayerVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LayerVersion using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LayerVersion) LateInitialize(attrs []byte) (bool, error) { + params := &LayerVersionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LayerVersion) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lambda/v1beta1/zz_layerversion_types.go b/apis/lambda/v1beta1/zz_layerversion_types.go index e06827dca5..1c3b2e77c2 100755 --- a/apis/lambda/v1beta1/zz_layerversion_types.go +++ b/apis/lambda/v1beta1/zz_layerversion_types.go @@ -194,13 +194,14 @@ type LayerVersionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LayerVersion is the Schema for the LayerVersions API. Provides a Lambda Layer Version resource. Lambda Layers allow you to reuse shared bits of code across multiple lambda functions. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LayerVersion struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lambda/v1beta1/zz_layerversionpermission_terraformed.go b/apis/lambda/v1beta1/zz_layerversionpermission_terraformed.go new file mode 100755 index 0000000000..6e3a2213f8 --- /dev/null +++ b/apis/lambda/v1beta1/zz_layerversionpermission_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LayerVersionPermission +func (mg *LayerVersionPermission) GetTerraformResourceType() string { + return "aws_lambda_layer_version_permission" +} + +// GetConnectionDetailsMapping for this LayerVersionPermission +func (tr *LayerVersionPermission) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LayerVersionPermission +func (tr *LayerVersionPermission) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LayerVersionPermission +func (tr *LayerVersionPermission) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LayerVersionPermission +func (tr *LayerVersionPermission) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LayerVersionPermission +func (tr *LayerVersionPermission) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LayerVersionPermission +func (tr *LayerVersionPermission) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LayerVersionPermission +func (tr *LayerVersionPermission) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LayerVersionPermission +func (tr *LayerVersionPermission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LayerVersionPermission using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LayerVersionPermission) LateInitialize(attrs []byte) (bool, error) { + params := &LayerVersionPermissionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LayerVersionPermission) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lambda/v1beta1/zz_layerversionpermission_types.go b/apis/lambda/v1beta1/zz_layerversionpermission_types.go index 240ecd347d..3580a1c24d 100755 --- a/apis/lambda/v1beta1/zz_layerversionpermission_types.go +++ b/apis/lambda/v1beta1/zz_layerversionpermission_types.go @@ -124,13 +124,14 @@ type LayerVersionPermissionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LayerVersionPermission is the Schema for the LayerVersionPermissions API. Provides a Lambda Layer Version Permission resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LayerVersionPermission struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lambda/v1beta1/zz_permission_terraformed.go b/apis/lambda/v1beta1/zz_permission_terraformed.go new file mode 100755 index 0000000000..e1c84354a3 --- /dev/null +++ b/apis/lambda/v1beta1/zz_permission_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Permission +func (mg *Permission) GetTerraformResourceType() string { + return "aws_lambda_permission" +} + +// GetConnectionDetailsMapping for this Permission +func (tr *Permission) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Permission +func (tr *Permission) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Permission +func (tr *Permission) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Permission +func (tr *Permission) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Permission +func (tr *Permission) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Permission +func (tr *Permission) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Permission +func (tr *Permission) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Permission +func (tr *Permission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Permission using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Permission) LateInitialize(attrs []byte) (bool, error) { + params := &PermissionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("StatementIDPrefix")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Permission) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lambda/v1beta1/zz_permission_types.go b/apis/lambda/v1beta1/zz_permission_types.go index 52878f98e9..d6ab21be04 100755 --- a/apis/lambda/v1beta1/zz_permission_types.go +++ b/apis/lambda/v1beta1/zz_permission_types.go @@ -215,13 +215,14 @@ type PermissionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Permission is the Schema for the Permissions API. Creates a Lambda function permission. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Permission struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lambda/v1beta1/zz_provisionedconcurrencyconfig_terraformed.go b/apis/lambda/v1beta1/zz_provisionedconcurrencyconfig_terraformed.go new file mode 100755 index 0000000000..e6c10da9df --- /dev/null +++ b/apis/lambda/v1beta1/zz_provisionedconcurrencyconfig_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ProvisionedConcurrencyConfig +func (mg *ProvisionedConcurrencyConfig) GetTerraformResourceType() string { + return "aws_lambda_provisioned_concurrency_config" +} + +// GetConnectionDetailsMapping for this ProvisionedConcurrencyConfig +func (tr *ProvisionedConcurrencyConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ProvisionedConcurrencyConfig +func (tr *ProvisionedConcurrencyConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ProvisionedConcurrencyConfig +func (tr *ProvisionedConcurrencyConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ProvisionedConcurrencyConfig +func (tr *ProvisionedConcurrencyConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ProvisionedConcurrencyConfig +func (tr *ProvisionedConcurrencyConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ProvisionedConcurrencyConfig +func (tr *ProvisionedConcurrencyConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ProvisionedConcurrencyConfig +func (tr *ProvisionedConcurrencyConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ProvisionedConcurrencyConfig +func (tr *ProvisionedConcurrencyConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ProvisionedConcurrencyConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ProvisionedConcurrencyConfig) LateInitialize(attrs []byte) (bool, error) { + params := &ProvisionedConcurrencyConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("ProvisionedConcurrentExecutions")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ProvisionedConcurrencyConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lambda/v1beta1/zz_provisionedconcurrencyconfig_types.go b/apis/lambda/v1beta1/zz_provisionedconcurrencyconfig_types.go index 17a5801d0d..0b27606810 100755 --- a/apis/lambda/v1beta1/zz_provisionedconcurrencyconfig_types.go +++ b/apis/lambda/v1beta1/zz_provisionedconcurrencyconfig_types.go @@ -88,13 +88,14 @@ type ProvisionedConcurrencyConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ProvisionedConcurrencyConfig is the Schema for the ProvisionedConcurrencyConfigs API. Manages a Lambda Provisioned Concurrency Configuration // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ProvisionedConcurrencyConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lexmodels/v1beta1/zz_bot_terraformed.go b/apis/lexmodels/v1beta1/zz_bot_terraformed.go new file mode 100755 index 0000000000..e5b45145f5 --- /dev/null +++ b/apis/lexmodels/v1beta1/zz_bot_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Bot +func (mg *Bot) GetTerraformResourceType() string { + return "aws_lex_bot" +} + +// GetConnectionDetailsMapping for this Bot +func (tr *Bot) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Bot +func (tr *Bot) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Bot +func (tr *Bot) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Bot +func (tr *Bot) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Bot +func (tr *Bot) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Bot +func (tr *Bot) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Bot +func (tr *Bot) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Bot +func (tr *Bot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Bot using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Bot) LateInitialize(attrs []byte) (bool, error) { + params := &BotParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Bot) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lexmodels/v1beta1/zz_bot_types.go b/apis/lexmodels/v1beta1/zz_bot_types.go index 11b5ede74a..13088f39ef 100755 --- a/apis/lexmodels/v1beta1/zz_bot_types.go +++ b/apis/lexmodels/v1beta1/zz_bot_types.go @@ -416,13 +416,14 @@ type BotStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Bot is the Schema for the Bots API. Provides an Amazon Lex bot resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Bot struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lexmodels/v1beta1/zz_botalias_terraformed.go b/apis/lexmodels/v1beta1/zz_botalias_terraformed.go new file mode 100755 index 0000000000..a45ecb794f --- /dev/null +++ b/apis/lexmodels/v1beta1/zz_botalias_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BotAlias +func (mg *BotAlias) GetTerraformResourceType() string { + return "aws_lex_bot_alias" +} + +// GetConnectionDetailsMapping for this BotAlias +func (tr *BotAlias) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BotAlias +func (tr *BotAlias) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BotAlias +func (tr *BotAlias) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BotAlias +func (tr *BotAlias) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BotAlias +func (tr *BotAlias) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BotAlias +func (tr *BotAlias) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BotAlias +func (tr *BotAlias) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BotAlias +func (tr *BotAlias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BotAlias using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BotAlias) LateInitialize(attrs []byte) (bool, error) { + params := &BotAliasParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BotAlias) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lexmodels/v1beta1/zz_botalias_types.go b/apis/lexmodels/v1beta1/zz_botalias_types.go index 0da533b1a6..65c7502151 100755 --- a/apis/lexmodels/v1beta1/zz_botalias_types.go +++ b/apis/lexmodels/v1beta1/zz_botalias_types.go @@ -190,13 +190,14 @@ type BotAliasStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BotAlias is the Schema for the BotAliass API. Provides an Amazon Lex Bot Alias resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BotAlias struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lexmodels/v1beta1/zz_generated.conversion_hubs.go b/apis/lexmodels/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..314713a27a --- /dev/null +++ b/apis/lexmodels/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Bot) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BotAlias) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Intent) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SlotType) Hub() {} diff --git a/apis/lexmodels/v1beta1/zz_generated_terraformed.go b/apis/lexmodels/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 974d974f42..0000000000 --- a/apis/lexmodels/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Bot -func (mg *Bot) GetTerraformResourceType() string { - return "aws_lex_bot" -} - -// GetConnectionDetailsMapping for this Bot -func (tr *Bot) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Bot -func (tr *Bot) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Bot -func (tr *Bot) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Bot -func (tr *Bot) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Bot -func (tr *Bot) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Bot -func (tr *Bot) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Bot -func (tr *Bot) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Bot -func (tr *Bot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Bot using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Bot) LateInitialize(attrs []byte) (bool, error) { - params := &BotParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Bot) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BotAlias -func (mg *BotAlias) GetTerraformResourceType() string { - return "aws_lex_bot_alias" -} - -// GetConnectionDetailsMapping for this BotAlias -func (tr *BotAlias) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BotAlias -func (tr *BotAlias) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BotAlias -func (tr *BotAlias) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BotAlias -func (tr *BotAlias) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BotAlias -func (tr *BotAlias) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BotAlias -func (tr *BotAlias) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BotAlias -func (tr *BotAlias) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BotAlias -func (tr *BotAlias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BotAlias using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BotAlias) LateInitialize(attrs []byte) (bool, error) { - params := &BotAliasParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BotAlias) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Intent -func (mg *Intent) GetTerraformResourceType() string { - return "aws_lex_intent" -} - -// GetConnectionDetailsMapping for this Intent -func (tr *Intent) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Intent -func (tr *Intent) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Intent -func (tr *Intent) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Intent -func (tr *Intent) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Intent -func (tr *Intent) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Intent -func (tr *Intent) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Intent -func (tr *Intent) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Intent -func (tr *Intent) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Intent using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Intent) LateInitialize(attrs []byte) (bool, error) { - params := &IntentParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Intent) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SlotType -func (mg *SlotType) GetTerraformResourceType() string { - return "aws_lex_slot_type" -} - -// GetConnectionDetailsMapping for this SlotType -func (tr *SlotType) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SlotType -func (tr *SlotType) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SlotType -func (tr *SlotType) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SlotType -func (tr *SlotType) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SlotType -func (tr *SlotType) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SlotType -func (tr *SlotType) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SlotType -func (tr *SlotType) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SlotType -func (tr *SlotType) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SlotType using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SlotType) LateInitialize(attrs []byte) (bool, error) { - params := &SlotTypeParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SlotType) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/lexmodels/v1beta1/zz_intent_terraformed.go b/apis/lexmodels/v1beta1/zz_intent_terraformed.go new file mode 100755 index 0000000000..45fad1b9a7 --- /dev/null +++ b/apis/lexmodels/v1beta1/zz_intent_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Intent +func (mg *Intent) GetTerraformResourceType() string { + return "aws_lex_intent" +} + +// GetConnectionDetailsMapping for this Intent +func (tr *Intent) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Intent +func (tr *Intent) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Intent +func (tr *Intent) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Intent +func (tr *Intent) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Intent +func (tr *Intent) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Intent +func (tr *Intent) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Intent +func (tr *Intent) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Intent +func (tr *Intent) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Intent using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Intent) LateInitialize(attrs []byte) (bool, error) { + params := &IntentParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Intent) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lexmodels/v1beta1/zz_intent_types.go b/apis/lexmodels/v1beta1/zz_intent_types.go index e04b7a54cc..d06bb61a6b 100755 --- a/apis/lexmodels/v1beta1/zz_intent_types.go +++ b/apis/lexmodels/v1beta1/zz_intent_types.go @@ -1046,13 +1046,14 @@ type IntentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Intent is the Schema for the Intents API. Provides an Amazon Lex intent resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Intent struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lexmodels/v1beta1/zz_slottype_terraformed.go b/apis/lexmodels/v1beta1/zz_slottype_terraformed.go new file mode 100755 index 0000000000..df3a6d8577 --- /dev/null +++ b/apis/lexmodels/v1beta1/zz_slottype_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SlotType +func (mg *SlotType) GetTerraformResourceType() string { + return "aws_lex_slot_type" +} + +// GetConnectionDetailsMapping for this SlotType +func (tr *SlotType) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SlotType +func (tr *SlotType) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SlotType +func (tr *SlotType) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SlotType +func (tr *SlotType) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SlotType +func (tr *SlotType) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SlotType +func (tr *SlotType) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SlotType +func (tr *SlotType) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SlotType +func (tr *SlotType) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SlotType using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SlotType) LateInitialize(attrs []byte) (bool, error) { + params := &SlotTypeParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SlotType) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lexmodels/v1beta1/zz_slottype_types.go b/apis/lexmodels/v1beta1/zz_slottype_types.go index 73d1a2a4a0..c888928c3f 100755 --- a/apis/lexmodels/v1beta1/zz_slottype_types.go +++ b/apis/lexmodels/v1beta1/zz_slottype_types.go @@ -163,13 +163,14 @@ type SlotTypeStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SlotType is the Schema for the SlotTypes API. Provides details about a specific Amazon Lex Slot Type // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SlotType struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/licensemanager/v1beta1/zz_association_terraformed.go b/apis/licensemanager/v1beta1/zz_association_terraformed.go new file mode 100755 index 0000000000..e35062252d --- /dev/null +++ b/apis/licensemanager/v1beta1/zz_association_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Association +func (mg *Association) GetTerraformResourceType() string { + return "aws_licensemanager_association" +} + +// GetConnectionDetailsMapping for this Association +func (tr *Association) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Association +func (tr *Association) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Association +func (tr *Association) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Association +func (tr *Association) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Association +func (tr *Association) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Association +func (tr *Association) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Association +func (tr *Association) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Association +func (tr *Association) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Association using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Association) LateInitialize(attrs []byte) (bool, error) { + params := &AssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Association) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/licensemanager/v1beta1/zz_association_types.go b/apis/licensemanager/v1beta1/zz_association_types.go index a1883d6ca8..5f00742cc2 100755 --- a/apis/licensemanager/v1beta1/zz_association_types.go +++ b/apis/licensemanager/v1beta1/zz_association_types.go @@ -118,13 +118,14 @@ type AssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Association is the Schema for the Associations API. Provides a License Manager association resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Association struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/licensemanager/v1beta1/zz_generated.conversion_hubs.go b/apis/licensemanager/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..5b38bb598c --- /dev/null +++ b/apis/licensemanager/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Association) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LicenseConfiguration) Hub() {} diff --git a/apis/licensemanager/v1beta1/zz_generated_terraformed.go b/apis/licensemanager/v1beta1/zz_licenseconfiguration_terraformed.go similarity index 53% rename from apis/licensemanager/v1beta1/zz_generated_terraformed.go rename to apis/licensemanager/v1beta1/zz_licenseconfiguration_terraformed.go index b731b77602..b3fc3dc5c6 100755 --- a/apis/licensemanager/v1beta1/zz_generated_terraformed.go +++ b/apis/licensemanager/v1beta1/zz_licenseconfiguration_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Association -func (mg *Association) GetTerraformResourceType() string { - return "aws_licensemanager_association" -} - -// GetConnectionDetailsMapping for this Association -func (tr *Association) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Association -func (tr *Association) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Association -func (tr *Association) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Association -func (tr *Association) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Association -func (tr *Association) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Association -func (tr *Association) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Association -func (tr *Association) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Association -func (tr *Association) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Association using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Association) LateInitialize(attrs []byte) (bool, error) { - params := &AssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Association) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this LicenseConfiguration func (mg *LicenseConfiguration) GetTerraformResourceType() string { return "aws_licensemanager_license_configuration" diff --git a/apis/licensemanager/v1beta1/zz_licenseconfiguration_types.go b/apis/licensemanager/v1beta1/zz_licenseconfiguration_types.go index 4b538dd57c..6cf920cf8d 100755 --- a/apis/licensemanager/v1beta1/zz_licenseconfiguration_types.go +++ b/apis/licensemanager/v1beta1/zz_licenseconfiguration_types.go @@ -141,13 +141,14 @@ type LicenseConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LicenseConfiguration is the Schema for the LicenseConfigurations API. Provides a License Manager license configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LicenseConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_bucket_terraformed.go b/apis/lightsail/v1beta1/zz_bucket_terraformed.go new file mode 100755 index 0000000000..842824e76b --- /dev/null +++ b/apis/lightsail/v1beta1/zz_bucket_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Bucket +func (mg *Bucket) GetTerraformResourceType() string { + return "aws_lightsail_bucket" +} + +// GetConnectionDetailsMapping for this Bucket +func (tr *Bucket) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Bucket +func (tr *Bucket) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Bucket +func (tr *Bucket) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Bucket +func (tr *Bucket) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Bucket +func (tr *Bucket) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Bucket +func (tr *Bucket) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Bucket +func (tr *Bucket) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Bucket +func (tr *Bucket) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Bucket using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Bucket) LateInitialize(attrs []byte) (bool, error) { + params := &BucketParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Bucket) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_bucket_types.go b/apis/lightsail/v1beta1/zz_bucket_types.go index b4a28b549f..06ca0fc007 100755 --- a/apis/lightsail/v1beta1/zz_bucket_types.go +++ b/apis/lightsail/v1beta1/zz_bucket_types.go @@ -104,13 +104,14 @@ type BucketStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Bucket is the Schema for the Buckets API. Provides a lightsail bucket // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Bucket struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_certificate_terraformed.go b/apis/lightsail/v1beta1/zz_certificate_terraformed.go new file mode 100755 index 0000000000..00d890a84d --- /dev/null +++ b/apis/lightsail/v1beta1/zz_certificate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Certificate +func (mg *Certificate) GetTerraformResourceType() string { + return "aws_lightsail_certificate" +} + +// GetConnectionDetailsMapping for this Certificate +func (tr *Certificate) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Certificate +func (tr *Certificate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Certificate +func (tr *Certificate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Certificate +func (tr *Certificate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Certificate +func (tr *Certificate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Certificate +func (tr *Certificate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Certificate +func (tr *Certificate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Certificate +func (tr *Certificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Certificate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Certificate) LateInitialize(attrs []byte) (bool, error) { + params := &CertificateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Certificate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_certificate_types.go b/apis/lightsail/v1beta1/zz_certificate_types.go index a872637d6e..66e0e0d4a0 100755 --- a/apis/lightsail/v1beta1/zz_certificate_types.go +++ b/apis/lightsail/v1beta1/zz_certificate_types.go @@ -126,13 +126,14 @@ type CertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Certificate is the Schema for the Certificates API. Provides a lightsail certificate // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Certificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_containerservice_terraformed.go b/apis/lightsail/v1beta1/zz_containerservice_terraformed.go new file mode 100755 index 0000000000..517aead0f6 --- /dev/null +++ b/apis/lightsail/v1beta1/zz_containerservice_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ContainerService +func (mg *ContainerService) GetTerraformResourceType() string { + return "aws_lightsail_container_service" +} + +// GetConnectionDetailsMapping for this ContainerService +func (tr *ContainerService) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ContainerService +func (tr *ContainerService) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ContainerService +func (tr *ContainerService) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ContainerService +func (tr *ContainerService) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ContainerService +func (tr *ContainerService) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ContainerService +func (tr *ContainerService) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ContainerService +func (tr *ContainerService) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ContainerService +func (tr *ContainerService) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ContainerService using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ContainerService) LateInitialize(attrs []byte) (bool, error) { + params := &ContainerServiceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ContainerService) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_containerservice_types.go b/apis/lightsail/v1beta1/zz_containerservice_types.go index 55f7cbfcf9..519442d13e 100755 --- a/apis/lightsail/v1beta1/zz_containerservice_types.go +++ b/apis/lightsail/v1beta1/zz_containerservice_types.go @@ -263,13 +263,14 @@ type ContainerServiceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ContainerService is the Schema for the ContainerServices API. Provides a resource to manage Lightsail container service // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ContainerService struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_disk_terraformed.go b/apis/lightsail/v1beta1/zz_disk_terraformed.go new file mode 100755 index 0000000000..53653a2e9f --- /dev/null +++ b/apis/lightsail/v1beta1/zz_disk_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Disk +func (mg *Disk) GetTerraformResourceType() string { + return "aws_lightsail_disk" +} + +// GetConnectionDetailsMapping for this Disk +func (tr *Disk) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Disk +func (tr *Disk) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Disk +func (tr *Disk) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Disk +func (tr *Disk) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Disk +func (tr *Disk) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Disk +func (tr *Disk) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Disk +func (tr *Disk) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Disk +func (tr *Disk) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Disk using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Disk) LateInitialize(attrs []byte) (bool, error) { + params := &DiskParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Disk) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_disk_types.go b/apis/lightsail/v1beta1/zz_disk_types.go index 611c25a183..9b8762f0b5 100755 --- a/apis/lightsail/v1beta1/zz_disk_types.go +++ b/apis/lightsail/v1beta1/zz_disk_types.go @@ -104,13 +104,14 @@ type DiskStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Disk is the Schema for the Disks API. Provides a Lightsail Disk resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Disk struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_diskattachment_terraformed.go b/apis/lightsail/v1beta1/zz_diskattachment_terraformed.go new file mode 100755 index 0000000000..f8b6239f8f --- /dev/null +++ b/apis/lightsail/v1beta1/zz_diskattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DiskAttachment +func (mg *DiskAttachment) GetTerraformResourceType() string { + return "aws_lightsail_disk_attachment" +} + +// GetConnectionDetailsMapping for this DiskAttachment +func (tr *DiskAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DiskAttachment +func (tr *DiskAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DiskAttachment +func (tr *DiskAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DiskAttachment +func (tr *DiskAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DiskAttachment +func (tr *DiskAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DiskAttachment +func (tr *DiskAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DiskAttachment +func (tr *DiskAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DiskAttachment +func (tr *DiskAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DiskAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DiskAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &DiskAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DiskAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_diskattachment_types.go b/apis/lightsail/v1beta1/zz_diskattachment_types.go index 777e7ac489..691d7f0d68 100755 --- a/apis/lightsail/v1beta1/zz_diskattachment_types.go +++ b/apis/lightsail/v1beta1/zz_diskattachment_types.go @@ -124,13 +124,14 @@ type DiskAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DiskAttachment is the Schema for the DiskAttachments API. Attaches a Lightsail disk to a Lightsail Instance // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DiskAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_domain_terraformed.go b/apis/lightsail/v1beta1/zz_domain_terraformed.go new file mode 100755 index 0000000000..54e4ae5927 --- /dev/null +++ b/apis/lightsail/v1beta1/zz_domain_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Domain +func (mg *Domain) GetTerraformResourceType() string { + return "aws_lightsail_domain" +} + +// GetConnectionDetailsMapping for this Domain +func (tr *Domain) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Domain +func (tr *Domain) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Domain +func (tr *Domain) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Domain +func (tr *Domain) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Domain +func (tr *Domain) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Domain +func (tr *Domain) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Domain +func (tr *Domain) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Domain +func (tr *Domain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Domain using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Domain) LateInitialize(attrs []byte) (bool, error) { + params := &DomainParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Domain) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_domain_types.go b/apis/lightsail/v1beta1/zz_domain_types.go index e23d83c805..5543e4541f 100755 --- a/apis/lightsail/v1beta1/zz_domain_types.go +++ b/apis/lightsail/v1beta1/zz_domain_types.go @@ -71,13 +71,14 @@ type DomainStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Domain is the Schema for the Domains API. Provides an Lightsail Domain // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Domain struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_domainentry_terraformed.go b/apis/lightsail/v1beta1/zz_domainentry_terraformed.go new file mode 100755 index 0000000000..2a541f73e4 --- /dev/null +++ b/apis/lightsail/v1beta1/zz_domainentry_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DomainEntry +func (mg *DomainEntry) GetTerraformResourceType() string { + return "aws_lightsail_domain_entry" +} + +// GetConnectionDetailsMapping for this DomainEntry +func (tr *DomainEntry) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DomainEntry +func (tr *DomainEntry) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DomainEntry +func (tr *DomainEntry) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DomainEntry +func (tr *DomainEntry) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DomainEntry +func (tr *DomainEntry) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DomainEntry +func (tr *DomainEntry) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DomainEntry +func (tr *DomainEntry) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DomainEntry +func (tr *DomainEntry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DomainEntry using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DomainEntry) LateInitialize(attrs []byte) (bool, error) { + params := &DomainEntryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DomainEntry) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_domainentry_types.go b/apis/lightsail/v1beta1/zz_domainentry_types.go index c5fd5942ab..94ab8b08e9 100755 --- a/apis/lightsail/v1beta1/zz_domainentry_types.go +++ b/apis/lightsail/v1beta1/zz_domainentry_types.go @@ -102,13 +102,14 @@ type DomainEntryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DomainEntry is the Schema for the DomainEntrys API. Provides an Lightsail Domain Entry // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DomainEntry struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_generated.conversion_hubs.go b/apis/lightsail/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..6af2be602d --- /dev/null +++ b/apis/lightsail/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,59 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Bucket) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Certificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ContainerService) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Disk) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DiskAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Domain) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DomainEntry) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Instance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InstancePublicPorts) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *KeyPair) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LB) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LBAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LBCertificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LBStickinessPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *StaticIP) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *StaticIPAttachment) Hub() {} diff --git a/apis/lightsail/v1beta1/zz_generated_terraformed.go b/apis/lightsail/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index f1900ac197..0000000000 --- a/apis/lightsail/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1843 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Bucket -func (mg *Bucket) GetTerraformResourceType() string { - return "aws_lightsail_bucket" -} - -// GetConnectionDetailsMapping for this Bucket -func (tr *Bucket) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Bucket -func (tr *Bucket) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Bucket -func (tr *Bucket) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Bucket -func (tr *Bucket) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Bucket -func (tr *Bucket) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Bucket -func (tr *Bucket) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Bucket -func (tr *Bucket) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Bucket -func (tr *Bucket) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Bucket using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Bucket) LateInitialize(attrs []byte) (bool, error) { - params := &BucketParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Bucket) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Certificate -func (mg *Certificate) GetTerraformResourceType() string { - return "aws_lightsail_certificate" -} - -// GetConnectionDetailsMapping for this Certificate -func (tr *Certificate) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Certificate -func (tr *Certificate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Certificate -func (tr *Certificate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Certificate -func (tr *Certificate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Certificate -func (tr *Certificate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Certificate -func (tr *Certificate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Certificate -func (tr *Certificate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Certificate -func (tr *Certificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Certificate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Certificate) LateInitialize(attrs []byte) (bool, error) { - params := &CertificateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Certificate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ContainerService -func (mg *ContainerService) GetTerraformResourceType() string { - return "aws_lightsail_container_service" -} - -// GetConnectionDetailsMapping for this ContainerService -func (tr *ContainerService) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ContainerService -func (tr *ContainerService) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ContainerService -func (tr *ContainerService) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ContainerService -func (tr *ContainerService) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ContainerService -func (tr *ContainerService) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ContainerService -func (tr *ContainerService) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ContainerService -func (tr *ContainerService) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ContainerService -func (tr *ContainerService) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ContainerService using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ContainerService) LateInitialize(attrs []byte) (bool, error) { - params := &ContainerServiceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ContainerService) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Disk -func (mg *Disk) GetTerraformResourceType() string { - return "aws_lightsail_disk" -} - -// GetConnectionDetailsMapping for this Disk -func (tr *Disk) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Disk -func (tr *Disk) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Disk -func (tr *Disk) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Disk -func (tr *Disk) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Disk -func (tr *Disk) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Disk -func (tr *Disk) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Disk -func (tr *Disk) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Disk -func (tr *Disk) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Disk using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Disk) LateInitialize(attrs []byte) (bool, error) { - params := &DiskParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Disk) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DiskAttachment -func (mg *DiskAttachment) GetTerraformResourceType() string { - return "aws_lightsail_disk_attachment" -} - -// GetConnectionDetailsMapping for this DiskAttachment -func (tr *DiskAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DiskAttachment -func (tr *DiskAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DiskAttachment -func (tr *DiskAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DiskAttachment -func (tr *DiskAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DiskAttachment -func (tr *DiskAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DiskAttachment -func (tr *DiskAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DiskAttachment -func (tr *DiskAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DiskAttachment -func (tr *DiskAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DiskAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DiskAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &DiskAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DiskAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Domain -func (mg *Domain) GetTerraformResourceType() string { - return "aws_lightsail_domain" -} - -// GetConnectionDetailsMapping for this Domain -func (tr *Domain) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Domain -func (tr *Domain) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Domain -func (tr *Domain) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Domain -func (tr *Domain) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Domain -func (tr *Domain) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Domain -func (tr *Domain) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Domain -func (tr *Domain) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Domain -func (tr *Domain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Domain using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Domain) LateInitialize(attrs []byte) (bool, error) { - params := &DomainParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Domain) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DomainEntry -func (mg *DomainEntry) GetTerraformResourceType() string { - return "aws_lightsail_domain_entry" -} - -// GetConnectionDetailsMapping for this DomainEntry -func (tr *DomainEntry) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DomainEntry -func (tr *DomainEntry) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DomainEntry -func (tr *DomainEntry) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DomainEntry -func (tr *DomainEntry) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DomainEntry -func (tr *DomainEntry) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DomainEntry -func (tr *DomainEntry) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DomainEntry -func (tr *DomainEntry) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DomainEntry -func (tr *DomainEntry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DomainEntry using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DomainEntry) LateInitialize(attrs []byte) (bool, error) { - params := &DomainEntryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DomainEntry) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Instance -func (mg *Instance) GetTerraformResourceType() string { - return "aws_lightsail_instance" -} - -// GetConnectionDetailsMapping for this Instance -func (tr *Instance) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Instance -func (tr *Instance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Instance -func (tr *Instance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Instance -func (tr *Instance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Instance -func (tr *Instance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Instance -func (tr *Instance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Instance -func (tr *Instance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Instance -func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Instance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { - params := &InstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Instance) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InstancePublicPorts -func (mg *InstancePublicPorts) GetTerraformResourceType() string { - return "aws_lightsail_instance_public_ports" -} - -// GetConnectionDetailsMapping for this InstancePublicPorts -func (tr *InstancePublicPorts) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InstancePublicPorts -func (tr *InstancePublicPorts) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InstancePublicPorts -func (tr *InstancePublicPorts) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InstancePublicPorts -func (tr *InstancePublicPorts) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InstancePublicPorts -func (tr *InstancePublicPorts) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InstancePublicPorts -func (tr *InstancePublicPorts) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InstancePublicPorts -func (tr *InstancePublicPorts) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InstancePublicPorts -func (tr *InstancePublicPorts) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InstancePublicPorts using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InstancePublicPorts) LateInitialize(attrs []byte) (bool, error) { - params := &InstancePublicPortsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InstancePublicPorts) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this KeyPair -func (mg *KeyPair) GetTerraformResourceType() string { - return "aws_lightsail_key_pair" -} - -// GetConnectionDetailsMapping for this KeyPair -func (tr *KeyPair) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this KeyPair -func (tr *KeyPair) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this KeyPair -func (tr *KeyPair) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this KeyPair -func (tr *KeyPair) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this KeyPair -func (tr *KeyPair) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this KeyPair -func (tr *KeyPair) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this KeyPair -func (tr *KeyPair) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this KeyPair -func (tr *KeyPair) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this KeyPair using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *KeyPair) LateInitialize(attrs []byte) (bool, error) { - params := &KeyPairParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *KeyPair) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LB -func (mg *LB) GetTerraformResourceType() string { - return "aws_lightsail_lb" -} - -// GetConnectionDetailsMapping for this LB -func (tr *LB) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LB -func (tr *LB) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LB -func (tr *LB) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LB -func (tr *LB) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LB -func (tr *LB) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LB -func (tr *LB) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LB -func (tr *LB) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LB -func (tr *LB) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LB using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LB) LateInitialize(attrs []byte) (bool, error) { - params := &LBParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LB) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LBAttachment -func (mg *LBAttachment) GetTerraformResourceType() string { - return "aws_lightsail_lb_attachment" -} - -// GetConnectionDetailsMapping for this LBAttachment -func (tr *LBAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LBAttachment -func (tr *LBAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LBAttachment -func (tr *LBAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LBAttachment -func (tr *LBAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LBAttachment -func (tr *LBAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LBAttachment -func (tr *LBAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LBAttachment -func (tr *LBAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LBAttachment -func (tr *LBAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LBAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LBAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &LBAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LBAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LBCertificate -func (mg *LBCertificate) GetTerraformResourceType() string { - return "aws_lightsail_lb_certificate" -} - -// GetConnectionDetailsMapping for this LBCertificate -func (tr *LBCertificate) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LBCertificate -func (tr *LBCertificate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LBCertificate -func (tr *LBCertificate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LBCertificate -func (tr *LBCertificate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LBCertificate -func (tr *LBCertificate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LBCertificate -func (tr *LBCertificate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LBCertificate -func (tr *LBCertificate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LBCertificate -func (tr *LBCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LBCertificate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LBCertificate) LateInitialize(attrs []byte) (bool, error) { - params := &LBCertificateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LBCertificate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LBStickinessPolicy -func (mg *LBStickinessPolicy) GetTerraformResourceType() string { - return "aws_lightsail_lb_stickiness_policy" -} - -// GetConnectionDetailsMapping for this LBStickinessPolicy -func (tr *LBStickinessPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LBStickinessPolicy -func (tr *LBStickinessPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LBStickinessPolicy -func (tr *LBStickinessPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LBStickinessPolicy -func (tr *LBStickinessPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LBStickinessPolicy -func (tr *LBStickinessPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LBStickinessPolicy -func (tr *LBStickinessPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LBStickinessPolicy -func (tr *LBStickinessPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LBStickinessPolicy -func (tr *LBStickinessPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LBStickinessPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LBStickinessPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &LBStickinessPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LBStickinessPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this StaticIP -func (mg *StaticIP) GetTerraformResourceType() string { - return "aws_lightsail_static_ip" -} - -// GetConnectionDetailsMapping for this StaticIP -func (tr *StaticIP) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this StaticIP -func (tr *StaticIP) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this StaticIP -func (tr *StaticIP) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this StaticIP -func (tr *StaticIP) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this StaticIP -func (tr *StaticIP) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this StaticIP -func (tr *StaticIP) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this StaticIP -func (tr *StaticIP) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this StaticIP -func (tr *StaticIP) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this StaticIP using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *StaticIP) LateInitialize(attrs []byte) (bool, error) { - params := &StaticIPParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *StaticIP) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this StaticIPAttachment -func (mg *StaticIPAttachment) GetTerraformResourceType() string { - return "aws_lightsail_static_ip_attachment" -} - -// GetConnectionDetailsMapping for this StaticIPAttachment -func (tr *StaticIPAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this StaticIPAttachment -func (tr *StaticIPAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this StaticIPAttachment -func (tr *StaticIPAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this StaticIPAttachment -func (tr *StaticIPAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this StaticIPAttachment -func (tr *StaticIPAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this StaticIPAttachment -func (tr *StaticIPAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this StaticIPAttachment -func (tr *StaticIPAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this StaticIPAttachment -func (tr *StaticIPAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this StaticIPAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *StaticIPAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &StaticIPAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *StaticIPAttachment) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/lightsail/v1beta1/zz_instance_terraformed.go b/apis/lightsail/v1beta1/zz_instance_terraformed.go new file mode 100755 index 0000000000..e99bfb3de8 --- /dev/null +++ b/apis/lightsail/v1beta1/zz_instance_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Instance +func (mg *Instance) GetTerraformResourceType() string { + return "aws_lightsail_instance" +} + +// GetConnectionDetailsMapping for this Instance +func (tr *Instance) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Instance +func (tr *Instance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Instance +func (tr *Instance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Instance +func (tr *Instance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Instance +func (tr *Instance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Instance +func (tr *Instance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Instance +func (tr *Instance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Instance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { + params := &InstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Instance) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_instance_types.go b/apis/lightsail/v1beta1/zz_instance_types.go index 3fdff4b8ea..88181b40dd 100755 --- a/apis/lightsail/v1beta1/zz_instance_types.go +++ b/apis/lightsail/v1beta1/zz_instance_types.go @@ -220,13 +220,14 @@ type InstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Instance is the Schema for the Instances API. Provides an Lightsail Instance // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Instance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_instancepublicports_terraformed.go b/apis/lightsail/v1beta1/zz_instancepublicports_terraformed.go new file mode 100755 index 0000000000..20216714bd --- /dev/null +++ b/apis/lightsail/v1beta1/zz_instancepublicports_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InstancePublicPorts +func (mg *InstancePublicPorts) GetTerraformResourceType() string { + return "aws_lightsail_instance_public_ports" +} + +// GetConnectionDetailsMapping for this InstancePublicPorts +func (tr *InstancePublicPorts) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InstancePublicPorts +func (tr *InstancePublicPorts) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InstancePublicPorts +func (tr *InstancePublicPorts) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InstancePublicPorts +func (tr *InstancePublicPorts) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InstancePublicPorts +func (tr *InstancePublicPorts) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InstancePublicPorts +func (tr *InstancePublicPorts) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InstancePublicPorts +func (tr *InstancePublicPorts) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InstancePublicPorts +func (tr *InstancePublicPorts) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InstancePublicPorts using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InstancePublicPorts) LateInitialize(attrs []byte) (bool, error) { + params := &InstancePublicPortsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InstancePublicPorts) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_instancepublicports_types.go b/apis/lightsail/v1beta1/zz_instancepublicports_types.go index b934805893..6293a11f58 100755 --- a/apis/lightsail/v1beta1/zz_instancepublicports_types.go +++ b/apis/lightsail/v1beta1/zz_instancepublicports_types.go @@ -171,13 +171,14 @@ type InstancePublicPortsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InstancePublicPorts is the Schema for the InstancePublicPortss API. Provides an Lightsail Instance // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InstancePublicPorts struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_keypair_terraformed.go b/apis/lightsail/v1beta1/zz_keypair_terraformed.go new file mode 100755 index 0000000000..772f0f33ec --- /dev/null +++ b/apis/lightsail/v1beta1/zz_keypair_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this KeyPair +func (mg *KeyPair) GetTerraformResourceType() string { + return "aws_lightsail_key_pair" +} + +// GetConnectionDetailsMapping for this KeyPair +func (tr *KeyPair) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this KeyPair +func (tr *KeyPair) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this KeyPair +func (tr *KeyPair) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this KeyPair +func (tr *KeyPair) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this KeyPair +func (tr *KeyPair) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this KeyPair +func (tr *KeyPair) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this KeyPair +func (tr *KeyPair) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this KeyPair +func (tr *KeyPair) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this KeyPair using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *KeyPair) LateInitialize(attrs []byte) (bool, error) { + params := &KeyPairParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *KeyPair) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_keypair_types.go b/apis/lightsail/v1beta1/zz_keypair_types.go index 4422a177cc..1527f1a884 100755 --- a/apis/lightsail/v1beta1/zz_keypair_types.go +++ b/apis/lightsail/v1beta1/zz_keypair_types.go @@ -113,13 +113,14 @@ type KeyPairStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // KeyPair is the Schema for the KeyPairs API. Provides an Lightsail Key Pair // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type KeyPair struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_lb_terraformed.go b/apis/lightsail/v1beta1/zz_lb_terraformed.go new file mode 100755 index 0000000000..e420d6d441 --- /dev/null +++ b/apis/lightsail/v1beta1/zz_lb_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LB +func (mg *LB) GetTerraformResourceType() string { + return "aws_lightsail_lb" +} + +// GetConnectionDetailsMapping for this LB +func (tr *LB) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LB +func (tr *LB) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LB +func (tr *LB) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LB +func (tr *LB) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LB +func (tr *LB) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LB +func (tr *LB) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LB +func (tr *LB) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LB +func (tr *LB) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LB using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LB) LateInitialize(attrs []byte) (bool, error) { + params := &LBParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LB) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_lb_types.go b/apis/lightsail/v1beta1/zz_lb_types.go index fd0e7c88d8..817aa19804 100755 --- a/apis/lightsail/v1beta1/zz_lb_types.go +++ b/apis/lightsail/v1beta1/zz_lb_types.go @@ -120,13 +120,14 @@ type LBStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LB is the Schema for the LBs API. Provides a Lightsail Load Balancer // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LB struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_lbattachment_terraformed.go b/apis/lightsail/v1beta1/zz_lbattachment_terraformed.go new file mode 100755 index 0000000000..753329f5b8 --- /dev/null +++ b/apis/lightsail/v1beta1/zz_lbattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LBAttachment +func (mg *LBAttachment) GetTerraformResourceType() string { + return "aws_lightsail_lb_attachment" +} + +// GetConnectionDetailsMapping for this LBAttachment +func (tr *LBAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LBAttachment +func (tr *LBAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LBAttachment +func (tr *LBAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LBAttachment +func (tr *LBAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LBAttachment +func (tr *LBAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LBAttachment +func (tr *LBAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LBAttachment +func (tr *LBAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LBAttachment +func (tr *LBAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LBAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LBAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &LBAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LBAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_lbattachment_types.go b/apis/lightsail/v1beta1/zz_lbattachment_types.go index e7603a26d2..ab2fc54cf1 100755 --- a/apis/lightsail/v1beta1/zz_lbattachment_types.go +++ b/apis/lightsail/v1beta1/zz_lbattachment_types.go @@ -114,13 +114,14 @@ type LBAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LBAttachment is the Schema for the LBAttachments API. Attaches a Lightsail Instance to a Lightsail Load Balancer // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LBAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_lbcertificate_terraformed.go b/apis/lightsail/v1beta1/zz_lbcertificate_terraformed.go new file mode 100755 index 0000000000..a6c501140e --- /dev/null +++ b/apis/lightsail/v1beta1/zz_lbcertificate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LBCertificate +func (mg *LBCertificate) GetTerraformResourceType() string { + return "aws_lightsail_lb_certificate" +} + +// GetConnectionDetailsMapping for this LBCertificate +func (tr *LBCertificate) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LBCertificate +func (tr *LBCertificate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LBCertificate +func (tr *LBCertificate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LBCertificate +func (tr *LBCertificate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LBCertificate +func (tr *LBCertificate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LBCertificate +func (tr *LBCertificate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LBCertificate +func (tr *LBCertificate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LBCertificate +func (tr *LBCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LBCertificate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LBCertificate) LateInitialize(attrs []byte) (bool, error) { + params := &LBCertificateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LBCertificate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_lbcertificate_types.go b/apis/lightsail/v1beta1/zz_lbcertificate_types.go index eeaa7736d8..8e15a3a0ad 100755 --- a/apis/lightsail/v1beta1/zz_lbcertificate_types.go +++ b/apis/lightsail/v1beta1/zz_lbcertificate_types.go @@ -127,13 +127,14 @@ type LBCertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LBCertificate is the Schema for the LBCertificates API. Provides a Lightsail Load Balancer // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LBCertificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_lbstickinesspolicy_terraformed.go b/apis/lightsail/v1beta1/zz_lbstickinesspolicy_terraformed.go new file mode 100755 index 0000000000..97cc988c37 --- /dev/null +++ b/apis/lightsail/v1beta1/zz_lbstickinesspolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LBStickinessPolicy +func (mg *LBStickinessPolicy) GetTerraformResourceType() string { + return "aws_lightsail_lb_stickiness_policy" +} + +// GetConnectionDetailsMapping for this LBStickinessPolicy +func (tr *LBStickinessPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LBStickinessPolicy +func (tr *LBStickinessPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LBStickinessPolicy +func (tr *LBStickinessPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LBStickinessPolicy +func (tr *LBStickinessPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LBStickinessPolicy +func (tr *LBStickinessPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LBStickinessPolicy +func (tr *LBStickinessPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LBStickinessPolicy +func (tr *LBStickinessPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LBStickinessPolicy +func (tr *LBStickinessPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LBStickinessPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LBStickinessPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &LBStickinessPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LBStickinessPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_lbstickinesspolicy_types.go b/apis/lightsail/v1beta1/zz_lbstickinesspolicy_types.go index e2d59e7cff..88952432b8 100755 --- a/apis/lightsail/v1beta1/zz_lbstickinesspolicy_types.go +++ b/apis/lightsail/v1beta1/zz_lbstickinesspolicy_types.go @@ -78,13 +78,14 @@ type LBStickinessPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LBStickinessPolicy is the Schema for the LBStickinessPolicys API. Configures Session Stickiness for a Lightsail Load Balancer // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LBStickinessPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_staticip_terraformed.go b/apis/lightsail/v1beta1/zz_staticip_terraformed.go new file mode 100755 index 0000000000..5dde79aac2 --- /dev/null +++ b/apis/lightsail/v1beta1/zz_staticip_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this StaticIP +func (mg *StaticIP) GetTerraformResourceType() string { + return "aws_lightsail_static_ip" +} + +// GetConnectionDetailsMapping for this StaticIP +func (tr *StaticIP) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this StaticIP +func (tr *StaticIP) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this StaticIP +func (tr *StaticIP) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this StaticIP +func (tr *StaticIP) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this StaticIP +func (tr *StaticIP) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this StaticIP +func (tr *StaticIP) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this StaticIP +func (tr *StaticIP) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this StaticIP +func (tr *StaticIP) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this StaticIP using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *StaticIP) LateInitialize(attrs []byte) (bool, error) { + params := &StaticIPParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *StaticIP) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_staticip_types.go b/apis/lightsail/v1beta1/zz_staticip_types.go index 4e285feba8..7c0b634a78 100755 --- a/apis/lightsail/v1beta1/zz_staticip_types.go +++ b/apis/lightsail/v1beta1/zz_staticip_types.go @@ -76,13 +76,14 @@ type StaticIPStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // StaticIP is the Schema for the StaticIPs API. Provides an Lightsail Static IP // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type StaticIP struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/lightsail/v1beta1/zz_staticipattachment_terraformed.go b/apis/lightsail/v1beta1/zz_staticipattachment_terraformed.go new file mode 100755 index 0000000000..f9ae5e0a3c --- /dev/null +++ b/apis/lightsail/v1beta1/zz_staticipattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this StaticIPAttachment +func (mg *StaticIPAttachment) GetTerraformResourceType() string { + return "aws_lightsail_static_ip_attachment" +} + +// GetConnectionDetailsMapping for this StaticIPAttachment +func (tr *StaticIPAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this StaticIPAttachment +func (tr *StaticIPAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this StaticIPAttachment +func (tr *StaticIPAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this StaticIPAttachment +func (tr *StaticIPAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this StaticIPAttachment +func (tr *StaticIPAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this StaticIPAttachment +func (tr *StaticIPAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this StaticIPAttachment +func (tr *StaticIPAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this StaticIPAttachment +func (tr *StaticIPAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this StaticIPAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *StaticIPAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &StaticIPAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *StaticIPAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/lightsail/v1beta1/zz_staticipattachment_types.go b/apis/lightsail/v1beta1/zz_staticipattachment_types.go index 72d29d6c10..1d9390c7f7 100755 --- a/apis/lightsail/v1beta1/zz_staticipattachment_types.go +++ b/apis/lightsail/v1beta1/zz_staticipattachment_types.go @@ -119,13 +119,14 @@ type StaticIPAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // StaticIPAttachment is the Schema for the StaticIPAttachments API. Provides an Lightsail Static IP Attachment // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type StaticIPAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/location/v1beta1/zz_generated.conversion_hubs.go b/apis/location/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..e8539f9a60 --- /dev/null +++ b/apis/location/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *GeofenceCollection) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PlaceIndex) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RouteCalculator) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Tracker) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TrackerAssociation) Hub() {} diff --git a/apis/location/v1beta1/zz_generated_terraformed.go b/apis/location/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index c1bfe707fa..0000000000 --- a/apis/location/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,589 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this GeofenceCollection -func (mg *GeofenceCollection) GetTerraformResourceType() string { - return "aws_location_geofence_collection" -} - -// GetConnectionDetailsMapping for this GeofenceCollection -func (tr *GeofenceCollection) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GeofenceCollection -func (tr *GeofenceCollection) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GeofenceCollection -func (tr *GeofenceCollection) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GeofenceCollection -func (tr *GeofenceCollection) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GeofenceCollection -func (tr *GeofenceCollection) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GeofenceCollection -func (tr *GeofenceCollection) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GeofenceCollection -func (tr *GeofenceCollection) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GeofenceCollection -func (tr *GeofenceCollection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GeofenceCollection using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GeofenceCollection) LateInitialize(attrs []byte) (bool, error) { - params := &GeofenceCollectionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GeofenceCollection) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PlaceIndex -func (mg *PlaceIndex) GetTerraformResourceType() string { - return "aws_location_place_index" -} - -// GetConnectionDetailsMapping for this PlaceIndex -func (tr *PlaceIndex) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PlaceIndex -func (tr *PlaceIndex) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PlaceIndex -func (tr *PlaceIndex) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PlaceIndex -func (tr *PlaceIndex) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PlaceIndex -func (tr *PlaceIndex) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PlaceIndex -func (tr *PlaceIndex) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PlaceIndex -func (tr *PlaceIndex) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PlaceIndex -func (tr *PlaceIndex) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PlaceIndex using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PlaceIndex) LateInitialize(attrs []byte) (bool, error) { - params := &PlaceIndexParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PlaceIndex) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RouteCalculator -func (mg *RouteCalculator) GetTerraformResourceType() string { - return "aws_location_route_calculator" -} - -// GetConnectionDetailsMapping for this RouteCalculator -func (tr *RouteCalculator) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RouteCalculator -func (tr *RouteCalculator) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RouteCalculator -func (tr *RouteCalculator) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RouteCalculator -func (tr *RouteCalculator) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RouteCalculator -func (tr *RouteCalculator) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RouteCalculator -func (tr *RouteCalculator) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RouteCalculator -func (tr *RouteCalculator) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RouteCalculator -func (tr *RouteCalculator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RouteCalculator using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RouteCalculator) LateInitialize(attrs []byte) (bool, error) { - params := &RouteCalculatorParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RouteCalculator) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Tracker -func (mg *Tracker) GetTerraformResourceType() string { - return "aws_location_tracker" -} - -// GetConnectionDetailsMapping for this Tracker -func (tr *Tracker) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Tracker -func (tr *Tracker) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Tracker -func (tr *Tracker) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Tracker -func (tr *Tracker) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Tracker -func (tr *Tracker) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Tracker -func (tr *Tracker) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Tracker -func (tr *Tracker) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Tracker -func (tr *Tracker) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Tracker using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Tracker) LateInitialize(attrs []byte) (bool, error) { - params := &TrackerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Tracker) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TrackerAssociation -func (mg *TrackerAssociation) GetTerraformResourceType() string { - return "aws_location_tracker_association" -} - -// GetConnectionDetailsMapping for this TrackerAssociation -func (tr *TrackerAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TrackerAssociation -func (tr *TrackerAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TrackerAssociation -func (tr *TrackerAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TrackerAssociation -func (tr *TrackerAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TrackerAssociation -func (tr *TrackerAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TrackerAssociation -func (tr *TrackerAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TrackerAssociation -func (tr *TrackerAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TrackerAssociation -func (tr *TrackerAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TrackerAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TrackerAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &TrackerAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TrackerAssociation) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/location/v1beta1/zz_geofencecollection_terraformed.go b/apis/location/v1beta1/zz_geofencecollection_terraformed.go new file mode 100755 index 0000000000..192684463d --- /dev/null +++ b/apis/location/v1beta1/zz_geofencecollection_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GeofenceCollection +func (mg *GeofenceCollection) GetTerraformResourceType() string { + return "aws_location_geofence_collection" +} + +// GetConnectionDetailsMapping for this GeofenceCollection +func (tr *GeofenceCollection) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GeofenceCollection +func (tr *GeofenceCollection) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GeofenceCollection +func (tr *GeofenceCollection) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GeofenceCollection +func (tr *GeofenceCollection) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GeofenceCollection +func (tr *GeofenceCollection) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GeofenceCollection +func (tr *GeofenceCollection) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GeofenceCollection +func (tr *GeofenceCollection) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GeofenceCollection +func (tr *GeofenceCollection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GeofenceCollection using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GeofenceCollection) LateInitialize(attrs []byte) (bool, error) { + params := &GeofenceCollectionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GeofenceCollection) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/location/v1beta1/zz_geofencecollection_types.go b/apis/location/v1beta1/zz_geofencecollection_types.go index c0b69b0c70..82ce84ee94 100755 --- a/apis/location/v1beta1/zz_geofencecollection_types.go +++ b/apis/location/v1beta1/zz_geofencecollection_types.go @@ -120,13 +120,14 @@ type GeofenceCollectionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GeofenceCollection is the Schema for the GeofenceCollections API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GeofenceCollection struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/location/v1beta1/zz_placeindex_terraformed.go b/apis/location/v1beta1/zz_placeindex_terraformed.go new file mode 100755 index 0000000000..d27fcc99e5 --- /dev/null +++ b/apis/location/v1beta1/zz_placeindex_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PlaceIndex +func (mg *PlaceIndex) GetTerraformResourceType() string { + return "aws_location_place_index" +} + +// GetConnectionDetailsMapping for this PlaceIndex +func (tr *PlaceIndex) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PlaceIndex +func (tr *PlaceIndex) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PlaceIndex +func (tr *PlaceIndex) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PlaceIndex +func (tr *PlaceIndex) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PlaceIndex +func (tr *PlaceIndex) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PlaceIndex +func (tr *PlaceIndex) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PlaceIndex +func (tr *PlaceIndex) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PlaceIndex +func (tr *PlaceIndex) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PlaceIndex using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PlaceIndex) LateInitialize(attrs []byte) (bool, error) { + params := &PlaceIndexParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PlaceIndex) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/location/v1beta1/zz_placeindex_types.go b/apis/location/v1beta1/zz_placeindex_types.go index c763260fa6..6c75a6de07 100755 --- a/apis/location/v1beta1/zz_placeindex_types.go +++ b/apis/location/v1beta1/zz_placeindex_types.go @@ -132,13 +132,14 @@ type PlaceIndexStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PlaceIndex is the Schema for the PlaceIndexs API. Provides a Location Service Place Index. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PlaceIndex struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/location/v1beta1/zz_routecalculator_terraformed.go b/apis/location/v1beta1/zz_routecalculator_terraformed.go new file mode 100755 index 0000000000..9585fd6c60 --- /dev/null +++ b/apis/location/v1beta1/zz_routecalculator_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RouteCalculator +func (mg *RouteCalculator) GetTerraformResourceType() string { + return "aws_location_route_calculator" +} + +// GetConnectionDetailsMapping for this RouteCalculator +func (tr *RouteCalculator) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RouteCalculator +func (tr *RouteCalculator) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RouteCalculator +func (tr *RouteCalculator) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RouteCalculator +func (tr *RouteCalculator) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RouteCalculator +func (tr *RouteCalculator) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RouteCalculator +func (tr *RouteCalculator) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RouteCalculator +func (tr *RouteCalculator) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RouteCalculator +func (tr *RouteCalculator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RouteCalculator using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RouteCalculator) LateInitialize(attrs []byte) (bool, error) { + params := &RouteCalculatorParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RouteCalculator) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/location/v1beta1/zz_routecalculator_types.go b/apis/location/v1beta1/zz_routecalculator_types.go index 684038c3d1..1407158e39 100755 --- a/apis/location/v1beta1/zz_routecalculator_types.go +++ b/apis/location/v1beta1/zz_routecalculator_types.go @@ -103,13 +103,14 @@ type RouteCalculatorStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RouteCalculator is the Schema for the RouteCalculators API. Provides a Location Service Route Calculator. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RouteCalculator struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/location/v1beta1/zz_tracker_terraformed.go b/apis/location/v1beta1/zz_tracker_terraformed.go new file mode 100755 index 0000000000..1ebad97946 --- /dev/null +++ b/apis/location/v1beta1/zz_tracker_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Tracker +func (mg *Tracker) GetTerraformResourceType() string { + return "aws_location_tracker" +} + +// GetConnectionDetailsMapping for this Tracker +func (tr *Tracker) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Tracker +func (tr *Tracker) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Tracker +func (tr *Tracker) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Tracker +func (tr *Tracker) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Tracker +func (tr *Tracker) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Tracker +func (tr *Tracker) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Tracker +func (tr *Tracker) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Tracker +func (tr *Tracker) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Tracker using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Tracker) LateInitialize(attrs []byte) (bool, error) { + params := &TrackerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Tracker) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/location/v1beta1/zz_tracker_types.go b/apis/location/v1beta1/zz_tracker_types.go index 35e4de5c5b..49f65b2d41 100755 --- a/apis/location/v1beta1/zz_tracker_types.go +++ b/apis/location/v1beta1/zz_tracker_types.go @@ -131,13 +131,14 @@ type TrackerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Tracker is the Schema for the Trackers API. Provides a Location Service Tracker. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Tracker struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/location/v1beta1/zz_trackerassociation_terraformed.go b/apis/location/v1beta1/zz_trackerassociation_terraformed.go new file mode 100755 index 0000000000..9d455db766 --- /dev/null +++ b/apis/location/v1beta1/zz_trackerassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TrackerAssociation +func (mg *TrackerAssociation) GetTerraformResourceType() string { + return "aws_location_tracker_association" +} + +// GetConnectionDetailsMapping for this TrackerAssociation +func (tr *TrackerAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TrackerAssociation +func (tr *TrackerAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TrackerAssociation +func (tr *TrackerAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TrackerAssociation +func (tr *TrackerAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TrackerAssociation +func (tr *TrackerAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TrackerAssociation +func (tr *TrackerAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TrackerAssociation +func (tr *TrackerAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TrackerAssociation +func (tr *TrackerAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TrackerAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TrackerAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &TrackerAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TrackerAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/location/v1beta1/zz_trackerassociation_types.go b/apis/location/v1beta1/zz_trackerassociation_types.go index 833cb2d730..50a21a49db 100755 --- a/apis/location/v1beta1/zz_trackerassociation_types.go +++ b/apis/location/v1beta1/zz_trackerassociation_types.go @@ -115,13 +115,14 @@ type TrackerAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TrackerAssociation is the Schema for the TrackerAssociations API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TrackerAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/macie2/v1beta1/zz_account_terraformed.go b/apis/macie2/v1beta1/zz_account_terraformed.go new file mode 100755 index 0000000000..beec8fcce4 --- /dev/null +++ b/apis/macie2/v1beta1/zz_account_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Account +func (mg *Account) GetTerraformResourceType() string { + return "aws_macie2_account" +} + +// GetConnectionDetailsMapping for this Account +func (tr *Account) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Account +func (tr *Account) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Account +func (tr *Account) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Account +func (tr *Account) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Account +func (tr *Account) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Account +func (tr *Account) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Account +func (tr *Account) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Account +func (tr *Account) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Account using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Account) LateInitialize(attrs []byte) (bool, error) { + params := &AccountParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Account) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/macie2/v1beta1/zz_account_types.go b/apis/macie2/v1beta1/zz_account_types.go index 971d0924e9..58b4867481 100755 --- a/apis/macie2/v1beta1/zz_account_types.go +++ b/apis/macie2/v1beta1/zz_account_types.go @@ -87,13 +87,14 @@ type AccountStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Account is the Schema for the Accounts API. Provides a resource to manage Amazon Macie on an AWS Account. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Account struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/macie2/v1beta1/zz_classificationjob_terraformed.go b/apis/macie2/v1beta1/zz_classificationjob_terraformed.go new file mode 100755 index 0000000000..a62cc0017f --- /dev/null +++ b/apis/macie2/v1beta1/zz_classificationjob_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClassificationJob +func (mg *ClassificationJob) GetTerraformResourceType() string { + return "aws_macie2_classification_job" +} + +// GetConnectionDetailsMapping for this ClassificationJob +func (tr *ClassificationJob) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClassificationJob +func (tr *ClassificationJob) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClassificationJob +func (tr *ClassificationJob) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClassificationJob +func (tr *ClassificationJob) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClassificationJob +func (tr *ClassificationJob) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClassificationJob +func (tr *ClassificationJob) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClassificationJob +func (tr *ClassificationJob) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClassificationJob +func (tr *ClassificationJob) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClassificationJob using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClassificationJob) LateInitialize(attrs []byte) (bool, error) { + params := &ClassificationJobParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClassificationJob) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/macie2/v1beta1/zz_classificationjob_types.go b/apis/macie2/v1beta1/zz_classificationjob_types.go index c5d4ef3b7c..25fd2f3e6e 100755 --- a/apis/macie2/v1beta1/zz_classificationjob_types.go +++ b/apis/macie2/v1beta1/zz_classificationjob_types.go @@ -974,13 +974,14 @@ type ClassificationJobStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClassificationJob is the Schema for the ClassificationJobs API. Provides a resource to manage an AWS Macie Classification Job. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClassificationJob struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/macie2/v1beta1/zz_customdataidentifier_terraformed.go b/apis/macie2/v1beta1/zz_customdataidentifier_terraformed.go new file mode 100755 index 0000000000..af7abbc8be --- /dev/null +++ b/apis/macie2/v1beta1/zz_customdataidentifier_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CustomDataIdentifier +func (mg *CustomDataIdentifier) GetTerraformResourceType() string { + return "aws_macie2_custom_data_identifier" +} + +// GetConnectionDetailsMapping for this CustomDataIdentifier +func (tr *CustomDataIdentifier) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CustomDataIdentifier +func (tr *CustomDataIdentifier) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CustomDataIdentifier +func (tr *CustomDataIdentifier) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CustomDataIdentifier +func (tr *CustomDataIdentifier) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CustomDataIdentifier +func (tr *CustomDataIdentifier) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CustomDataIdentifier +func (tr *CustomDataIdentifier) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CustomDataIdentifier +func (tr *CustomDataIdentifier) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CustomDataIdentifier +func (tr *CustomDataIdentifier) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CustomDataIdentifier using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CustomDataIdentifier) LateInitialize(attrs []byte) (bool, error) { + params := &CustomDataIdentifierParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CustomDataIdentifier) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/macie2/v1beta1/zz_customdataidentifier_types.go b/apis/macie2/v1beta1/zz_customdataidentifier_types.go index 6861dd0510..af15f7bf68 100755 --- a/apis/macie2/v1beta1/zz_customdataidentifier_types.go +++ b/apis/macie2/v1beta1/zz_customdataidentifier_types.go @@ -146,13 +146,14 @@ type CustomDataIdentifierStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CustomDataIdentifier is the Schema for the CustomDataIdentifiers API. Provides a resource to manage an AWS Macie Custom Data Identifier. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CustomDataIdentifier struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/macie2/v1beta1/zz_findingsfilter_terraformed.go b/apis/macie2/v1beta1/zz_findingsfilter_terraformed.go new file mode 100755 index 0000000000..84a132d808 --- /dev/null +++ b/apis/macie2/v1beta1/zz_findingsfilter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FindingsFilter +func (mg *FindingsFilter) GetTerraformResourceType() string { + return "aws_macie2_findings_filter" +} + +// GetConnectionDetailsMapping for this FindingsFilter +func (tr *FindingsFilter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FindingsFilter +func (tr *FindingsFilter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FindingsFilter +func (tr *FindingsFilter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FindingsFilter +func (tr *FindingsFilter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FindingsFilter +func (tr *FindingsFilter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FindingsFilter +func (tr *FindingsFilter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FindingsFilter +func (tr *FindingsFilter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FindingsFilter +func (tr *FindingsFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FindingsFilter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FindingsFilter) LateInitialize(attrs []byte) (bool, error) { + params := &FindingsFilterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FindingsFilter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/macie2/v1beta1/zz_findingsfilter_types.go b/apis/macie2/v1beta1/zz_findingsfilter_types.go index 80a67d10ce..9fe0b684ba 100755 --- a/apis/macie2/v1beta1/zz_findingsfilter_types.go +++ b/apis/macie2/v1beta1/zz_findingsfilter_types.go @@ -244,13 +244,14 @@ type FindingsFilterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FindingsFilter is the Schema for the FindingsFilters API. Provides a resource to manage an Amazon Macie Findings Filter. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FindingsFilter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/macie2/v1beta1/zz_generated.conversion_hubs.go b/apis/macie2/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..f98aa3ee56 --- /dev/null +++ b/apis/macie2/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Account) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClassificationJob) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CustomDataIdentifier) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FindingsFilter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InvitationAccepter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Member) Hub() {} diff --git a/apis/macie2/v1beta1/zz_generated_terraformed.go b/apis/macie2/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index b3ddbac694..0000000000 --- a/apis/macie2/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,703 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Account -func (mg *Account) GetTerraformResourceType() string { - return "aws_macie2_account" -} - -// GetConnectionDetailsMapping for this Account -func (tr *Account) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Account -func (tr *Account) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Account -func (tr *Account) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Account -func (tr *Account) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Account -func (tr *Account) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Account -func (tr *Account) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Account -func (tr *Account) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Account -func (tr *Account) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Account using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Account) LateInitialize(attrs []byte) (bool, error) { - params := &AccountParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Account) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClassificationJob -func (mg *ClassificationJob) GetTerraformResourceType() string { - return "aws_macie2_classification_job" -} - -// GetConnectionDetailsMapping for this ClassificationJob -func (tr *ClassificationJob) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClassificationJob -func (tr *ClassificationJob) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClassificationJob -func (tr *ClassificationJob) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClassificationJob -func (tr *ClassificationJob) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClassificationJob -func (tr *ClassificationJob) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClassificationJob -func (tr *ClassificationJob) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClassificationJob -func (tr *ClassificationJob) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClassificationJob -func (tr *ClassificationJob) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClassificationJob using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClassificationJob) LateInitialize(attrs []byte) (bool, error) { - params := &ClassificationJobParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClassificationJob) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CustomDataIdentifier -func (mg *CustomDataIdentifier) GetTerraformResourceType() string { - return "aws_macie2_custom_data_identifier" -} - -// GetConnectionDetailsMapping for this CustomDataIdentifier -func (tr *CustomDataIdentifier) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CustomDataIdentifier -func (tr *CustomDataIdentifier) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CustomDataIdentifier -func (tr *CustomDataIdentifier) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CustomDataIdentifier -func (tr *CustomDataIdentifier) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CustomDataIdentifier -func (tr *CustomDataIdentifier) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CustomDataIdentifier -func (tr *CustomDataIdentifier) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CustomDataIdentifier -func (tr *CustomDataIdentifier) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CustomDataIdentifier -func (tr *CustomDataIdentifier) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CustomDataIdentifier using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CustomDataIdentifier) LateInitialize(attrs []byte) (bool, error) { - params := &CustomDataIdentifierParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CustomDataIdentifier) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FindingsFilter -func (mg *FindingsFilter) GetTerraformResourceType() string { - return "aws_macie2_findings_filter" -} - -// GetConnectionDetailsMapping for this FindingsFilter -func (tr *FindingsFilter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FindingsFilter -func (tr *FindingsFilter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FindingsFilter -func (tr *FindingsFilter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FindingsFilter -func (tr *FindingsFilter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FindingsFilter -func (tr *FindingsFilter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FindingsFilter -func (tr *FindingsFilter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FindingsFilter -func (tr *FindingsFilter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FindingsFilter -func (tr *FindingsFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FindingsFilter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FindingsFilter) LateInitialize(attrs []byte) (bool, error) { - params := &FindingsFilterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FindingsFilter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InvitationAccepter -func (mg *InvitationAccepter) GetTerraformResourceType() string { - return "aws_macie2_invitation_accepter" -} - -// GetConnectionDetailsMapping for this InvitationAccepter -func (tr *InvitationAccepter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InvitationAccepter -func (tr *InvitationAccepter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InvitationAccepter -func (tr *InvitationAccepter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InvitationAccepter -func (tr *InvitationAccepter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InvitationAccepter -func (tr *InvitationAccepter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InvitationAccepter -func (tr *InvitationAccepter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InvitationAccepter -func (tr *InvitationAccepter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InvitationAccepter -func (tr *InvitationAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InvitationAccepter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InvitationAccepter) LateInitialize(attrs []byte) (bool, error) { - params := &InvitationAccepterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InvitationAccepter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Member -func (mg *Member) GetTerraformResourceType() string { - return "aws_macie2_member" -} - -// GetConnectionDetailsMapping for this Member -func (tr *Member) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Member -func (tr *Member) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Member -func (tr *Member) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Member -func (tr *Member) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Member -func (tr *Member) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Member -func (tr *Member) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Member -func (tr *Member) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Member -func (tr *Member) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Member using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Member) LateInitialize(attrs []byte) (bool, error) { - params := &MemberParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Member) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/macie2/v1beta1/zz_invitationaccepter_terraformed.go b/apis/macie2/v1beta1/zz_invitationaccepter_terraformed.go new file mode 100755 index 0000000000..299927b643 --- /dev/null +++ b/apis/macie2/v1beta1/zz_invitationaccepter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InvitationAccepter +func (mg *InvitationAccepter) GetTerraformResourceType() string { + return "aws_macie2_invitation_accepter" +} + +// GetConnectionDetailsMapping for this InvitationAccepter +func (tr *InvitationAccepter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InvitationAccepter +func (tr *InvitationAccepter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InvitationAccepter +func (tr *InvitationAccepter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InvitationAccepter +func (tr *InvitationAccepter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InvitationAccepter +func (tr *InvitationAccepter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InvitationAccepter +func (tr *InvitationAccepter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InvitationAccepter +func (tr *InvitationAccepter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InvitationAccepter +func (tr *InvitationAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InvitationAccepter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InvitationAccepter) LateInitialize(attrs []byte) (bool, error) { + params := &InvitationAccepterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InvitationAccepter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/macie2/v1beta1/zz_invitationaccepter_types.go b/apis/macie2/v1beta1/zz_invitationaccepter_types.go index fc4d669e69..6d00d2427f 100755 --- a/apis/macie2/v1beta1/zz_invitationaccepter_types.go +++ b/apis/macie2/v1beta1/zz_invitationaccepter_types.go @@ -71,13 +71,14 @@ type InvitationAccepterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InvitationAccepter is the Schema for the InvitationAccepters API. Provides a resource to manage an Amazon Macie Invitation Accepter. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InvitationAccepter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/macie2/v1beta1/zz_member_terraformed.go b/apis/macie2/v1beta1/zz_member_terraformed.go new file mode 100755 index 0000000000..737e762db5 --- /dev/null +++ b/apis/macie2/v1beta1/zz_member_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Member +func (mg *Member) GetTerraformResourceType() string { + return "aws_macie2_member" +} + +// GetConnectionDetailsMapping for this Member +func (tr *Member) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Member +func (tr *Member) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Member +func (tr *Member) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Member +func (tr *Member) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Member +func (tr *Member) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Member +func (tr *Member) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Member +func (tr *Member) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Member +func (tr *Member) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Member using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Member) LateInitialize(attrs []byte) (bool, error) { + params := &MemberParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Member) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/macie2/v1beta1/zz_member_types.go b/apis/macie2/v1beta1/zz_member_types.go index 887a17c82e..b358c157ea 100755 --- a/apis/macie2/v1beta1/zz_member_types.go +++ b/apis/macie2/v1beta1/zz_member_types.go @@ -152,13 +152,14 @@ type MemberStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Member is the Schema for the Members API. Provides a resource to manage an Amazon Macie Member. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Member struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/mediaconvert/v1beta1/zz_generated.conversion_hubs.go b/apis/mediaconvert/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..55a1b79d63 --- /dev/null +++ b/apis/mediaconvert/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Queue) Hub() {} diff --git a/apis/mediaconvert/v1beta1/zz_generated_terraformed.go b/apis/mediaconvert/v1beta1/zz_queue_terraformed.go similarity index 100% rename from apis/mediaconvert/v1beta1/zz_generated_terraformed.go rename to apis/mediaconvert/v1beta1/zz_queue_terraformed.go diff --git a/apis/mediaconvert/v1beta1/zz_queue_types.go b/apis/mediaconvert/v1beta1/zz_queue_types.go index c54396c86f..a7fc7f9b30 100755 --- a/apis/mediaconvert/v1beta1/zz_queue_types.go +++ b/apis/mediaconvert/v1beta1/zz_queue_types.go @@ -157,13 +157,14 @@ type QueueStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Queue is the Schema for the Queues API. Provides an AWS Elemental MediaConvert Queue. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Queue struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/medialive/v1beta1/zz_channel_terraformed.go b/apis/medialive/v1beta1/zz_channel_terraformed.go new file mode 100755 index 0000000000..c62312aab0 --- /dev/null +++ b/apis/medialive/v1beta1/zz_channel_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Channel +func (mg *Channel) GetTerraformResourceType() string { + return "aws_medialive_channel" +} + +// GetConnectionDetailsMapping for this Channel +func (tr *Channel) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Channel +func (tr *Channel) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Channel +func (tr *Channel) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Channel +func (tr *Channel) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Channel +func (tr *Channel) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Channel +func (tr *Channel) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Channel +func (tr *Channel) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Channel +func (tr *Channel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Channel using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Channel) LateInitialize(attrs []byte) (bool, error) { + params := &ChannelParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Channel) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/medialive/v1beta1/zz_channel_types.go b/apis/medialive/v1beta1/zz_channel_types.go index bbeeaea351..7f858da492 100755 --- a/apis/medialive/v1beta1/zz_channel_types.go +++ b/apis/medialive/v1beta1/zz_channel_types.go @@ -6844,13 +6844,14 @@ type ChannelStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Channel is the Schema for the Channels API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Channel struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/medialive/v1beta1/zz_generated.conversion_hubs.go b/apis/medialive/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..3b4aaafc95 --- /dev/null +++ b/apis/medialive/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Channel) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Input) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InputSecurityGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Multiplex) Hub() {} diff --git a/apis/medialive/v1beta1/zz_generated_terraformed.go b/apis/medialive/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 4620e38a26..0000000000 --- a/apis/medialive/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Channel -func (mg *Channel) GetTerraformResourceType() string { - return "aws_medialive_channel" -} - -// GetConnectionDetailsMapping for this Channel -func (tr *Channel) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Channel -func (tr *Channel) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Channel -func (tr *Channel) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Channel -func (tr *Channel) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Channel -func (tr *Channel) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Channel -func (tr *Channel) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Channel -func (tr *Channel) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Channel -func (tr *Channel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Channel using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Channel) LateInitialize(attrs []byte) (bool, error) { - params := &ChannelParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Channel) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Input -func (mg *Input) GetTerraformResourceType() string { - return "aws_medialive_input" -} - -// GetConnectionDetailsMapping for this Input -func (tr *Input) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Input -func (tr *Input) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Input -func (tr *Input) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Input -func (tr *Input) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Input -func (tr *Input) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Input -func (tr *Input) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Input -func (tr *Input) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Input -func (tr *Input) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Input using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Input) LateInitialize(attrs []byte) (bool, error) { - params := &InputParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Input) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InputSecurityGroup -func (mg *InputSecurityGroup) GetTerraformResourceType() string { - return "aws_medialive_input_security_group" -} - -// GetConnectionDetailsMapping for this InputSecurityGroup -func (tr *InputSecurityGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InputSecurityGroup -func (tr *InputSecurityGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InputSecurityGroup -func (tr *InputSecurityGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InputSecurityGroup -func (tr *InputSecurityGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InputSecurityGroup -func (tr *InputSecurityGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InputSecurityGroup -func (tr *InputSecurityGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InputSecurityGroup -func (tr *InputSecurityGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InputSecurityGroup -func (tr *InputSecurityGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InputSecurityGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InputSecurityGroup) LateInitialize(attrs []byte) (bool, error) { - params := &InputSecurityGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InputSecurityGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Multiplex -func (mg *Multiplex) GetTerraformResourceType() string { - return "aws_medialive_multiplex" -} - -// GetConnectionDetailsMapping for this Multiplex -func (tr *Multiplex) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Multiplex -func (tr *Multiplex) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Multiplex -func (tr *Multiplex) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Multiplex -func (tr *Multiplex) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Multiplex -func (tr *Multiplex) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Multiplex -func (tr *Multiplex) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Multiplex -func (tr *Multiplex) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Multiplex -func (tr *Multiplex) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Multiplex using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Multiplex) LateInitialize(attrs []byte) (bool, error) { - params := &MultiplexParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Multiplex) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/medialive/v1beta1/zz_input_terraformed.go b/apis/medialive/v1beta1/zz_input_terraformed.go new file mode 100755 index 0000000000..9f74332873 --- /dev/null +++ b/apis/medialive/v1beta1/zz_input_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Input +func (mg *Input) GetTerraformResourceType() string { + return "aws_medialive_input" +} + +// GetConnectionDetailsMapping for this Input +func (tr *Input) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Input +func (tr *Input) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Input +func (tr *Input) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Input +func (tr *Input) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Input +func (tr *Input) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Input +func (tr *Input) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Input +func (tr *Input) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Input +func (tr *Input) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Input using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Input) LateInitialize(attrs []byte) (bool, error) { + params := &InputParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Input) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/medialive/v1beta1/zz_input_types.go b/apis/medialive/v1beta1/zz_input_types.go index 8295cdada1..f59dd0f3ed 100755 --- a/apis/medialive/v1beta1/zz_input_types.go +++ b/apis/medialive/v1beta1/zz_input_types.go @@ -324,13 +324,14 @@ type InputStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Input is the Schema for the Inputs API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Input struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/medialive/v1beta1/zz_inputsecuritygroup_terraformed.go b/apis/medialive/v1beta1/zz_inputsecuritygroup_terraformed.go new file mode 100755 index 0000000000..4c1438f076 --- /dev/null +++ b/apis/medialive/v1beta1/zz_inputsecuritygroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InputSecurityGroup +func (mg *InputSecurityGroup) GetTerraformResourceType() string { + return "aws_medialive_input_security_group" +} + +// GetConnectionDetailsMapping for this InputSecurityGroup +func (tr *InputSecurityGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InputSecurityGroup +func (tr *InputSecurityGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InputSecurityGroup +func (tr *InputSecurityGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InputSecurityGroup +func (tr *InputSecurityGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InputSecurityGroup +func (tr *InputSecurityGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InputSecurityGroup +func (tr *InputSecurityGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InputSecurityGroup +func (tr *InputSecurityGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InputSecurityGroup +func (tr *InputSecurityGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InputSecurityGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InputSecurityGroup) LateInitialize(attrs []byte) (bool, error) { + params := &InputSecurityGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InputSecurityGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/medialive/v1beta1/zz_inputsecuritygroup_types.go b/apis/medialive/v1beta1/zz_inputsecuritygroup_types.go index 8f0563767f..1dc35401e5 100755 --- a/apis/medialive/v1beta1/zz_inputsecuritygroup_types.go +++ b/apis/medialive/v1beta1/zz_inputsecuritygroup_types.go @@ -109,13 +109,14 @@ type InputSecurityGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InputSecurityGroup is the Schema for the InputSecurityGroups API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InputSecurityGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/medialive/v1beta1/zz_multiplex_terraformed.go b/apis/medialive/v1beta1/zz_multiplex_terraformed.go new file mode 100755 index 0000000000..b433b9a424 --- /dev/null +++ b/apis/medialive/v1beta1/zz_multiplex_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Multiplex +func (mg *Multiplex) GetTerraformResourceType() string { + return "aws_medialive_multiplex" +} + +// GetConnectionDetailsMapping for this Multiplex +func (tr *Multiplex) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Multiplex +func (tr *Multiplex) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Multiplex +func (tr *Multiplex) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Multiplex +func (tr *Multiplex) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Multiplex +func (tr *Multiplex) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Multiplex +func (tr *Multiplex) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Multiplex +func (tr *Multiplex) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Multiplex +func (tr *Multiplex) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Multiplex using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Multiplex) LateInitialize(attrs []byte) (bool, error) { + params := &MultiplexParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Multiplex) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/medialive/v1beta1/zz_multiplex_types.go b/apis/medialive/v1beta1/zz_multiplex_types.go index fa7ea00155..d7a1460ce6 100755 --- a/apis/medialive/v1beta1/zz_multiplex_types.go +++ b/apis/medialive/v1beta1/zz_multiplex_types.go @@ -165,13 +165,14 @@ type MultiplexStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Multiplex is the Schema for the Multiplexs API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws},path=multiplices type Multiplex struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/mediapackage/v1beta1/zz_generated_terraformed.go b/apis/mediapackage/v1beta1/zz_channel_terraformed.go similarity index 100% rename from apis/mediapackage/v1beta1/zz_generated_terraformed.go rename to apis/mediapackage/v1beta1/zz_channel_terraformed.go diff --git a/apis/mediapackage/v1beta1/zz_channel_types.go b/apis/mediapackage/v1beta1/zz_channel_types.go index 12842314d3..855bfb2f29 100755 --- a/apis/mediapackage/v1beta1/zz_channel_types.go +++ b/apis/mediapackage/v1beta1/zz_channel_types.go @@ -131,13 +131,14 @@ type ChannelStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Channel is the Schema for the Channels API. Provides an AWS Elemental MediaPackage Channel. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Channel struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/mediapackage/v1beta1/zz_generated.conversion_hubs.go b/apis/mediapackage/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..867f795477 --- /dev/null +++ b/apis/mediapackage/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Channel) Hub() {} diff --git a/apis/mediastore/v1beta1/zz_container_terraformed.go b/apis/mediastore/v1beta1/zz_container_terraformed.go new file mode 100755 index 0000000000..161704eba8 --- /dev/null +++ b/apis/mediastore/v1beta1/zz_container_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Container +func (mg *Container) GetTerraformResourceType() string { + return "aws_media_store_container" +} + +// GetConnectionDetailsMapping for this Container +func (tr *Container) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Container +func (tr *Container) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Container +func (tr *Container) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Container +func (tr *Container) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Container +func (tr *Container) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Container +func (tr *Container) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Container +func (tr *Container) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Container +func (tr *Container) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Container using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Container) LateInitialize(attrs []byte) (bool, error) { + params := &ContainerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Container) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/mediastore/v1beta1/zz_container_types.go b/apis/mediastore/v1beta1/zz_container_types.go index d58004a0c4..a38833f807 100755 --- a/apis/mediastore/v1beta1/zz_container_types.go +++ b/apis/mediastore/v1beta1/zz_container_types.go @@ -80,13 +80,14 @@ type ContainerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Container is the Schema for the Containers API. Provides a MediaStore Container. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Container struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/mediastore/v1beta1/zz_generated_terraformed.go b/apis/mediastore/v1beta1/zz_containerpolicy_terraformed.go similarity index 53% rename from apis/mediastore/v1beta1/zz_generated_terraformed.go rename to apis/mediastore/v1beta1/zz_containerpolicy_terraformed.go index 77b19778a0..f5c319fbb3 100755 --- a/apis/mediastore/v1beta1/zz_generated_terraformed.go +++ b/apis/mediastore/v1beta1/zz_containerpolicy_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Container -func (mg *Container) GetTerraformResourceType() string { - return "aws_media_store_container" -} - -// GetConnectionDetailsMapping for this Container -func (tr *Container) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Container -func (tr *Container) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Container -func (tr *Container) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Container -func (tr *Container) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Container -func (tr *Container) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Container -func (tr *Container) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Container -func (tr *Container) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Container -func (tr *Container) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Container using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Container) LateInitialize(attrs []byte) (bool, error) { - params := &ContainerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Container) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this ContainerPolicy func (mg *ContainerPolicy) GetTerraformResourceType() string { return "aws_media_store_container_policy" diff --git a/apis/mediastore/v1beta1/zz_containerpolicy_types.go b/apis/mediastore/v1beta1/zz_containerpolicy_types.go index 8f12f73147..a09de07b9f 100755 --- a/apis/mediastore/v1beta1/zz_containerpolicy_types.go +++ b/apis/mediastore/v1beta1/zz_containerpolicy_types.go @@ -95,13 +95,14 @@ type ContainerPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ContainerPolicy is the Schema for the ContainerPolicys API. Provides a MediaStore Container Policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ContainerPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/mediastore/v1beta1/zz_generated.conversion_hubs.go b/apis/mediastore/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..aee348f7c1 --- /dev/null +++ b/apis/mediastore/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Container) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ContainerPolicy) Hub() {} diff --git a/apis/memorydb/v1beta1/zz_acl_terraformed.go b/apis/memorydb/v1beta1/zz_acl_terraformed.go new file mode 100755 index 0000000000..028b4c5e69 --- /dev/null +++ b/apis/memorydb/v1beta1/zz_acl_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ACL +func (mg *ACL) GetTerraformResourceType() string { + return "aws_memorydb_acl" +} + +// GetConnectionDetailsMapping for this ACL +func (tr *ACL) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ACL +func (tr *ACL) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ACL +func (tr *ACL) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ACL +func (tr *ACL) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ACL +func (tr *ACL) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ACL +func (tr *ACL) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ACL +func (tr *ACL) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ACL +func (tr *ACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ACL using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ACL) LateInitialize(attrs []byte) (bool, error) { + params := &ACLParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ACL) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/memorydb/v1beta1/zz_acl_types.go b/apis/memorydb/v1beta1/zz_acl_types.go index 8ecd7f6972..f78f273402 100755 --- a/apis/memorydb/v1beta1/zz_acl_types.go +++ b/apis/memorydb/v1beta1/zz_acl_types.go @@ -94,13 +94,14 @@ type ACLStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ACL is the Schema for the ACLs API. Provides a MemoryDB ACL. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ACL struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/memorydb/v1beta1/zz_cluster_terraformed.go b/apis/memorydb/v1beta1/zz_cluster_terraformed.go new file mode 100755 index 0000000000..6d5340d16e --- /dev/null +++ b/apis/memorydb/v1beta1/zz_cluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cluster +func (mg *Cluster) GetTerraformResourceType() string { + return "aws_memorydb_cluster" +} + +// GetConnectionDetailsMapping for this Cluster +func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Cluster +func (tr *Cluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cluster +func (tr *Cluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cluster +func (tr *Cluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cluster +func (tr *Cluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cluster +func (tr *Cluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/memorydb/v1beta1/zz_cluster_types.go b/apis/memorydb/v1beta1/zz_cluster_types.go index a0db133768..ce535da99b 100755 --- a/apis/memorydb/v1beta1/zz_cluster_types.go +++ b/apis/memorydb/v1beta1/zz_cluster_types.go @@ -430,13 +430,14 @@ type ClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cluster is the Schema for the Clusters API. Provides a MemoryDB Cluster. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/memorydb/v1beta1/zz_generated.conversion_hubs.go b/apis/memorydb/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..47e3cedd5f --- /dev/null +++ b/apis/memorydb/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ACL) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Cluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ParameterGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Snapshot) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SubnetGroup) Hub() {} diff --git a/apis/memorydb/v1beta1/zz_generated_terraformed.go b/apis/memorydb/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 5d2c8b68a9..0000000000 --- a/apis/memorydb/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,589 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this ACL -func (mg *ACL) GetTerraformResourceType() string { - return "aws_memorydb_acl" -} - -// GetConnectionDetailsMapping for this ACL -func (tr *ACL) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ACL -func (tr *ACL) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ACL -func (tr *ACL) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ACL -func (tr *ACL) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ACL -func (tr *ACL) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ACL -func (tr *ACL) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ACL -func (tr *ACL) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ACL -func (tr *ACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ACL using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ACL) LateInitialize(attrs []byte) (bool, error) { - params := &ACLParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ACL) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Cluster -func (mg *Cluster) GetTerraformResourceType() string { - return "aws_memorydb_cluster" -} - -// GetConnectionDetailsMapping for this Cluster -func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Cluster -func (tr *Cluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cluster -func (tr *Cluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cluster -func (tr *Cluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cluster -func (tr *Cluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cluster -func (tr *Cluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ParameterGroup -func (mg *ParameterGroup) GetTerraformResourceType() string { - return "aws_memorydb_parameter_group" -} - -// GetConnectionDetailsMapping for this ParameterGroup -func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ParameterGroup -func (tr *ParameterGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ParameterGroup -func (tr *ParameterGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ParameterGroup -func (tr *ParameterGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ParameterGroup -func (tr *ParameterGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ParameterGroup -func (tr *ParameterGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ParameterGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ParameterGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ParameterGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Snapshot -func (mg *Snapshot) GetTerraformResourceType() string { - return "aws_memorydb_snapshot" -} - -// GetConnectionDetailsMapping for this Snapshot -func (tr *Snapshot) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Snapshot -func (tr *Snapshot) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Snapshot -func (tr *Snapshot) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Snapshot -func (tr *Snapshot) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Snapshot -func (tr *Snapshot) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Snapshot -func (tr *Snapshot) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Snapshot -func (tr *Snapshot) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Snapshot -func (tr *Snapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Snapshot using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Snapshot) LateInitialize(attrs []byte) (bool, error) { - params := &SnapshotParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Snapshot) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SubnetGroup -func (mg *SubnetGroup) GetTerraformResourceType() string { - return "aws_memorydb_subnet_group" -} - -// GetConnectionDetailsMapping for this SubnetGroup -func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SubnetGroup -func (tr *SubnetGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SubnetGroup -func (tr *SubnetGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SubnetGroup -func (tr *SubnetGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SubnetGroup -func (tr *SubnetGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SubnetGroup -func (tr *SubnetGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SubnetGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { - params := &SubnetGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SubnetGroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/memorydb/v1beta1/zz_parametergroup_terraformed.go b/apis/memorydb/v1beta1/zz_parametergroup_terraformed.go new file mode 100755 index 0000000000..9eb82ea4b3 --- /dev/null +++ b/apis/memorydb/v1beta1/zz_parametergroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ParameterGroup +func (mg *ParameterGroup) GetTerraformResourceType() string { + return "aws_memorydb_parameter_group" +} + +// GetConnectionDetailsMapping for this ParameterGroup +func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ParameterGroup +func (tr *ParameterGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ParameterGroup +func (tr *ParameterGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ParameterGroup +func (tr *ParameterGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ParameterGroup +func (tr *ParameterGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ParameterGroup +func (tr *ParameterGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ParameterGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ParameterGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ParameterGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/memorydb/v1beta1/zz_parametergroup_types.go b/apis/memorydb/v1beta1/zz_parametergroup_types.go index 80b2d4f4f7..08320da211 100755 --- a/apis/memorydb/v1beta1/zz_parametergroup_types.go +++ b/apis/memorydb/v1beta1/zz_parametergroup_types.go @@ -137,13 +137,14 @@ type ParameterGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ParameterGroup is the Schema for the ParameterGroups API. Provides a MemoryDB Parameter Group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ParameterGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/memorydb/v1beta1/zz_snapshot_terraformed.go b/apis/memorydb/v1beta1/zz_snapshot_terraformed.go new file mode 100755 index 0000000000..9a1aa38492 --- /dev/null +++ b/apis/memorydb/v1beta1/zz_snapshot_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Snapshot +func (mg *Snapshot) GetTerraformResourceType() string { + return "aws_memorydb_snapshot" +} + +// GetConnectionDetailsMapping for this Snapshot +func (tr *Snapshot) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Snapshot +func (tr *Snapshot) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Snapshot +func (tr *Snapshot) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Snapshot +func (tr *Snapshot) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Snapshot +func (tr *Snapshot) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Snapshot +func (tr *Snapshot) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Snapshot +func (tr *Snapshot) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Snapshot +func (tr *Snapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Snapshot using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Snapshot) LateInitialize(attrs []byte) (bool, error) { + params := &SnapshotParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Snapshot) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/memorydb/v1beta1/zz_snapshot_types.go b/apis/memorydb/v1beta1/zz_snapshot_types.go index a1e7db9ec0..893011fd17 100755 --- a/apis/memorydb/v1beta1/zz_snapshot_types.go +++ b/apis/memorydb/v1beta1/zz_snapshot_types.go @@ -188,13 +188,14 @@ type SnapshotStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Snapshot is the Schema for the Snapshots API. Provides a MemoryDB Snapshot. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Snapshot struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/memorydb/v1beta1/zz_subnetgroup_terraformed.go b/apis/memorydb/v1beta1/zz_subnetgroup_terraformed.go new file mode 100755 index 0000000000..057b6d5f06 --- /dev/null +++ b/apis/memorydb/v1beta1/zz_subnetgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SubnetGroup +func (mg *SubnetGroup) GetTerraformResourceType() string { + return "aws_memorydb_subnet_group" +} + +// GetConnectionDetailsMapping for this SubnetGroup +func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SubnetGroup +func (tr *SubnetGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SubnetGroup +func (tr *SubnetGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SubnetGroup +func (tr *SubnetGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SubnetGroup +func (tr *SubnetGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SubnetGroup +func (tr *SubnetGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SubnetGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { + params := &SubnetGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SubnetGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/memorydb/v1beta1/zz_subnetgroup_types.go b/apis/memorydb/v1beta1/zz_subnetgroup_types.go index d20aadd836..c5ddce5c3e 100755 --- a/apis/memorydb/v1beta1/zz_subnetgroup_types.go +++ b/apis/memorydb/v1beta1/zz_subnetgroup_types.go @@ -126,13 +126,14 @@ type SubnetGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SubnetGroup is the Schema for the SubnetGroups API. Provides a MemoryDB Subnet Group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SubnetGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/mq/v1beta1/zz_generated_terraformed.go b/apis/mq/v1beta1/zz_broker_terraformed.go similarity index 52% rename from apis/mq/v1beta1/zz_generated_terraformed.go rename to apis/mq/v1beta1/zz_broker_terraformed.go index c744914e79..120a365ae0 100755 --- a/apis/mq/v1beta1/zz_generated_terraformed.go +++ b/apis/mq/v1beta1/zz_broker_terraformed.go @@ -131,117 +131,3 @@ func (tr *Broker) LateInitialize(attrs []byte) (bool, error) { func (tr *Broker) GetTerraformSchemaVersion() int { return 0 } - -// GetTerraformResourceType returns Terraform resource type for this Configuration -func (mg *Configuration) GetTerraformResourceType() string { - return "aws_mq_configuration" -} - -// GetConnectionDetailsMapping for this Configuration -func (tr *Configuration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Configuration -func (tr *Configuration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Configuration -func (tr *Configuration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Configuration -func (tr *Configuration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Configuration -func (tr *Configuration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Configuration -func (tr *Configuration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Configuration -func (tr *Configuration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Configuration -func (tr *Configuration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Configuration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Configuration) LateInitialize(attrs []byte) (bool, error) { - params := &ConfigurationParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Configuration) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/mq/v1beta1/zz_broker_types.go b/apis/mq/v1beta1/zz_broker_types.go index 9db32d9bd1..0b0ccacbbd 100755 --- a/apis/mq/v1beta1/zz_broker_types.go +++ b/apis/mq/v1beta1/zz_broker_types.go @@ -634,13 +634,14 @@ type BrokerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Broker is the Schema for the Brokers API. Provides an MQ Broker Resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Broker struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/mq/v1beta1/zz_configuration_terraformed.go b/apis/mq/v1beta1/zz_configuration_terraformed.go new file mode 100755 index 0000000000..c08f5ce3e3 --- /dev/null +++ b/apis/mq/v1beta1/zz_configuration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Configuration +func (mg *Configuration) GetTerraformResourceType() string { + return "aws_mq_configuration" +} + +// GetConnectionDetailsMapping for this Configuration +func (tr *Configuration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Configuration +func (tr *Configuration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Configuration +func (tr *Configuration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Configuration +func (tr *Configuration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Configuration +func (tr *Configuration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Configuration +func (tr *Configuration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Configuration +func (tr *Configuration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Configuration +func (tr *Configuration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Configuration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Configuration) LateInitialize(attrs []byte) (bool, error) { + params := &ConfigurationParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Configuration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/mq/v1beta1/zz_configuration_types.go b/apis/mq/v1beta1/zz_configuration_types.go index 4169815485..423abafbda 100755 --- a/apis/mq/v1beta1/zz_configuration_types.go +++ b/apis/mq/v1beta1/zz_configuration_types.go @@ -141,13 +141,14 @@ type ConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Configuration is the Schema for the Configurations API. Provides an MQ configuration Resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Configuration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/mq/v1beta1/zz_generated.conversion_hubs.go b/apis/mq/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..95870cbf94 --- /dev/null +++ b/apis/mq/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Broker) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Configuration) Hub() {} diff --git a/apis/neptune/v1beta1/zz_cluster_terraformed.go b/apis/neptune/v1beta1/zz_cluster_terraformed.go new file mode 100755 index 0000000000..ae111282a9 --- /dev/null +++ b/apis/neptune/v1beta1/zz_cluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cluster +func (mg *Cluster) GetTerraformResourceType() string { + return "aws_neptune_cluster" +} + +// GetConnectionDetailsMapping for this Cluster +func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Cluster +func (tr *Cluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cluster +func (tr *Cluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cluster +func (tr *Cluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cluster +func (tr *Cluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cluster +func (tr *Cluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/neptune/v1beta1/zz_cluster_types.go b/apis/neptune/v1beta1/zz_cluster_types.go index 132d3f2dc5..6abaeeefea 100755 --- a/apis/neptune/v1beta1/zz_cluster_types.go +++ b/apis/neptune/v1beta1/zz_cluster_types.go @@ -529,13 +529,14 @@ type ClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cluster is the Schema for the Clusters API. Provides an Neptune Cluster Resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/neptune/v1beta1/zz_clusterendpoint_terraformed.go b/apis/neptune/v1beta1/zz_clusterendpoint_terraformed.go new file mode 100755 index 0000000000..4277d946fd --- /dev/null +++ b/apis/neptune/v1beta1/zz_clusterendpoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterEndpoint +func (mg *ClusterEndpoint) GetTerraformResourceType() string { + return "aws_neptune_cluster_endpoint" +} + +// GetConnectionDetailsMapping for this ClusterEndpoint +func (tr *ClusterEndpoint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterEndpoint +func (tr *ClusterEndpoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterEndpoint +func (tr *ClusterEndpoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterEndpoint +func (tr *ClusterEndpoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterEndpoint +func (tr *ClusterEndpoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterEndpoint +func (tr *ClusterEndpoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterEndpoint +func (tr *ClusterEndpoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterEndpoint +func (tr *ClusterEndpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterEndpoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterEndpoint) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterEndpointParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterEndpoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/neptune/v1beta1/zz_clusterendpoint_types.go b/apis/neptune/v1beta1/zz_clusterendpoint_types.go index 26bd73029c..b5bb7f145e 100755 --- a/apis/neptune/v1beta1/zz_clusterendpoint_types.go +++ b/apis/neptune/v1beta1/zz_clusterendpoint_types.go @@ -145,13 +145,14 @@ type ClusterEndpointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterEndpoint is the Schema for the ClusterEndpoints API. Provides an Neptune Cluster Endpoint Resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterEndpoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/neptune/v1beta1/zz_clusterinstance_terraformed.go b/apis/neptune/v1beta1/zz_clusterinstance_terraformed.go new file mode 100755 index 0000000000..95232f2397 --- /dev/null +++ b/apis/neptune/v1beta1/zz_clusterinstance_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterInstance +func (mg *ClusterInstance) GetTerraformResourceType() string { + return "aws_neptune_cluster_instance" +} + +// GetConnectionDetailsMapping for this ClusterInstance +func (tr *ClusterInstance) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterInstance +func (tr *ClusterInstance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterInstance +func (tr *ClusterInstance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterInstance +func (tr *ClusterInstance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterInstance +func (tr *ClusterInstance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterInstance +func (tr *ClusterInstance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterInstance +func (tr *ClusterInstance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterInstance +func (tr *ClusterInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterInstance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterInstance) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterInstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterInstance) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/neptune/v1beta1/zz_clusterinstance_types.go b/apis/neptune/v1beta1/zz_clusterinstance_types.go index 45b07ca8f3..a251e190f8 100755 --- a/apis/neptune/v1beta1/zz_clusterinstance_types.go +++ b/apis/neptune/v1beta1/zz_clusterinstance_types.go @@ -296,13 +296,14 @@ type ClusterInstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterInstance is the Schema for the ClusterInstances API. Provides an Neptune Cluster Resource Instance // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterInstance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/neptune/v1beta1/zz_clusterparametergroup_terraformed.go b/apis/neptune/v1beta1/zz_clusterparametergroup_terraformed.go new file mode 100755 index 0000000000..8b691441d8 --- /dev/null +++ b/apis/neptune/v1beta1/zz_clusterparametergroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterParameterGroup +func (mg *ClusterParameterGroup) GetTerraformResourceType() string { + return "aws_neptune_cluster_parameter_group" +} + +// GetConnectionDetailsMapping for this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterParameterGroup +func (tr *ClusterParameterGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterParameterGroup +func (tr *ClusterParameterGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterParameterGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterParameterGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameterGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterParameterGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/neptune/v1beta1/zz_clusterparametergroup_types.go b/apis/neptune/v1beta1/zz_clusterparametergroup_types.go index 414f6d32a7..ed6c924813 100755 --- a/apis/neptune/v1beta1/zz_clusterparametergroup_types.go +++ b/apis/neptune/v1beta1/zz_clusterparametergroup_types.go @@ -147,13 +147,14 @@ type ClusterParameterGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterParameterGroup is the Schema for the ClusterParameterGroups API. Manages a Neptune Cluster Parameter Group // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterParameterGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/neptune/v1beta1/zz_clustersnapshot_terraformed.go b/apis/neptune/v1beta1/zz_clustersnapshot_terraformed.go new file mode 100755 index 0000000000..be8eff4b3a --- /dev/null +++ b/apis/neptune/v1beta1/zz_clustersnapshot_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterSnapshot +func (mg *ClusterSnapshot) GetTerraformResourceType() string { + return "aws_neptune_cluster_snapshot" +} + +// GetConnectionDetailsMapping for this ClusterSnapshot +func (tr *ClusterSnapshot) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterSnapshot +func (tr *ClusterSnapshot) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterSnapshot +func (tr *ClusterSnapshot) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterSnapshot +func (tr *ClusterSnapshot) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterSnapshot +func (tr *ClusterSnapshot) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterSnapshot +func (tr *ClusterSnapshot) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterSnapshot +func (tr *ClusterSnapshot) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterSnapshot +func (tr *ClusterSnapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterSnapshot using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterSnapshot) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterSnapshotParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterSnapshot) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/neptune/v1beta1/zz_clustersnapshot_types.go b/apis/neptune/v1beta1/zz_clustersnapshot_types.go index 8026407edd..a43e96bb4d 100755 --- a/apis/neptune/v1beta1/zz_clustersnapshot_types.go +++ b/apis/neptune/v1beta1/zz_clustersnapshot_types.go @@ -123,13 +123,14 @@ type ClusterSnapshotStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterSnapshot is the Schema for the ClusterSnapshots API. Manages a Neptune database cluster snapshot. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterSnapshot struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/neptune/v1beta1/zz_eventsubscription_terraformed.go b/apis/neptune/v1beta1/zz_eventsubscription_terraformed.go new file mode 100755 index 0000000000..27c9152772 --- /dev/null +++ b/apis/neptune/v1beta1/zz_eventsubscription_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EventSubscription +func (mg *EventSubscription) GetTerraformResourceType() string { + return "aws_neptune_event_subscription" +} + +// GetConnectionDetailsMapping for this EventSubscription +func (tr *EventSubscription) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EventSubscription +func (tr *EventSubscription) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EventSubscription +func (tr *EventSubscription) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EventSubscription +func (tr *EventSubscription) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EventSubscription +func (tr *EventSubscription) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EventSubscription +func (tr *EventSubscription) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EventSubscription +func (tr *EventSubscription) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EventSubscription +func (tr *EventSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EventSubscription using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EventSubscription) LateInitialize(attrs []byte) (bool, error) { + params := &EventSubscriptionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EventSubscription) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/neptune/v1beta1/zz_eventsubscription_types.go b/apis/neptune/v1beta1/zz_eventsubscription_types.go index 2710a62149..ccd9fa649a 100755 --- a/apis/neptune/v1beta1/zz_eventsubscription_types.go +++ b/apis/neptune/v1beta1/zz_eventsubscription_types.go @@ -157,13 +157,14 @@ type EventSubscriptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EventSubscription is the Schema for the EventSubscriptions API. Provides a Neptune event subscription resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EventSubscription struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/neptune/v1beta1/zz_generated.conversion_hubs.go b/apis/neptune/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..bf299d2db0 --- /dev/null +++ b/apis/neptune/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Cluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterEndpoint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterInstance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterParameterGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterSnapshot) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EventSubscription) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GlobalCluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ParameterGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SubnetGroup) Hub() {} diff --git a/apis/neptune/v1beta1/zz_generated_terraformed.go b/apis/neptune/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index ea3b48d6d3..0000000000 --- a/apis/neptune/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1045 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Cluster -func (mg *Cluster) GetTerraformResourceType() string { - return "aws_neptune_cluster" -} - -// GetConnectionDetailsMapping for this Cluster -func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Cluster -func (tr *Cluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cluster -func (tr *Cluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cluster -func (tr *Cluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cluster -func (tr *Cluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cluster -func (tr *Cluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterEndpoint -func (mg *ClusterEndpoint) GetTerraformResourceType() string { - return "aws_neptune_cluster_endpoint" -} - -// GetConnectionDetailsMapping for this ClusterEndpoint -func (tr *ClusterEndpoint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterEndpoint -func (tr *ClusterEndpoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterEndpoint -func (tr *ClusterEndpoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterEndpoint -func (tr *ClusterEndpoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterEndpoint -func (tr *ClusterEndpoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterEndpoint -func (tr *ClusterEndpoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterEndpoint -func (tr *ClusterEndpoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterEndpoint -func (tr *ClusterEndpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterEndpoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterEndpoint) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterEndpointParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterEndpoint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterInstance -func (mg *ClusterInstance) GetTerraformResourceType() string { - return "aws_neptune_cluster_instance" -} - -// GetConnectionDetailsMapping for this ClusterInstance -func (tr *ClusterInstance) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterInstance -func (tr *ClusterInstance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterInstance -func (tr *ClusterInstance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterInstance -func (tr *ClusterInstance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterInstance -func (tr *ClusterInstance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterInstance -func (tr *ClusterInstance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterInstance -func (tr *ClusterInstance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterInstance -func (tr *ClusterInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterInstance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterInstance) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterInstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterInstance) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterParameterGroup -func (mg *ClusterParameterGroup) GetTerraformResourceType() string { - return "aws_neptune_cluster_parameter_group" -} - -// GetConnectionDetailsMapping for this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterParameterGroup -func (tr *ClusterParameterGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterParameterGroup -func (tr *ClusterParameterGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterParameterGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterParameterGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameterGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterParameterGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterSnapshot -func (mg *ClusterSnapshot) GetTerraformResourceType() string { - return "aws_neptune_cluster_snapshot" -} - -// GetConnectionDetailsMapping for this ClusterSnapshot -func (tr *ClusterSnapshot) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterSnapshot -func (tr *ClusterSnapshot) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterSnapshot -func (tr *ClusterSnapshot) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterSnapshot -func (tr *ClusterSnapshot) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterSnapshot -func (tr *ClusterSnapshot) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterSnapshot -func (tr *ClusterSnapshot) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterSnapshot -func (tr *ClusterSnapshot) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterSnapshot -func (tr *ClusterSnapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterSnapshot using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterSnapshot) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterSnapshotParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterSnapshot) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EventSubscription -func (mg *EventSubscription) GetTerraformResourceType() string { - return "aws_neptune_event_subscription" -} - -// GetConnectionDetailsMapping for this EventSubscription -func (tr *EventSubscription) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EventSubscription -func (tr *EventSubscription) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EventSubscription -func (tr *EventSubscription) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EventSubscription -func (tr *EventSubscription) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EventSubscription -func (tr *EventSubscription) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EventSubscription -func (tr *EventSubscription) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EventSubscription -func (tr *EventSubscription) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EventSubscription -func (tr *EventSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EventSubscription using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EventSubscription) LateInitialize(attrs []byte) (bool, error) { - params := &EventSubscriptionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EventSubscription) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GlobalCluster -func (mg *GlobalCluster) GetTerraformResourceType() string { - return "aws_neptune_global_cluster" -} - -// GetConnectionDetailsMapping for this GlobalCluster -func (tr *GlobalCluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GlobalCluster -func (tr *GlobalCluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GlobalCluster -func (tr *GlobalCluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GlobalCluster -func (tr *GlobalCluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GlobalCluster -func (tr *GlobalCluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GlobalCluster -func (tr *GlobalCluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GlobalCluster -func (tr *GlobalCluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GlobalCluster -func (tr *GlobalCluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GlobalCluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GlobalCluster) LateInitialize(attrs []byte) (bool, error) { - params := &GlobalClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GlobalCluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ParameterGroup -func (mg *ParameterGroup) GetTerraformResourceType() string { - return "aws_neptune_parameter_group" -} - -// GetConnectionDetailsMapping for this ParameterGroup -func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ParameterGroup -func (tr *ParameterGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ParameterGroup -func (tr *ParameterGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ParameterGroup -func (tr *ParameterGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ParameterGroup -func (tr *ParameterGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ParameterGroup -func (tr *ParameterGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ParameterGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ParameterGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ParameterGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SubnetGroup -func (mg *SubnetGroup) GetTerraformResourceType() string { - return "aws_neptune_subnet_group" -} - -// GetConnectionDetailsMapping for this SubnetGroup -func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SubnetGroup -func (tr *SubnetGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SubnetGroup -func (tr *SubnetGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SubnetGroup -func (tr *SubnetGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SubnetGroup -func (tr *SubnetGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SubnetGroup -func (tr *SubnetGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SubnetGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { - params := &SubnetGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SubnetGroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/neptune/v1beta1/zz_globalcluster_terraformed.go b/apis/neptune/v1beta1/zz_globalcluster_terraformed.go new file mode 100755 index 0000000000..3b39f38e17 --- /dev/null +++ b/apis/neptune/v1beta1/zz_globalcluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GlobalCluster +func (mg *GlobalCluster) GetTerraformResourceType() string { + return "aws_neptune_global_cluster" +} + +// GetConnectionDetailsMapping for this GlobalCluster +func (tr *GlobalCluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GlobalCluster +func (tr *GlobalCluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GlobalCluster +func (tr *GlobalCluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GlobalCluster +func (tr *GlobalCluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GlobalCluster +func (tr *GlobalCluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GlobalCluster +func (tr *GlobalCluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GlobalCluster +func (tr *GlobalCluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GlobalCluster +func (tr *GlobalCluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GlobalCluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GlobalCluster) LateInitialize(attrs []byte) (bool, error) { + params := &GlobalClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GlobalCluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/neptune/v1beta1/zz_globalcluster_types.go b/apis/neptune/v1beta1/zz_globalcluster_types.go index a7f734a3a6..6559e4bab2 100755 --- a/apis/neptune/v1beta1/zz_globalcluster_types.go +++ b/apis/neptune/v1beta1/zz_globalcluster_types.go @@ -154,13 +154,14 @@ type GlobalClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GlobalCluster is the Schema for the GlobalClusters API. Provides an Neptune Global Cluster Resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GlobalCluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/neptune/v1beta1/zz_parametergroup_terraformed.go b/apis/neptune/v1beta1/zz_parametergroup_terraformed.go new file mode 100755 index 0000000000..b87cae8285 --- /dev/null +++ b/apis/neptune/v1beta1/zz_parametergroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ParameterGroup +func (mg *ParameterGroup) GetTerraformResourceType() string { + return "aws_neptune_parameter_group" +} + +// GetConnectionDetailsMapping for this ParameterGroup +func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ParameterGroup +func (tr *ParameterGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ParameterGroup +func (tr *ParameterGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ParameterGroup +func (tr *ParameterGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ParameterGroup +func (tr *ParameterGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ParameterGroup +func (tr *ParameterGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ParameterGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ParameterGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ParameterGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/neptune/v1beta1/zz_parametergroup_types.go b/apis/neptune/v1beta1/zz_parametergroup_types.go index 9c4e598f86..188bdedaa3 100755 --- a/apis/neptune/v1beta1/zz_parametergroup_types.go +++ b/apis/neptune/v1beta1/zz_parametergroup_types.go @@ -147,13 +147,14 @@ type ParameterGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ParameterGroup is the Schema for the ParameterGroups API. Manages a Neptune Parameter Group // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ParameterGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/neptune/v1beta1/zz_subnetgroup_terraformed.go b/apis/neptune/v1beta1/zz_subnetgroup_terraformed.go new file mode 100755 index 0000000000..3e9a1abdd2 --- /dev/null +++ b/apis/neptune/v1beta1/zz_subnetgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SubnetGroup +func (mg *SubnetGroup) GetTerraformResourceType() string { + return "aws_neptune_subnet_group" +} + +// GetConnectionDetailsMapping for this SubnetGroup +func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SubnetGroup +func (tr *SubnetGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SubnetGroup +func (tr *SubnetGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SubnetGroup +func (tr *SubnetGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SubnetGroup +func (tr *SubnetGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SubnetGroup +func (tr *SubnetGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SubnetGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { + params := &SubnetGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SubnetGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/neptune/v1beta1/zz_subnetgroup_types.go b/apis/neptune/v1beta1/zz_subnetgroup_types.go index 7ac263b433..8ed2e10c07 100755 --- a/apis/neptune/v1beta1/zz_subnetgroup_types.go +++ b/apis/neptune/v1beta1/zz_subnetgroup_types.go @@ -123,13 +123,14 @@ type SubnetGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SubnetGroup is the Schema for the SubnetGroups API. Provides an Neptune subnet group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SubnetGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkfirewall/v1beta1/zz_firewall_terraformed.go b/apis/networkfirewall/v1beta1/zz_firewall_terraformed.go new file mode 100755 index 0000000000..89d56a8666 --- /dev/null +++ b/apis/networkfirewall/v1beta1/zz_firewall_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Firewall +func (mg *Firewall) GetTerraformResourceType() string { + return "aws_networkfirewall_firewall" +} + +// GetConnectionDetailsMapping for this Firewall +func (tr *Firewall) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Firewall +func (tr *Firewall) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Firewall +func (tr *Firewall) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Firewall +func (tr *Firewall) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Firewall +func (tr *Firewall) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Firewall +func (tr *Firewall) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Firewall +func (tr *Firewall) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Firewall +func (tr *Firewall) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Firewall using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Firewall) LateInitialize(attrs []byte) (bool, error) { + params := &FirewallParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Firewall) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkfirewall/v1beta1/zz_firewall_types.go b/apis/networkfirewall/v1beta1/zz_firewall_types.go index dc047cb10f..9f964a5a38 100755 --- a/apis/networkfirewall/v1beta1/zz_firewall_types.go +++ b/apis/networkfirewall/v1beta1/zz_firewall_types.go @@ -332,13 +332,14 @@ type FirewallStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Firewall is the Schema for the Firewalls API. Provides an AWS Network Firewall Firewall resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Firewall struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkfirewall/v1beta1/zz_firewallpolicy_terraformed.go b/apis/networkfirewall/v1beta1/zz_firewallpolicy_terraformed.go new file mode 100755 index 0000000000..2bdcfdc3d1 --- /dev/null +++ b/apis/networkfirewall/v1beta1/zz_firewallpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FirewallPolicy +func (mg *FirewallPolicy) GetTerraformResourceType() string { + return "aws_networkfirewall_firewall_policy" +} + +// GetConnectionDetailsMapping for this FirewallPolicy +func (tr *FirewallPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FirewallPolicy +func (tr *FirewallPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FirewallPolicy +func (tr *FirewallPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FirewallPolicy +func (tr *FirewallPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FirewallPolicy +func (tr *FirewallPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FirewallPolicy +func (tr *FirewallPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FirewallPolicy +func (tr *FirewallPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FirewallPolicy +func (tr *FirewallPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FirewallPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FirewallPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &FirewallPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FirewallPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkfirewall/v1beta1/zz_firewallpolicy_types.go b/apis/networkfirewall/v1beta1/zz_firewallpolicy_types.go index bacfd8a2fe..ae482a2896 100755 --- a/apis/networkfirewall/v1beta1/zz_firewallpolicy_types.go +++ b/apis/networkfirewall/v1beta1/zz_firewallpolicy_types.go @@ -466,13 +466,14 @@ type FirewallPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FirewallPolicy is the Schema for the FirewallPolicys API. Provides an AWS Network Firewall Policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FirewallPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkfirewall/v1beta1/zz_generated.conversion_hubs.go b/apis/networkfirewall/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..29adf7cd7e --- /dev/null +++ b/apis/networkfirewall/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Firewall) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FirewallPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LoggingConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RuleGroup) Hub() {} diff --git a/apis/networkfirewall/v1beta1/zz_generated_terraformed.go b/apis/networkfirewall/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 3f92248860..0000000000 --- a/apis/networkfirewall/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Firewall -func (mg *Firewall) GetTerraformResourceType() string { - return "aws_networkfirewall_firewall" -} - -// GetConnectionDetailsMapping for this Firewall -func (tr *Firewall) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Firewall -func (tr *Firewall) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Firewall -func (tr *Firewall) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Firewall -func (tr *Firewall) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Firewall -func (tr *Firewall) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Firewall -func (tr *Firewall) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Firewall -func (tr *Firewall) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Firewall -func (tr *Firewall) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Firewall using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Firewall) LateInitialize(attrs []byte) (bool, error) { - params := &FirewallParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Firewall) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FirewallPolicy -func (mg *FirewallPolicy) GetTerraformResourceType() string { - return "aws_networkfirewall_firewall_policy" -} - -// GetConnectionDetailsMapping for this FirewallPolicy -func (tr *FirewallPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FirewallPolicy -func (tr *FirewallPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FirewallPolicy -func (tr *FirewallPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FirewallPolicy -func (tr *FirewallPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FirewallPolicy -func (tr *FirewallPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FirewallPolicy -func (tr *FirewallPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FirewallPolicy -func (tr *FirewallPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FirewallPolicy -func (tr *FirewallPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FirewallPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FirewallPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &FirewallPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FirewallPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LoggingConfiguration -func (mg *LoggingConfiguration) GetTerraformResourceType() string { - return "aws_networkfirewall_logging_configuration" -} - -// GetConnectionDetailsMapping for this LoggingConfiguration -func (tr *LoggingConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LoggingConfiguration -func (tr *LoggingConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LoggingConfiguration -func (tr *LoggingConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LoggingConfiguration -func (tr *LoggingConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LoggingConfiguration -func (tr *LoggingConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LoggingConfiguration -func (tr *LoggingConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LoggingConfiguration -func (tr *LoggingConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LoggingConfiguration -func (tr *LoggingConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LoggingConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LoggingConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &LoggingConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LoggingConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RuleGroup -func (mg *RuleGroup) GetTerraformResourceType() string { - return "aws_networkfirewall_rule_group" -} - -// GetConnectionDetailsMapping for this RuleGroup -func (tr *RuleGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RuleGroup -func (tr *RuleGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RuleGroup -func (tr *RuleGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RuleGroup -func (tr *RuleGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RuleGroup -func (tr *RuleGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RuleGroup -func (tr *RuleGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RuleGroup -func (tr *RuleGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RuleGroup -func (tr *RuleGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RuleGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RuleGroup) LateInitialize(attrs []byte) (bool, error) { - params := &RuleGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RuleGroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/networkfirewall/v1beta1/zz_loggingconfiguration_terraformed.go b/apis/networkfirewall/v1beta1/zz_loggingconfiguration_terraformed.go new file mode 100755 index 0000000000..57eeba1610 --- /dev/null +++ b/apis/networkfirewall/v1beta1/zz_loggingconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LoggingConfiguration +func (mg *LoggingConfiguration) GetTerraformResourceType() string { + return "aws_networkfirewall_logging_configuration" +} + +// GetConnectionDetailsMapping for this LoggingConfiguration +func (tr *LoggingConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LoggingConfiguration +func (tr *LoggingConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LoggingConfiguration +func (tr *LoggingConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LoggingConfiguration +func (tr *LoggingConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LoggingConfiguration +func (tr *LoggingConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LoggingConfiguration +func (tr *LoggingConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LoggingConfiguration +func (tr *LoggingConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LoggingConfiguration +func (tr *LoggingConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LoggingConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LoggingConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &LoggingConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LoggingConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkfirewall/v1beta1/zz_loggingconfiguration_types.go b/apis/networkfirewall/v1beta1/zz_loggingconfiguration_types.go index 6eb1d2bfab..49d5ff15c5 100755 --- a/apis/networkfirewall/v1beta1/zz_loggingconfiguration_types.go +++ b/apis/networkfirewall/v1beta1/zz_loggingconfiguration_types.go @@ -159,13 +159,14 @@ type LoggingConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LoggingConfiguration is the Schema for the LoggingConfigurations API. Provides an AWS Network Firewall Logging Configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LoggingConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkfirewall/v1beta1/zz_rulegroup_terraformed.go b/apis/networkfirewall/v1beta1/zz_rulegroup_terraformed.go new file mode 100755 index 0000000000..d58ca9564c --- /dev/null +++ b/apis/networkfirewall/v1beta1/zz_rulegroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RuleGroup +func (mg *RuleGroup) GetTerraformResourceType() string { + return "aws_networkfirewall_rule_group" +} + +// GetConnectionDetailsMapping for this RuleGroup +func (tr *RuleGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RuleGroup +func (tr *RuleGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RuleGroup +func (tr *RuleGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RuleGroup +func (tr *RuleGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RuleGroup +func (tr *RuleGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RuleGroup +func (tr *RuleGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RuleGroup +func (tr *RuleGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RuleGroup +func (tr *RuleGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RuleGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RuleGroup) LateInitialize(attrs []byte) (bool, error) { + params := &RuleGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RuleGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkfirewall/v1beta1/zz_rulegroup_types.go b/apis/networkfirewall/v1beta1/zz_rulegroup_types.go index c80dfb1540..c573ce9636 100755 --- a/apis/networkfirewall/v1beta1/zz_rulegroup_types.go +++ b/apis/networkfirewall/v1beta1/zz_rulegroup_types.go @@ -1083,13 +1083,14 @@ type RuleGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RuleGroup is the Schema for the RuleGroups API. Provides an AWS Network Firewall Rule Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RuleGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_attachmentaccepter_terraformed.go b/apis/networkmanager/v1beta1/zz_attachmentaccepter_terraformed.go new file mode 100755 index 0000000000..b8c8cbef36 --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_attachmentaccepter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AttachmentAccepter +func (mg *AttachmentAccepter) GetTerraformResourceType() string { + return "aws_networkmanager_attachment_accepter" +} + +// GetConnectionDetailsMapping for this AttachmentAccepter +func (tr *AttachmentAccepter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AttachmentAccepter +func (tr *AttachmentAccepter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AttachmentAccepter +func (tr *AttachmentAccepter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AttachmentAccepter +func (tr *AttachmentAccepter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AttachmentAccepter +func (tr *AttachmentAccepter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AttachmentAccepter +func (tr *AttachmentAccepter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AttachmentAccepter +func (tr *AttachmentAccepter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AttachmentAccepter +func (tr *AttachmentAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AttachmentAccepter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AttachmentAccepter) LateInitialize(attrs []byte) (bool, error) { + params := &AttachmentAccepterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AttachmentAccepter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_attachmentaccepter_types.go b/apis/networkmanager/v1beta1/zz_attachmentaccepter_types.go index 52abd785d7..9f2fad1c69 100755 --- a/apis/networkmanager/v1beta1/zz_attachmentaccepter_types.go +++ b/apis/networkmanager/v1beta1/zz_attachmentaccepter_types.go @@ -141,13 +141,14 @@ type AttachmentAccepterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AttachmentAccepter is the Schema for the AttachmentAccepters API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AttachmentAccepter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_connectattachment_terraformed.go b/apis/networkmanager/v1beta1/zz_connectattachment_terraformed.go new file mode 100755 index 0000000000..44727a88d0 --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_connectattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConnectAttachment +func (mg *ConnectAttachment) GetTerraformResourceType() string { + return "aws_networkmanager_connect_attachment" +} + +// GetConnectionDetailsMapping for this ConnectAttachment +func (tr *ConnectAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ConnectAttachment +func (tr *ConnectAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConnectAttachment +func (tr *ConnectAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConnectAttachment +func (tr *ConnectAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConnectAttachment +func (tr *ConnectAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConnectAttachment +func (tr *ConnectAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConnectAttachment +func (tr *ConnectAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConnectAttachment +func (tr *ConnectAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConnectAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConnectAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &ConnectAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConnectAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_connectattachment_types.go b/apis/networkmanager/v1beta1/zz_connectattachment_types.go index 313157cb43..71630628f4 100755 --- a/apis/networkmanager/v1beta1/zz_connectattachment_types.go +++ b/apis/networkmanager/v1beta1/zz_connectattachment_types.go @@ -214,13 +214,14 @@ type ConnectAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConnectAttachment is the Schema for the ConnectAttachments API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConnectAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_connection_terraformed.go b/apis/networkmanager/v1beta1/zz_connection_terraformed.go new file mode 100755 index 0000000000..209493f26a --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_connection_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Connection +func (mg *Connection) GetTerraformResourceType() string { + return "aws_networkmanager_connection" +} + +// GetConnectionDetailsMapping for this Connection +func (tr *Connection) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Connection +func (tr *Connection) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Connection +func (tr *Connection) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Connection +func (tr *Connection) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Connection +func (tr *Connection) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Connection +func (tr *Connection) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Connection +func (tr *Connection) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Connection +func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Connection using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { + params := &ConnectionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Connection) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_connection_types.go b/apis/networkmanager/v1beta1/zz_connection_types.go index 7ee8fdc59a..f2b79f3707 100755 --- a/apis/networkmanager/v1beta1/zz_connection_types.go +++ b/apis/networkmanager/v1beta1/zz_connection_types.go @@ -197,13 +197,14 @@ type ConnectionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Connection is the Schema for the Connections API. Creates a connection between two devices. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Connection struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_corenetwork_terraformed.go b/apis/networkmanager/v1beta1/zz_corenetwork_terraformed.go new file mode 100755 index 0000000000..d05c0b7002 --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_corenetwork_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CoreNetwork +func (mg *CoreNetwork) GetTerraformResourceType() string { + return "aws_networkmanager_core_network" +} + +// GetConnectionDetailsMapping for this CoreNetwork +func (tr *CoreNetwork) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CoreNetwork +func (tr *CoreNetwork) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CoreNetwork +func (tr *CoreNetwork) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CoreNetwork +func (tr *CoreNetwork) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CoreNetwork +func (tr *CoreNetwork) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CoreNetwork +func (tr *CoreNetwork) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CoreNetwork +func (tr *CoreNetwork) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CoreNetwork +func (tr *CoreNetwork) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CoreNetwork using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CoreNetwork) LateInitialize(attrs []byte) (bool, error) { + params := &CoreNetworkParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CoreNetwork) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_corenetwork_types.go b/apis/networkmanager/v1beta1/zz_corenetwork_types.go index 12d0da6dcb..b97dd1b89b 100755 --- a/apis/networkmanager/v1beta1/zz_corenetwork_types.go +++ b/apis/networkmanager/v1beta1/zz_corenetwork_types.go @@ -209,13 +209,14 @@ type CoreNetworkStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CoreNetwork is the Schema for the CoreNetworks API. Provides a core network resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CoreNetwork struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_customergatewayassociation_terraformed.go b/apis/networkmanager/v1beta1/zz_customergatewayassociation_terraformed.go new file mode 100755 index 0000000000..b1da4a29b1 --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_customergatewayassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CustomerGatewayAssociation +func (mg *CustomerGatewayAssociation) GetTerraformResourceType() string { + return "aws_networkmanager_customer_gateway_association" +} + +// GetConnectionDetailsMapping for this CustomerGatewayAssociation +func (tr *CustomerGatewayAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CustomerGatewayAssociation +func (tr *CustomerGatewayAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CustomerGatewayAssociation +func (tr *CustomerGatewayAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CustomerGatewayAssociation +func (tr *CustomerGatewayAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CustomerGatewayAssociation +func (tr *CustomerGatewayAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CustomerGatewayAssociation +func (tr *CustomerGatewayAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CustomerGatewayAssociation +func (tr *CustomerGatewayAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CustomerGatewayAssociation +func (tr *CustomerGatewayAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CustomerGatewayAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CustomerGatewayAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &CustomerGatewayAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CustomerGatewayAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_customergatewayassociation_types.go b/apis/networkmanager/v1beta1/zz_customergatewayassociation_types.go index 5b2ed6c129..12e8c3d681 100755 --- a/apis/networkmanager/v1beta1/zz_customergatewayassociation_types.go +++ b/apis/networkmanager/v1beta1/zz_customergatewayassociation_types.go @@ -131,13 +131,14 @@ type CustomerGatewayAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CustomerGatewayAssociation is the Schema for the CustomerGatewayAssociations API. Associates a customer gateway with a device and optionally, with a link. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CustomerGatewayAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_device_terraformed.go b/apis/networkmanager/v1beta1/zz_device_terraformed.go new file mode 100755 index 0000000000..6d8f1c171d --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_device_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Device +func (mg *Device) GetTerraformResourceType() string { + return "aws_networkmanager_device" +} + +// GetConnectionDetailsMapping for this Device +func (tr *Device) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Device +func (tr *Device) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Device +func (tr *Device) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Device +func (tr *Device) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Device +func (tr *Device) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Device +func (tr *Device) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Device +func (tr *Device) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Device +func (tr *Device) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Device using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Device) LateInitialize(attrs []byte) (bool, error) { + params := &DeviceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Device) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_device_types.go b/apis/networkmanager/v1beta1/zz_device_types.go index a6da515286..12346f459b 100755 --- a/apis/networkmanager/v1beta1/zz_device_types.go +++ b/apis/networkmanager/v1beta1/zz_device_types.go @@ -275,13 +275,14 @@ type DeviceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Device is the Schema for the Devices API. Creates a device in a global network. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Device struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_generated.conversion_hubs.go b/apis/networkmanager/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..34398271c1 --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AttachmentAccepter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ConnectAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Connection) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CoreNetwork) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CustomerGatewayAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Device) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GlobalNetwork) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Link) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *LinkAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Site) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayConnectPeerAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TransitGatewayRegistration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCAttachment) Hub() {} diff --git a/apis/networkmanager/v1beta1/zz_generated_terraformed.go b/apis/networkmanager/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 3b21a8d2f9..0000000000 --- a/apis/networkmanager/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1501 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AttachmentAccepter -func (mg *AttachmentAccepter) GetTerraformResourceType() string { - return "aws_networkmanager_attachment_accepter" -} - -// GetConnectionDetailsMapping for this AttachmentAccepter -func (tr *AttachmentAccepter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AttachmentAccepter -func (tr *AttachmentAccepter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AttachmentAccepter -func (tr *AttachmentAccepter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AttachmentAccepter -func (tr *AttachmentAccepter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AttachmentAccepter -func (tr *AttachmentAccepter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AttachmentAccepter -func (tr *AttachmentAccepter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AttachmentAccepter -func (tr *AttachmentAccepter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AttachmentAccepter -func (tr *AttachmentAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AttachmentAccepter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AttachmentAccepter) LateInitialize(attrs []byte) (bool, error) { - params := &AttachmentAccepterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AttachmentAccepter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ConnectAttachment -func (mg *ConnectAttachment) GetTerraformResourceType() string { - return "aws_networkmanager_connect_attachment" -} - -// GetConnectionDetailsMapping for this ConnectAttachment -func (tr *ConnectAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ConnectAttachment -func (tr *ConnectAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConnectAttachment -func (tr *ConnectAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConnectAttachment -func (tr *ConnectAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConnectAttachment -func (tr *ConnectAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConnectAttachment -func (tr *ConnectAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConnectAttachment -func (tr *ConnectAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConnectAttachment -func (tr *ConnectAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConnectAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConnectAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &ConnectAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConnectAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Connection -func (mg *Connection) GetTerraformResourceType() string { - return "aws_networkmanager_connection" -} - -// GetConnectionDetailsMapping for this Connection -func (tr *Connection) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Connection -func (tr *Connection) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Connection -func (tr *Connection) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Connection -func (tr *Connection) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Connection -func (tr *Connection) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Connection -func (tr *Connection) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Connection -func (tr *Connection) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Connection -func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Connection using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { - params := &ConnectionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Connection) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CoreNetwork -func (mg *CoreNetwork) GetTerraformResourceType() string { - return "aws_networkmanager_core_network" -} - -// GetConnectionDetailsMapping for this CoreNetwork -func (tr *CoreNetwork) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CoreNetwork -func (tr *CoreNetwork) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CoreNetwork -func (tr *CoreNetwork) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CoreNetwork -func (tr *CoreNetwork) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CoreNetwork -func (tr *CoreNetwork) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CoreNetwork -func (tr *CoreNetwork) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CoreNetwork -func (tr *CoreNetwork) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CoreNetwork -func (tr *CoreNetwork) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CoreNetwork using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CoreNetwork) LateInitialize(attrs []byte) (bool, error) { - params := &CoreNetworkParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CoreNetwork) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CustomerGatewayAssociation -func (mg *CustomerGatewayAssociation) GetTerraformResourceType() string { - return "aws_networkmanager_customer_gateway_association" -} - -// GetConnectionDetailsMapping for this CustomerGatewayAssociation -func (tr *CustomerGatewayAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CustomerGatewayAssociation -func (tr *CustomerGatewayAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CustomerGatewayAssociation -func (tr *CustomerGatewayAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CustomerGatewayAssociation -func (tr *CustomerGatewayAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CustomerGatewayAssociation -func (tr *CustomerGatewayAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CustomerGatewayAssociation -func (tr *CustomerGatewayAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CustomerGatewayAssociation -func (tr *CustomerGatewayAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CustomerGatewayAssociation -func (tr *CustomerGatewayAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CustomerGatewayAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CustomerGatewayAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &CustomerGatewayAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CustomerGatewayAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Device -func (mg *Device) GetTerraformResourceType() string { - return "aws_networkmanager_device" -} - -// GetConnectionDetailsMapping for this Device -func (tr *Device) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Device -func (tr *Device) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Device -func (tr *Device) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Device -func (tr *Device) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Device -func (tr *Device) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Device -func (tr *Device) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Device -func (tr *Device) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Device -func (tr *Device) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Device using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Device) LateInitialize(attrs []byte) (bool, error) { - params := &DeviceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Device) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GlobalNetwork -func (mg *GlobalNetwork) GetTerraformResourceType() string { - return "aws_networkmanager_global_network" -} - -// GetConnectionDetailsMapping for this GlobalNetwork -func (tr *GlobalNetwork) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GlobalNetwork -func (tr *GlobalNetwork) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GlobalNetwork -func (tr *GlobalNetwork) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GlobalNetwork -func (tr *GlobalNetwork) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GlobalNetwork -func (tr *GlobalNetwork) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GlobalNetwork -func (tr *GlobalNetwork) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GlobalNetwork -func (tr *GlobalNetwork) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GlobalNetwork -func (tr *GlobalNetwork) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GlobalNetwork using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GlobalNetwork) LateInitialize(attrs []byte) (bool, error) { - params := &GlobalNetworkParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GlobalNetwork) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Link -func (mg *Link) GetTerraformResourceType() string { - return "aws_networkmanager_link" -} - -// GetConnectionDetailsMapping for this Link -func (tr *Link) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Link -func (tr *Link) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Link -func (tr *Link) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Link -func (tr *Link) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Link -func (tr *Link) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Link -func (tr *Link) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Link -func (tr *Link) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Link -func (tr *Link) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Link using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Link) LateInitialize(attrs []byte) (bool, error) { - params := &LinkParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Link) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this LinkAssociation -func (mg *LinkAssociation) GetTerraformResourceType() string { - return "aws_networkmanager_link_association" -} - -// GetConnectionDetailsMapping for this LinkAssociation -func (tr *LinkAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LinkAssociation -func (tr *LinkAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LinkAssociation -func (tr *LinkAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LinkAssociation -func (tr *LinkAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LinkAssociation -func (tr *LinkAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LinkAssociation -func (tr *LinkAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LinkAssociation -func (tr *LinkAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LinkAssociation -func (tr *LinkAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LinkAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LinkAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &LinkAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LinkAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Site -func (mg *Site) GetTerraformResourceType() string { - return "aws_networkmanager_site" -} - -// GetConnectionDetailsMapping for this Site -func (tr *Site) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Site -func (tr *Site) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Site -func (tr *Site) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Site -func (tr *Site) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Site -func (tr *Site) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Site -func (tr *Site) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Site -func (tr *Site) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Site -func (tr *Site) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Site using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Site) LateInitialize(attrs []byte) (bool, error) { - params := &SiteParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Site) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayConnectPeerAssociation -func (mg *TransitGatewayConnectPeerAssociation) GetTerraformResourceType() string { - return "aws_networkmanager_transit_gateway_connect_peer_association" -} - -// GetConnectionDetailsMapping for this TransitGatewayConnectPeerAssociation -func (tr *TransitGatewayConnectPeerAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayConnectPeerAssociation -func (tr *TransitGatewayConnectPeerAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayConnectPeerAssociation -func (tr *TransitGatewayConnectPeerAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayConnectPeerAssociation -func (tr *TransitGatewayConnectPeerAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayConnectPeerAssociation -func (tr *TransitGatewayConnectPeerAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayConnectPeerAssociation -func (tr *TransitGatewayConnectPeerAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayConnectPeerAssociation -func (tr *TransitGatewayConnectPeerAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayConnectPeerAssociation -func (tr *TransitGatewayConnectPeerAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayConnectPeerAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayConnectPeerAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayConnectPeerAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayConnectPeerAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TransitGatewayRegistration -func (mg *TransitGatewayRegistration) GetTerraformResourceType() string { - return "aws_networkmanager_transit_gateway_registration" -} - -// GetConnectionDetailsMapping for this TransitGatewayRegistration -func (tr *TransitGatewayRegistration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TransitGatewayRegistration -func (tr *TransitGatewayRegistration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TransitGatewayRegistration -func (tr *TransitGatewayRegistration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TransitGatewayRegistration -func (tr *TransitGatewayRegistration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TransitGatewayRegistration -func (tr *TransitGatewayRegistration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TransitGatewayRegistration -func (tr *TransitGatewayRegistration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TransitGatewayRegistration -func (tr *TransitGatewayRegistration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TransitGatewayRegistration -func (tr *TransitGatewayRegistration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TransitGatewayRegistration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TransitGatewayRegistration) LateInitialize(attrs []byte) (bool, error) { - params := &TransitGatewayRegistrationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TransitGatewayRegistration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCAttachment -func (mg *VPCAttachment) GetTerraformResourceType() string { - return "aws_networkmanager_vpc_attachment" -} - -// GetConnectionDetailsMapping for this VPCAttachment -func (tr *VPCAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCAttachment -func (tr *VPCAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCAttachment -func (tr *VPCAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCAttachment -func (tr *VPCAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCAttachment -func (tr *VPCAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCAttachment -func (tr *VPCAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCAttachment -func (tr *VPCAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCAttachment -func (tr *VPCAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &VPCAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCAttachment) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/networkmanager/v1beta1/zz_globalnetwork_terraformed.go b/apis/networkmanager/v1beta1/zz_globalnetwork_terraformed.go new file mode 100755 index 0000000000..78bbcae85e --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_globalnetwork_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GlobalNetwork +func (mg *GlobalNetwork) GetTerraformResourceType() string { + return "aws_networkmanager_global_network" +} + +// GetConnectionDetailsMapping for this GlobalNetwork +func (tr *GlobalNetwork) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GlobalNetwork +func (tr *GlobalNetwork) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GlobalNetwork +func (tr *GlobalNetwork) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GlobalNetwork +func (tr *GlobalNetwork) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GlobalNetwork +func (tr *GlobalNetwork) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GlobalNetwork +func (tr *GlobalNetwork) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GlobalNetwork +func (tr *GlobalNetwork) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GlobalNetwork +func (tr *GlobalNetwork) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GlobalNetwork using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GlobalNetwork) LateInitialize(attrs []byte) (bool, error) { + params := &GlobalNetworkParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GlobalNetwork) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_globalnetwork_types.go b/apis/networkmanager/v1beta1/zz_globalnetwork_types.go index ab345020f6..0b732baec8 100755 --- a/apis/networkmanager/v1beta1/zz_globalnetwork_types.go +++ b/apis/networkmanager/v1beta1/zz_globalnetwork_types.go @@ -87,13 +87,14 @@ type GlobalNetworkStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GlobalNetwork is the Schema for the GlobalNetworks API. Provides a global network resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GlobalNetwork struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_link_terraformed.go b/apis/networkmanager/v1beta1/zz_link_terraformed.go new file mode 100755 index 0000000000..6d9757f9cc --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_link_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Link +func (mg *Link) GetTerraformResourceType() string { + return "aws_networkmanager_link" +} + +// GetConnectionDetailsMapping for this Link +func (tr *Link) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Link +func (tr *Link) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Link +func (tr *Link) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Link +func (tr *Link) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Link +func (tr *Link) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Link +func (tr *Link) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Link +func (tr *Link) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Link +func (tr *Link) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Link using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Link) LateInitialize(attrs []byte) (bool, error) { + params := &LinkParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Link) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_link_types.go b/apis/networkmanager/v1beta1/zz_link_types.go index 2657b7ace7..ff996ae2e0 100755 --- a/apis/networkmanager/v1beta1/zz_link_types.go +++ b/apis/networkmanager/v1beta1/zz_link_types.go @@ -204,13 +204,14 @@ type LinkStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Link is the Schema for the Links API. Creates a link for a site. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Link struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_linkassociation_terraformed.go b/apis/networkmanager/v1beta1/zz_linkassociation_terraformed.go new file mode 100755 index 0000000000..eb5da0836d --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_linkassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LinkAssociation +func (mg *LinkAssociation) GetTerraformResourceType() string { + return "aws_networkmanager_link_association" +} + +// GetConnectionDetailsMapping for this LinkAssociation +func (tr *LinkAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LinkAssociation +func (tr *LinkAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LinkAssociation +func (tr *LinkAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LinkAssociation +func (tr *LinkAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LinkAssociation +func (tr *LinkAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LinkAssociation +func (tr *LinkAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LinkAssociation +func (tr *LinkAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LinkAssociation +func (tr *LinkAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LinkAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LinkAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &LinkAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LinkAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_linkassociation_types.go b/apis/networkmanager/v1beta1/zz_linkassociation_types.go index e16a1f3117..0f5882d3fb 100755 --- a/apis/networkmanager/v1beta1/zz_linkassociation_types.go +++ b/apis/networkmanager/v1beta1/zz_linkassociation_types.go @@ -107,13 +107,14 @@ type LinkAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LinkAssociation is the Schema for the LinkAssociations API. Associates a link to a device. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LinkAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_site_terraformed.go b/apis/networkmanager/v1beta1/zz_site_terraformed.go new file mode 100755 index 0000000000..969c5893f3 --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_site_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Site +func (mg *Site) GetTerraformResourceType() string { + return "aws_networkmanager_site" +} + +// GetConnectionDetailsMapping for this Site +func (tr *Site) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Site +func (tr *Site) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Site +func (tr *Site) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Site +func (tr *Site) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Site +func (tr *Site) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Site +func (tr *Site) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Site +func (tr *Site) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Site +func (tr *Site) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Site using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Site) LateInitialize(attrs []byte) (bool, error) { + params := &SiteParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Site) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_site_types.go b/apis/networkmanager/v1beta1/zz_site_types.go index 76603be1e9..da69a154b9 100755 --- a/apis/networkmanager/v1beta1/zz_site_types.go +++ b/apis/networkmanager/v1beta1/zz_site_types.go @@ -166,13 +166,14 @@ type SiteStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Site is the Schema for the Sites API. Creates a site in a global network. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Site struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_transitgatewayconnectpeerassociation_terraformed.go b/apis/networkmanager/v1beta1/zz_transitgatewayconnectpeerassociation_terraformed.go new file mode 100755 index 0000000000..d7c7ad24e2 --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_transitgatewayconnectpeerassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayConnectPeerAssociation +func (mg *TransitGatewayConnectPeerAssociation) GetTerraformResourceType() string { + return "aws_networkmanager_transit_gateway_connect_peer_association" +} + +// GetConnectionDetailsMapping for this TransitGatewayConnectPeerAssociation +func (tr *TransitGatewayConnectPeerAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayConnectPeerAssociation +func (tr *TransitGatewayConnectPeerAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayConnectPeerAssociation +func (tr *TransitGatewayConnectPeerAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayConnectPeerAssociation +func (tr *TransitGatewayConnectPeerAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayConnectPeerAssociation +func (tr *TransitGatewayConnectPeerAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayConnectPeerAssociation +func (tr *TransitGatewayConnectPeerAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayConnectPeerAssociation +func (tr *TransitGatewayConnectPeerAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayConnectPeerAssociation +func (tr *TransitGatewayConnectPeerAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayConnectPeerAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayConnectPeerAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayConnectPeerAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayConnectPeerAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_transitgatewayconnectpeerassociation_types.go b/apis/networkmanager/v1beta1/zz_transitgatewayconnectpeerassociation_types.go index 4ef1e8f817..47bbfab752 100755 --- a/apis/networkmanager/v1beta1/zz_transitgatewayconnectpeerassociation_types.go +++ b/apis/networkmanager/v1beta1/zz_transitgatewayconnectpeerassociation_types.go @@ -131,13 +131,14 @@ type TransitGatewayConnectPeerAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayConnectPeerAssociation is the Schema for the TransitGatewayConnectPeerAssociations API. Associates a transit gateway Connect peer with a device, and optionally, with a link. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayConnectPeerAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_transitgatewayregistration_terraformed.go b/apis/networkmanager/v1beta1/zz_transitgatewayregistration_terraformed.go new file mode 100755 index 0000000000..515b931e4a --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_transitgatewayregistration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TransitGatewayRegistration +func (mg *TransitGatewayRegistration) GetTerraformResourceType() string { + return "aws_networkmanager_transit_gateway_registration" +} + +// GetConnectionDetailsMapping for this TransitGatewayRegistration +func (tr *TransitGatewayRegistration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TransitGatewayRegistration +func (tr *TransitGatewayRegistration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TransitGatewayRegistration +func (tr *TransitGatewayRegistration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TransitGatewayRegistration +func (tr *TransitGatewayRegistration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TransitGatewayRegistration +func (tr *TransitGatewayRegistration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TransitGatewayRegistration +func (tr *TransitGatewayRegistration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TransitGatewayRegistration +func (tr *TransitGatewayRegistration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TransitGatewayRegistration +func (tr *TransitGatewayRegistration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TransitGatewayRegistration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TransitGatewayRegistration) LateInitialize(attrs []byte) (bool, error) { + params := &TransitGatewayRegistrationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TransitGatewayRegistration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_transitgatewayregistration_types.go b/apis/networkmanager/v1beta1/zz_transitgatewayregistration_types.go index a947a7c193..5bc4613e9a 100755 --- a/apis/networkmanager/v1beta1/zz_transitgatewayregistration_types.go +++ b/apis/networkmanager/v1beta1/zz_transitgatewayregistration_types.go @@ -91,13 +91,14 @@ type TransitGatewayRegistrationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TransitGatewayRegistration is the Schema for the TransitGatewayRegistrations API. Registers a transit gateway to a global network. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TransitGatewayRegistration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/networkmanager/v1beta1/zz_vpcattachment_terraformed.go b/apis/networkmanager/v1beta1/zz_vpcattachment_terraformed.go new file mode 100755 index 0000000000..aa808ac52b --- /dev/null +++ b/apis/networkmanager/v1beta1/zz_vpcattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCAttachment +func (mg *VPCAttachment) GetTerraformResourceType() string { + return "aws_networkmanager_vpc_attachment" +} + +// GetConnectionDetailsMapping for this VPCAttachment +func (tr *VPCAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCAttachment +func (tr *VPCAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCAttachment +func (tr *VPCAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCAttachment +func (tr *VPCAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCAttachment +func (tr *VPCAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCAttachment +func (tr *VPCAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCAttachment +func (tr *VPCAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCAttachment +func (tr *VPCAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &VPCAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/networkmanager/v1beta1/zz_vpcattachment_types.go b/apis/networkmanager/v1beta1/zz_vpcattachment_types.go index b7ffa4224f..bae2182ddb 100755 --- a/apis/networkmanager/v1beta1/zz_vpcattachment_types.go +++ b/apis/networkmanager/v1beta1/zz_vpcattachment_types.go @@ -232,13 +232,14 @@ type VPCAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCAttachment is the Schema for the VPCAttachments API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opensearch/v1beta1/zz_domain_terraformed.go b/apis/opensearch/v1beta1/zz_domain_terraformed.go new file mode 100755 index 0000000000..f827d47082 --- /dev/null +++ b/apis/opensearch/v1beta1/zz_domain_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Domain +func (mg *Domain) GetTerraformResourceType() string { + return "aws_opensearch_domain" +} + +// GetConnectionDetailsMapping for this Domain +func (tr *Domain) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"advanced_security_options[*].master_user_options[*].master_user_password": "spec.forProvider.advancedSecurityOptions[*].masterUserOptions[*].masterUserPasswordSecretRef"} +} + +// GetObservation of this Domain +func (tr *Domain) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Domain +func (tr *Domain) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Domain +func (tr *Domain) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Domain +func (tr *Domain) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Domain +func (tr *Domain) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Domain +func (tr *Domain) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Domain +func (tr *Domain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Domain using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Domain) LateInitialize(attrs []byte) (bool, error) { + params := &DomainParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Domain) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opensearch/v1beta1/zz_domain_types.go b/apis/opensearch/v1beta1/zz_domain_types.go index e2f18b4b5f..cac6facbcc 100755 --- a/apis/opensearch/v1beta1/zz_domain_types.go +++ b/apis/opensearch/v1beta1/zz_domain_types.go @@ -916,13 +916,14 @@ type DomainStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Domain is the Schema for the Domains API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Domain struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opensearch/v1beta1/zz_domainpolicy_terraformed.go b/apis/opensearch/v1beta1/zz_domainpolicy_terraformed.go new file mode 100755 index 0000000000..e0ae37c7fb --- /dev/null +++ b/apis/opensearch/v1beta1/zz_domainpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DomainPolicy +func (mg *DomainPolicy) GetTerraformResourceType() string { + return "aws_opensearch_domain_policy" +} + +// GetConnectionDetailsMapping for this DomainPolicy +func (tr *DomainPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DomainPolicy +func (tr *DomainPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DomainPolicy +func (tr *DomainPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DomainPolicy +func (tr *DomainPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DomainPolicy +func (tr *DomainPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DomainPolicy +func (tr *DomainPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DomainPolicy +func (tr *DomainPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DomainPolicy +func (tr *DomainPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DomainPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DomainPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &DomainPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DomainPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opensearch/v1beta1/zz_domainpolicy_types.go b/apis/opensearch/v1beta1/zz_domainpolicy_types.go index 645eec4d6c..81ffa30513 100755 --- a/apis/opensearch/v1beta1/zz_domainpolicy_types.go +++ b/apis/opensearch/v1beta1/zz_domainpolicy_types.go @@ -95,13 +95,14 @@ type DomainPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DomainPolicy is the Schema for the DomainPolicys API. Provides an OpenSearch Domain Policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DomainPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opensearch/v1beta1/zz_domainsamloptions_terraformed.go b/apis/opensearch/v1beta1/zz_domainsamloptions_terraformed.go new file mode 100755 index 0000000000..d96fb4edd0 --- /dev/null +++ b/apis/opensearch/v1beta1/zz_domainsamloptions_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DomainSAMLOptions +func (mg *DomainSAMLOptions) GetTerraformResourceType() string { + return "aws_opensearch_domain_saml_options" +} + +// GetConnectionDetailsMapping for this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"saml_options[*].master_user_name": "spec.forProvider.samlOptions[*].masterUserNameSecretRef"} +} + +// GetObservation of this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DomainSAMLOptions +func (tr *DomainSAMLOptions) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DomainSAMLOptions +func (tr *DomainSAMLOptions) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DomainSAMLOptions +func (tr *DomainSAMLOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DomainSAMLOptions using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DomainSAMLOptions) LateInitialize(attrs []byte) (bool, error) { + params := &DomainSAMLOptionsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DomainSAMLOptions) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opensearch/v1beta1/zz_domainsamloptions_types.go b/apis/opensearch/v1beta1/zz_domainsamloptions_types.go index 7b8e589444..7a167089cd 100755 --- a/apis/opensearch/v1beta1/zz_domainsamloptions_types.go +++ b/apis/opensearch/v1beta1/zz_domainsamloptions_types.go @@ -200,13 +200,14 @@ type DomainSAMLOptionsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DomainSAMLOptions is the Schema for the DomainSAMLOptionss API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DomainSAMLOptions struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opensearch/v1beta1/zz_generated.conversion_hubs.go b/apis/opensearch/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..62d14afc7b --- /dev/null +++ b/apis/opensearch/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Domain) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DomainPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DomainSAMLOptions) Hub() {} diff --git a/apis/opensearch/v1beta1/zz_generated_terraformed.go b/apis/opensearch/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 4d1cdd82d4..0000000000 --- a/apis/opensearch/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Domain -func (mg *Domain) GetTerraformResourceType() string { - return "aws_opensearch_domain" -} - -// GetConnectionDetailsMapping for this Domain -func (tr *Domain) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"advanced_security_options[*].master_user_options[*].master_user_password": "spec.forProvider.advancedSecurityOptions[*].masterUserOptions[*].masterUserPasswordSecretRef"} -} - -// GetObservation of this Domain -func (tr *Domain) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Domain -func (tr *Domain) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Domain -func (tr *Domain) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Domain -func (tr *Domain) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Domain -func (tr *Domain) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Domain -func (tr *Domain) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Domain -func (tr *Domain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Domain using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Domain) LateInitialize(attrs []byte) (bool, error) { - params := &DomainParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Domain) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DomainPolicy -func (mg *DomainPolicy) GetTerraformResourceType() string { - return "aws_opensearch_domain_policy" -} - -// GetConnectionDetailsMapping for this DomainPolicy -func (tr *DomainPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DomainPolicy -func (tr *DomainPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DomainPolicy -func (tr *DomainPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DomainPolicy -func (tr *DomainPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DomainPolicy -func (tr *DomainPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DomainPolicy -func (tr *DomainPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DomainPolicy -func (tr *DomainPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DomainPolicy -func (tr *DomainPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DomainPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DomainPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &DomainPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DomainPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DomainSAMLOptions -func (mg *DomainSAMLOptions) GetTerraformResourceType() string { - return "aws_opensearch_domain_saml_options" -} - -// GetConnectionDetailsMapping for this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"saml_options[*].master_user_name": "spec.forProvider.samlOptions[*].masterUserNameSecretRef"} -} - -// GetObservation of this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DomainSAMLOptions -func (tr *DomainSAMLOptions) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DomainSAMLOptions -func (tr *DomainSAMLOptions) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DomainSAMLOptions -func (tr *DomainSAMLOptions) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DomainSAMLOptions using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DomainSAMLOptions) LateInitialize(attrs []byte) (bool, error) { - params := &DomainSAMLOptionsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DomainSAMLOptions) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/opsworks/v1beta1/zz_application_terraformed.go b/apis/opsworks/v1beta1/zz_application_terraformed.go new file mode 100755 index 0000000000..6ef458c7f6 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_application_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Application +func (mg *Application) GetTerraformResourceType() string { + return "aws_opsworks_application" +} + +// GetConnectionDetailsMapping for this Application +func (tr *Application) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"app_source[*].password": "spec.forProvider.appSource[*].passwordSecretRef", "app_source[*].ssh_key": "spec.forProvider.appSource[*].sshKeySecretRef", "ssl_configuration[*].private_key": "spec.forProvider.sslConfiguration[*].privateKeySecretRef"} +} + +// GetObservation of this Application +func (tr *Application) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Application +func (tr *Application) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Application +func (tr *Application) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Application +func (tr *Application) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Application +func (tr *Application) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Application +func (tr *Application) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Application +func (tr *Application) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Application using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Application) LateInitialize(attrs []byte) (bool, error) { + params := &ApplicationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Application) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_application_types.go b/apis/opsworks/v1beta1/zz_application_types.go index 7efe172c31..7e46855c86 100755 --- a/apis/opsworks/v1beta1/zz_application_types.go +++ b/apis/opsworks/v1beta1/zz_application_types.go @@ -372,13 +372,14 @@ type ApplicationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Application is the Schema for the Applications API. Provides an OpsWorks application resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Application struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_customlayer_terraformed.go b/apis/opsworks/v1beta1/zz_customlayer_terraformed.go new file mode 100755 index 0000000000..4d2c3600b2 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_customlayer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CustomLayer +func (mg *CustomLayer) GetTerraformResourceType() string { + return "aws_opsworks_custom_layer" +} + +// GetConnectionDetailsMapping for this CustomLayer +func (tr *CustomLayer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CustomLayer +func (tr *CustomLayer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CustomLayer +func (tr *CustomLayer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CustomLayer +func (tr *CustomLayer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CustomLayer +func (tr *CustomLayer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CustomLayer +func (tr *CustomLayer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CustomLayer +func (tr *CustomLayer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CustomLayer +func (tr *CustomLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CustomLayer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CustomLayer) LateInitialize(attrs []byte) (bool, error) { + params := &CustomLayerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CustomLayer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_customlayer_types.go b/apis/opsworks/v1beta1/zz_customlayer_types.go index 72d4d0e8c4..74f2866593 100755 --- a/apis/opsworks/v1beta1/zz_customlayer_types.go +++ b/apis/opsworks/v1beta1/zz_customlayer_types.go @@ -755,13 +755,14 @@ type CustomLayerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CustomLayer is the Schema for the CustomLayers API. Provides an OpsWorks custom layer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CustomLayer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_ecsclusterlayer_terraformed.go b/apis/opsworks/v1beta1/zz_ecsclusterlayer_terraformed.go new file mode 100755 index 0000000000..9d4430c6c5 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_ecsclusterlayer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EcsClusterLayer +func (mg *EcsClusterLayer) GetTerraformResourceType() string { + return "aws_opsworks_ecs_cluster_layer" +} + +// GetConnectionDetailsMapping for this EcsClusterLayer +func (tr *EcsClusterLayer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EcsClusterLayer +func (tr *EcsClusterLayer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EcsClusterLayer +func (tr *EcsClusterLayer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EcsClusterLayer +func (tr *EcsClusterLayer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EcsClusterLayer +func (tr *EcsClusterLayer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EcsClusterLayer +func (tr *EcsClusterLayer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EcsClusterLayer +func (tr *EcsClusterLayer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EcsClusterLayer +func (tr *EcsClusterLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EcsClusterLayer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EcsClusterLayer) LateInitialize(attrs []byte) (bool, error) { + params := &EcsClusterLayerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EcsClusterLayer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_ecsclusterlayer_types.go b/apis/opsworks/v1beta1/zz_ecsclusterlayer_types.go index f611457c5b..f73e25ccea 100755 --- a/apis/opsworks/v1beta1/zz_ecsclusterlayer_types.go +++ b/apis/opsworks/v1beta1/zz_ecsclusterlayer_types.go @@ -671,13 +671,14 @@ type EcsClusterLayerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EcsClusterLayer is the Schema for the EcsClusterLayers API. Provides an OpsWorks HAProxy layer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EcsClusterLayer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_ganglialayer_terraformed.go b/apis/opsworks/v1beta1/zz_ganglialayer_terraformed.go new file mode 100755 index 0000000000..71f12edff2 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_ganglialayer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GangliaLayer +func (mg *GangliaLayer) GetTerraformResourceType() string { + return "aws_opsworks_ganglia_layer" +} + +// GetConnectionDetailsMapping for this GangliaLayer +func (tr *GangliaLayer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GangliaLayer +func (tr *GangliaLayer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GangliaLayer +func (tr *GangliaLayer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GangliaLayer +func (tr *GangliaLayer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GangliaLayer +func (tr *GangliaLayer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GangliaLayer +func (tr *GangliaLayer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GangliaLayer +func (tr *GangliaLayer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GangliaLayer +func (tr *GangliaLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GangliaLayer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GangliaLayer) LateInitialize(attrs []byte) (bool, error) { + params := &GangliaLayerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GangliaLayer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_ganglialayer_types.go b/apis/opsworks/v1beta1/zz_ganglialayer_types.go index bf50b0d727..4118836fbe 100755 --- a/apis/opsworks/v1beta1/zz_ganglialayer_types.go +++ b/apis/opsworks/v1beta1/zz_ganglialayer_types.go @@ -672,13 +672,14 @@ type GangliaLayerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GangliaLayer is the Schema for the GangliaLayers API. Provides an OpsWorks Ganglia layer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GangliaLayer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_generated.conversion_hubs.go b/apis/opsworks/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..95bc0cad4a --- /dev/null +++ b/apis/opsworks/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Application) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CustomLayer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EcsClusterLayer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GangliaLayer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HAProxyLayer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Instance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *JavaAppLayer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MemcachedLayer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MySQLLayer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NodeJSAppLayer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Permission) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PHPAppLayer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RailsAppLayer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RDSDBInstance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Stack) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *StaticWebLayer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserProfile) Hub() {} diff --git a/apis/opsworks/v1beta1/zz_generated_terraformed.go b/apis/opsworks/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 99d08e4d3c..0000000000 --- a/apis/opsworks/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1957 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Application -func (mg *Application) GetTerraformResourceType() string { - return "aws_opsworks_application" -} - -// GetConnectionDetailsMapping for this Application -func (tr *Application) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"app_source[*].password": "spec.forProvider.appSource[*].passwordSecretRef", "app_source[*].ssh_key": "spec.forProvider.appSource[*].sshKeySecretRef", "ssl_configuration[*].private_key": "spec.forProvider.sslConfiguration[*].privateKeySecretRef"} -} - -// GetObservation of this Application -func (tr *Application) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Application -func (tr *Application) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Application -func (tr *Application) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Application -func (tr *Application) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Application -func (tr *Application) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Application -func (tr *Application) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Application -func (tr *Application) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Application using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Application) LateInitialize(attrs []byte) (bool, error) { - params := &ApplicationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Application) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CustomLayer -func (mg *CustomLayer) GetTerraformResourceType() string { - return "aws_opsworks_custom_layer" -} - -// GetConnectionDetailsMapping for this CustomLayer -func (tr *CustomLayer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CustomLayer -func (tr *CustomLayer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CustomLayer -func (tr *CustomLayer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CustomLayer -func (tr *CustomLayer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CustomLayer -func (tr *CustomLayer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CustomLayer -func (tr *CustomLayer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CustomLayer -func (tr *CustomLayer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CustomLayer -func (tr *CustomLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CustomLayer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CustomLayer) LateInitialize(attrs []byte) (bool, error) { - params := &CustomLayerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CustomLayer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EcsClusterLayer -func (mg *EcsClusterLayer) GetTerraformResourceType() string { - return "aws_opsworks_ecs_cluster_layer" -} - -// GetConnectionDetailsMapping for this EcsClusterLayer -func (tr *EcsClusterLayer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EcsClusterLayer -func (tr *EcsClusterLayer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EcsClusterLayer -func (tr *EcsClusterLayer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EcsClusterLayer -func (tr *EcsClusterLayer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EcsClusterLayer -func (tr *EcsClusterLayer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EcsClusterLayer -func (tr *EcsClusterLayer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EcsClusterLayer -func (tr *EcsClusterLayer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EcsClusterLayer -func (tr *EcsClusterLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EcsClusterLayer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EcsClusterLayer) LateInitialize(attrs []byte) (bool, error) { - params := &EcsClusterLayerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EcsClusterLayer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GangliaLayer -func (mg *GangliaLayer) GetTerraformResourceType() string { - return "aws_opsworks_ganglia_layer" -} - -// GetConnectionDetailsMapping for this GangliaLayer -func (tr *GangliaLayer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GangliaLayer -func (tr *GangliaLayer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GangliaLayer -func (tr *GangliaLayer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GangliaLayer -func (tr *GangliaLayer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GangliaLayer -func (tr *GangliaLayer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GangliaLayer -func (tr *GangliaLayer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GangliaLayer -func (tr *GangliaLayer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GangliaLayer -func (tr *GangliaLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GangliaLayer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GangliaLayer) LateInitialize(attrs []byte) (bool, error) { - params := &GangliaLayerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GangliaLayer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HAProxyLayer -func (mg *HAProxyLayer) GetTerraformResourceType() string { - return "aws_opsworks_haproxy_layer" -} - -// GetConnectionDetailsMapping for this HAProxyLayer -func (tr *HAProxyLayer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HAProxyLayer -func (tr *HAProxyLayer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HAProxyLayer -func (tr *HAProxyLayer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HAProxyLayer -func (tr *HAProxyLayer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HAProxyLayer -func (tr *HAProxyLayer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HAProxyLayer -func (tr *HAProxyLayer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HAProxyLayer -func (tr *HAProxyLayer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HAProxyLayer -func (tr *HAProxyLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HAProxyLayer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HAProxyLayer) LateInitialize(attrs []byte) (bool, error) { - params := &HAProxyLayerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HAProxyLayer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Instance -func (mg *Instance) GetTerraformResourceType() string { - return "aws_opsworks_instance" -} - -// GetConnectionDetailsMapping for this Instance -func (tr *Instance) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Instance -func (tr *Instance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Instance -func (tr *Instance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Instance -func (tr *Instance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Instance -func (tr *Instance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Instance -func (tr *Instance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Instance -func (tr *Instance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Instance -func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Instance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { - params := &InstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Instance) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this JavaAppLayer -func (mg *JavaAppLayer) GetTerraformResourceType() string { - return "aws_opsworks_java_app_layer" -} - -// GetConnectionDetailsMapping for this JavaAppLayer -func (tr *JavaAppLayer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this JavaAppLayer -func (tr *JavaAppLayer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this JavaAppLayer -func (tr *JavaAppLayer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this JavaAppLayer -func (tr *JavaAppLayer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this JavaAppLayer -func (tr *JavaAppLayer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this JavaAppLayer -func (tr *JavaAppLayer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this JavaAppLayer -func (tr *JavaAppLayer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this JavaAppLayer -func (tr *JavaAppLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this JavaAppLayer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *JavaAppLayer) LateInitialize(attrs []byte) (bool, error) { - params := &JavaAppLayerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *JavaAppLayer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MemcachedLayer -func (mg *MemcachedLayer) GetTerraformResourceType() string { - return "aws_opsworks_memcached_layer" -} - -// GetConnectionDetailsMapping for this MemcachedLayer -func (tr *MemcachedLayer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MemcachedLayer -func (tr *MemcachedLayer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MemcachedLayer -func (tr *MemcachedLayer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MemcachedLayer -func (tr *MemcachedLayer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MemcachedLayer -func (tr *MemcachedLayer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MemcachedLayer -func (tr *MemcachedLayer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MemcachedLayer -func (tr *MemcachedLayer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MemcachedLayer -func (tr *MemcachedLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MemcachedLayer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MemcachedLayer) LateInitialize(attrs []byte) (bool, error) { - params := &MemcachedLayerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MemcachedLayer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MySQLLayer -func (mg *MySQLLayer) GetTerraformResourceType() string { - return "aws_opsworks_mysql_layer" -} - -// GetConnectionDetailsMapping for this MySQLLayer -func (tr *MySQLLayer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MySQLLayer -func (tr *MySQLLayer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MySQLLayer -func (tr *MySQLLayer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MySQLLayer -func (tr *MySQLLayer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MySQLLayer -func (tr *MySQLLayer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MySQLLayer -func (tr *MySQLLayer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MySQLLayer -func (tr *MySQLLayer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MySQLLayer -func (tr *MySQLLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MySQLLayer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MySQLLayer) LateInitialize(attrs []byte) (bool, error) { - params := &MySQLLayerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MySQLLayer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NodeJSAppLayer -func (mg *NodeJSAppLayer) GetTerraformResourceType() string { - return "aws_opsworks_nodejs_app_layer" -} - -// GetConnectionDetailsMapping for this NodeJSAppLayer -func (tr *NodeJSAppLayer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NodeJSAppLayer -func (tr *NodeJSAppLayer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NodeJSAppLayer -func (tr *NodeJSAppLayer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NodeJSAppLayer -func (tr *NodeJSAppLayer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NodeJSAppLayer -func (tr *NodeJSAppLayer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NodeJSAppLayer -func (tr *NodeJSAppLayer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NodeJSAppLayer -func (tr *NodeJSAppLayer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NodeJSAppLayer -func (tr *NodeJSAppLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NodeJSAppLayer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NodeJSAppLayer) LateInitialize(attrs []byte) (bool, error) { - params := &NodeJSAppLayerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NodeJSAppLayer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Permission -func (mg *Permission) GetTerraformResourceType() string { - return "aws_opsworks_permission" -} - -// GetConnectionDetailsMapping for this Permission -func (tr *Permission) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Permission -func (tr *Permission) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Permission -func (tr *Permission) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Permission -func (tr *Permission) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Permission -func (tr *Permission) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Permission -func (tr *Permission) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Permission -func (tr *Permission) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Permission -func (tr *Permission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Permission using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Permission) LateInitialize(attrs []byte) (bool, error) { - params := &PermissionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Permission) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PHPAppLayer -func (mg *PHPAppLayer) GetTerraformResourceType() string { - return "aws_opsworks_php_app_layer" -} - -// GetConnectionDetailsMapping for this PHPAppLayer -func (tr *PHPAppLayer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PHPAppLayer -func (tr *PHPAppLayer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PHPAppLayer -func (tr *PHPAppLayer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PHPAppLayer -func (tr *PHPAppLayer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PHPAppLayer -func (tr *PHPAppLayer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PHPAppLayer -func (tr *PHPAppLayer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PHPAppLayer -func (tr *PHPAppLayer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PHPAppLayer -func (tr *PHPAppLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PHPAppLayer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PHPAppLayer) LateInitialize(attrs []byte) (bool, error) { - params := &PHPAppLayerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PHPAppLayer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RailsAppLayer -func (mg *RailsAppLayer) GetTerraformResourceType() string { - return "aws_opsworks_rails_app_layer" -} - -// GetConnectionDetailsMapping for this RailsAppLayer -func (tr *RailsAppLayer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RailsAppLayer -func (tr *RailsAppLayer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RailsAppLayer -func (tr *RailsAppLayer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RailsAppLayer -func (tr *RailsAppLayer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RailsAppLayer -func (tr *RailsAppLayer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RailsAppLayer -func (tr *RailsAppLayer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RailsAppLayer -func (tr *RailsAppLayer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RailsAppLayer -func (tr *RailsAppLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RailsAppLayer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RailsAppLayer) LateInitialize(attrs []byte) (bool, error) { - params := &RailsAppLayerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RailsAppLayer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RDSDBInstance -func (mg *RDSDBInstance) GetTerraformResourceType() string { - return "aws_opsworks_rds_db_instance" -} - -// GetConnectionDetailsMapping for this RDSDBInstance -func (tr *RDSDBInstance) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"db_password": "spec.forProvider.dbPasswordSecretRef"} -} - -// GetObservation of this RDSDBInstance -func (tr *RDSDBInstance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RDSDBInstance -func (tr *RDSDBInstance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RDSDBInstance -func (tr *RDSDBInstance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RDSDBInstance -func (tr *RDSDBInstance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RDSDBInstance -func (tr *RDSDBInstance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RDSDBInstance -func (tr *RDSDBInstance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RDSDBInstance -func (tr *RDSDBInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RDSDBInstance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RDSDBInstance) LateInitialize(attrs []byte) (bool, error) { - params := &RDSDBInstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RDSDBInstance) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Stack -func (mg *Stack) GetTerraformResourceType() string { - return "aws_opsworks_stack" -} - -// GetConnectionDetailsMapping for this Stack -func (tr *Stack) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"custom_cookbooks_source[*].password": "spec.forProvider.customCookbooksSource[*].passwordSecretRef", "custom_cookbooks_source[*].ssh_key": "spec.forProvider.customCookbooksSource[*].sshKeySecretRef"} -} - -// GetObservation of this Stack -func (tr *Stack) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Stack -func (tr *Stack) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Stack -func (tr *Stack) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Stack -func (tr *Stack) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Stack -func (tr *Stack) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Stack -func (tr *Stack) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Stack -func (tr *Stack) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Stack using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Stack) LateInitialize(attrs []byte) (bool, error) { - params := &StackParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Stack) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this StaticWebLayer -func (mg *StaticWebLayer) GetTerraformResourceType() string { - return "aws_opsworks_static_web_layer" -} - -// GetConnectionDetailsMapping for this StaticWebLayer -func (tr *StaticWebLayer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this StaticWebLayer -func (tr *StaticWebLayer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this StaticWebLayer -func (tr *StaticWebLayer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this StaticWebLayer -func (tr *StaticWebLayer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this StaticWebLayer -func (tr *StaticWebLayer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this StaticWebLayer -func (tr *StaticWebLayer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this StaticWebLayer -func (tr *StaticWebLayer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this StaticWebLayer -func (tr *StaticWebLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this StaticWebLayer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *StaticWebLayer) LateInitialize(attrs []byte) (bool, error) { - params := &StaticWebLayerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *StaticWebLayer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserProfile -func (mg *UserProfile) GetTerraformResourceType() string { - return "aws_opsworks_user_profile" -} - -// GetConnectionDetailsMapping for this UserProfile -func (tr *UserProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserProfile -func (tr *UserProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserProfile -func (tr *UserProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserProfile -func (tr *UserProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserProfile -func (tr *UserProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserProfile -func (tr *UserProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserProfile -func (tr *UserProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserProfile -func (tr *UserProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserProfile) LateInitialize(attrs []byte) (bool, error) { - params := &UserProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserProfile) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/opsworks/v1beta1/zz_haproxylayer_terraformed.go b/apis/opsworks/v1beta1/zz_haproxylayer_terraformed.go new file mode 100755 index 0000000000..262f30d788 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_haproxylayer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HAProxyLayer +func (mg *HAProxyLayer) GetTerraformResourceType() string { + return "aws_opsworks_haproxy_layer" +} + +// GetConnectionDetailsMapping for this HAProxyLayer +func (tr *HAProxyLayer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HAProxyLayer +func (tr *HAProxyLayer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HAProxyLayer +func (tr *HAProxyLayer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HAProxyLayer +func (tr *HAProxyLayer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HAProxyLayer +func (tr *HAProxyLayer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HAProxyLayer +func (tr *HAProxyLayer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HAProxyLayer +func (tr *HAProxyLayer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HAProxyLayer +func (tr *HAProxyLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HAProxyLayer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HAProxyLayer) LateInitialize(attrs []byte) (bool, error) { + params := &HAProxyLayerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HAProxyLayer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_haproxylayer_types.go b/apis/opsworks/v1beta1/zz_haproxylayer_types.go index 714ffb9699..3d9e9cc293 100755 --- a/apis/opsworks/v1beta1/zz_haproxylayer_types.go +++ b/apis/opsworks/v1beta1/zz_haproxylayer_types.go @@ -702,13 +702,14 @@ type HAProxyLayerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HAProxyLayer is the Schema for the HAProxyLayers API. Provides an OpsWorks HAProxy layer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HAProxyLayer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_instance_terraformed.go b/apis/opsworks/v1beta1/zz_instance_terraformed.go new file mode 100755 index 0000000000..3da2ef88de --- /dev/null +++ b/apis/opsworks/v1beta1/zz_instance_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Instance +func (mg *Instance) GetTerraformResourceType() string { + return "aws_opsworks_instance" +} + +// GetConnectionDetailsMapping for this Instance +func (tr *Instance) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Instance +func (tr *Instance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Instance +func (tr *Instance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Instance +func (tr *Instance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Instance +func (tr *Instance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Instance +func (tr *Instance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Instance +func (tr *Instance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Instance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { + params := &InstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Instance) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_instance_types.go b/apis/opsworks/v1beta1/zz_instance_types.go index 1b6b68fb10..21a675b2c1 100755 --- a/apis/opsworks/v1beta1/zz_instance_types.go +++ b/apis/opsworks/v1beta1/zz_instance_types.go @@ -623,13 +623,14 @@ type InstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Instance is the Schema for the Instances API. Provides an OpsWorks instance resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Instance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_javaapplayer_terraformed.go b/apis/opsworks/v1beta1/zz_javaapplayer_terraformed.go new file mode 100755 index 0000000000..ac566f06c9 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_javaapplayer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this JavaAppLayer +func (mg *JavaAppLayer) GetTerraformResourceType() string { + return "aws_opsworks_java_app_layer" +} + +// GetConnectionDetailsMapping for this JavaAppLayer +func (tr *JavaAppLayer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this JavaAppLayer +func (tr *JavaAppLayer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this JavaAppLayer +func (tr *JavaAppLayer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this JavaAppLayer +func (tr *JavaAppLayer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this JavaAppLayer +func (tr *JavaAppLayer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this JavaAppLayer +func (tr *JavaAppLayer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this JavaAppLayer +func (tr *JavaAppLayer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this JavaAppLayer +func (tr *JavaAppLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this JavaAppLayer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *JavaAppLayer) LateInitialize(attrs []byte) (bool, error) { + params := &JavaAppLayerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *JavaAppLayer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_javaapplayer_types.go b/apis/opsworks/v1beta1/zz_javaapplayer_types.go index 6c2c731957..0795fce5f5 100755 --- a/apis/opsworks/v1beta1/zz_javaapplayer_types.go +++ b/apis/opsworks/v1beta1/zz_javaapplayer_types.go @@ -692,13 +692,14 @@ type JavaAppLayerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // JavaAppLayer is the Schema for the JavaAppLayers API. Provides an OpsWorks Java application layer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type JavaAppLayer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_memcachedlayer_terraformed.go b/apis/opsworks/v1beta1/zz_memcachedlayer_terraformed.go new file mode 100755 index 0000000000..f9ab2374b8 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_memcachedlayer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MemcachedLayer +func (mg *MemcachedLayer) GetTerraformResourceType() string { + return "aws_opsworks_memcached_layer" +} + +// GetConnectionDetailsMapping for this MemcachedLayer +func (tr *MemcachedLayer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MemcachedLayer +func (tr *MemcachedLayer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MemcachedLayer +func (tr *MemcachedLayer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MemcachedLayer +func (tr *MemcachedLayer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MemcachedLayer +func (tr *MemcachedLayer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MemcachedLayer +func (tr *MemcachedLayer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MemcachedLayer +func (tr *MemcachedLayer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MemcachedLayer +func (tr *MemcachedLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MemcachedLayer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MemcachedLayer) LateInitialize(attrs []byte) (bool, error) { + params := &MemcachedLayerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MemcachedLayer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_memcachedlayer_types.go b/apis/opsworks/v1beta1/zz_memcachedlayer_types.go index 0cef48ae72..4acb8c8f93 100755 --- a/apis/opsworks/v1beta1/zz_memcachedlayer_types.go +++ b/apis/opsworks/v1beta1/zz_memcachedlayer_types.go @@ -652,13 +652,14 @@ type MemcachedLayerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MemcachedLayer is the Schema for the MemcachedLayers API. Provides an OpsWorks memcached layer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MemcachedLayer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_mysqllayer_terraformed.go b/apis/opsworks/v1beta1/zz_mysqllayer_terraformed.go new file mode 100755 index 0000000000..c9da774c2d --- /dev/null +++ b/apis/opsworks/v1beta1/zz_mysqllayer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MySQLLayer +func (mg *MySQLLayer) GetTerraformResourceType() string { + return "aws_opsworks_mysql_layer" +} + +// GetConnectionDetailsMapping for this MySQLLayer +func (tr *MySQLLayer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MySQLLayer +func (tr *MySQLLayer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MySQLLayer +func (tr *MySQLLayer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MySQLLayer +func (tr *MySQLLayer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MySQLLayer +func (tr *MySQLLayer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MySQLLayer +func (tr *MySQLLayer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MySQLLayer +func (tr *MySQLLayer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MySQLLayer +func (tr *MySQLLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MySQLLayer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MySQLLayer) LateInitialize(attrs []byte) (bool, error) { + params := &MySQLLayerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MySQLLayer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_mysqllayer_types.go b/apis/opsworks/v1beta1/zz_mysqllayer_types.go index a038b8f884..b951d8ac0f 100755 --- a/apis/opsworks/v1beta1/zz_mysqllayer_types.go +++ b/apis/opsworks/v1beta1/zz_mysqllayer_types.go @@ -662,13 +662,14 @@ type MySQLLayerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MySQLLayer is the Schema for the MySQLLayers API. Provides an OpsWorks MySQL layer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MySQLLayer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_nodejsapplayer_terraformed.go b/apis/opsworks/v1beta1/zz_nodejsapplayer_terraformed.go new file mode 100755 index 0000000000..0f6273abd6 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_nodejsapplayer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NodeJSAppLayer +func (mg *NodeJSAppLayer) GetTerraformResourceType() string { + return "aws_opsworks_nodejs_app_layer" +} + +// GetConnectionDetailsMapping for this NodeJSAppLayer +func (tr *NodeJSAppLayer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NodeJSAppLayer +func (tr *NodeJSAppLayer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NodeJSAppLayer +func (tr *NodeJSAppLayer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NodeJSAppLayer +func (tr *NodeJSAppLayer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NodeJSAppLayer +func (tr *NodeJSAppLayer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NodeJSAppLayer +func (tr *NodeJSAppLayer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NodeJSAppLayer +func (tr *NodeJSAppLayer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NodeJSAppLayer +func (tr *NodeJSAppLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NodeJSAppLayer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NodeJSAppLayer) LateInitialize(attrs []byte) (bool, error) { + params := &NodeJSAppLayerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NodeJSAppLayer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_nodejsapplayer_types.go b/apis/opsworks/v1beta1/zz_nodejsapplayer_types.go index 6a2989c032..ce52e8f4d3 100755 --- a/apis/opsworks/v1beta1/zz_nodejsapplayer_types.go +++ b/apis/opsworks/v1beta1/zz_nodejsapplayer_types.go @@ -652,13 +652,14 @@ type NodeJSAppLayerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NodeJSAppLayer is the Schema for the NodeJSAppLayers API. Provides an OpsWorks NodeJS application layer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NodeJSAppLayer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_permission_terraformed.go b/apis/opsworks/v1beta1/zz_permission_terraformed.go new file mode 100755 index 0000000000..fcac8ca8f7 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_permission_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Permission +func (mg *Permission) GetTerraformResourceType() string { + return "aws_opsworks_permission" +} + +// GetConnectionDetailsMapping for this Permission +func (tr *Permission) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Permission +func (tr *Permission) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Permission +func (tr *Permission) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Permission +func (tr *Permission) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Permission +func (tr *Permission) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Permission +func (tr *Permission) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Permission +func (tr *Permission) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Permission +func (tr *Permission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Permission using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Permission) LateInitialize(attrs []byte) (bool, error) { + params := &PermissionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Permission) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_permission_types.go b/apis/opsworks/v1beta1/zz_permission_types.go index 379cb3ff10..67b334fa48 100755 --- a/apis/opsworks/v1beta1/zz_permission_types.go +++ b/apis/opsworks/v1beta1/zz_permission_types.go @@ -143,13 +143,14 @@ type PermissionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Permission is the Schema for the Permissions API. Provides an OpsWorks permission resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Permission struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_phpapplayer_terraformed.go b/apis/opsworks/v1beta1/zz_phpapplayer_terraformed.go new file mode 100755 index 0000000000..2f1c6bebca --- /dev/null +++ b/apis/opsworks/v1beta1/zz_phpapplayer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PHPAppLayer +func (mg *PHPAppLayer) GetTerraformResourceType() string { + return "aws_opsworks_php_app_layer" +} + +// GetConnectionDetailsMapping for this PHPAppLayer +func (tr *PHPAppLayer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PHPAppLayer +func (tr *PHPAppLayer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PHPAppLayer +func (tr *PHPAppLayer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PHPAppLayer +func (tr *PHPAppLayer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PHPAppLayer +func (tr *PHPAppLayer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PHPAppLayer +func (tr *PHPAppLayer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PHPAppLayer +func (tr *PHPAppLayer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PHPAppLayer +func (tr *PHPAppLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PHPAppLayer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PHPAppLayer) LateInitialize(attrs []byte) (bool, error) { + params := &PHPAppLayerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PHPAppLayer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_phpapplayer_types.go b/apis/opsworks/v1beta1/zz_phpapplayer_types.go index 780f5eed4f..70f1802010 100755 --- a/apis/opsworks/v1beta1/zz_phpapplayer_types.go +++ b/apis/opsworks/v1beta1/zz_phpapplayer_types.go @@ -642,13 +642,14 @@ type PHPAppLayerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PHPAppLayer is the Schema for the PHPAppLayers API. Provides an OpsWorks PHP application layer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PHPAppLayer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_railsapplayer_terraformed.go b/apis/opsworks/v1beta1/zz_railsapplayer_terraformed.go new file mode 100755 index 0000000000..5f5252bd00 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_railsapplayer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RailsAppLayer +func (mg *RailsAppLayer) GetTerraformResourceType() string { + return "aws_opsworks_rails_app_layer" +} + +// GetConnectionDetailsMapping for this RailsAppLayer +func (tr *RailsAppLayer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RailsAppLayer +func (tr *RailsAppLayer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RailsAppLayer +func (tr *RailsAppLayer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RailsAppLayer +func (tr *RailsAppLayer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RailsAppLayer +func (tr *RailsAppLayer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RailsAppLayer +func (tr *RailsAppLayer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RailsAppLayer +func (tr *RailsAppLayer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RailsAppLayer +func (tr *RailsAppLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RailsAppLayer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RailsAppLayer) LateInitialize(attrs []byte) (bool, error) { + params := &RailsAppLayerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RailsAppLayer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_railsapplayer_types.go b/apis/opsworks/v1beta1/zz_railsapplayer_types.go index ca5740702a..f8b48529b3 100755 --- a/apis/opsworks/v1beta1/zz_railsapplayer_types.go +++ b/apis/opsworks/v1beta1/zz_railsapplayer_types.go @@ -702,13 +702,14 @@ type RailsAppLayerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RailsAppLayer is the Schema for the RailsAppLayers API. Provides an OpsWorks Ruby on Rails application layer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RailsAppLayer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_rdsdbinstance_terraformed.go b/apis/opsworks/v1beta1/zz_rdsdbinstance_terraformed.go new file mode 100755 index 0000000000..95354ad922 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_rdsdbinstance_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RDSDBInstance +func (mg *RDSDBInstance) GetTerraformResourceType() string { + return "aws_opsworks_rds_db_instance" +} + +// GetConnectionDetailsMapping for this RDSDBInstance +func (tr *RDSDBInstance) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"db_password": "spec.forProvider.dbPasswordSecretRef"} +} + +// GetObservation of this RDSDBInstance +func (tr *RDSDBInstance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RDSDBInstance +func (tr *RDSDBInstance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RDSDBInstance +func (tr *RDSDBInstance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RDSDBInstance +func (tr *RDSDBInstance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RDSDBInstance +func (tr *RDSDBInstance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RDSDBInstance +func (tr *RDSDBInstance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RDSDBInstance +func (tr *RDSDBInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RDSDBInstance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RDSDBInstance) LateInitialize(attrs []byte) (bool, error) { + params := &RDSDBInstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RDSDBInstance) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_rdsdbinstance_types.go b/apis/opsworks/v1beta1/zz_rdsdbinstance_types.go index 4c80edbc68..406fb5eed2 100755 --- a/apis/opsworks/v1beta1/zz_rdsdbinstance_types.go +++ b/apis/opsworks/v1beta1/zz_rdsdbinstance_types.go @@ -127,13 +127,14 @@ type RDSDBInstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RDSDBInstance is the Schema for the RDSDBInstances API. Provides an OpsWorks RDS DB Instance resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RDSDBInstance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_stack_terraformed.go b/apis/opsworks/v1beta1/zz_stack_terraformed.go new file mode 100755 index 0000000000..c7bbbd5079 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_stack_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Stack +func (mg *Stack) GetTerraformResourceType() string { + return "aws_opsworks_stack" +} + +// GetConnectionDetailsMapping for this Stack +func (tr *Stack) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"custom_cookbooks_source[*].password": "spec.forProvider.customCookbooksSource[*].passwordSecretRef", "custom_cookbooks_source[*].ssh_key": "spec.forProvider.customCookbooksSource[*].sshKeySecretRef"} +} + +// GetObservation of this Stack +func (tr *Stack) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Stack +func (tr *Stack) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Stack +func (tr *Stack) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Stack +func (tr *Stack) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Stack +func (tr *Stack) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Stack +func (tr *Stack) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Stack +func (tr *Stack) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Stack using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Stack) LateInitialize(attrs []byte) (bool, error) { + params := &StackParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Stack) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_stack_types.go b/apis/opsworks/v1beta1/zz_stack_types.go index 34dd722fa0..74b1d99c05 100755 --- a/apis/opsworks/v1beta1/zz_stack_types.go +++ b/apis/opsworks/v1beta1/zz_stack_types.go @@ -423,13 +423,14 @@ type StackStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Stack is the Schema for the Stacks API. Provides an OpsWorks stack resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Stack struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_staticweblayer_terraformed.go b/apis/opsworks/v1beta1/zz_staticweblayer_terraformed.go new file mode 100755 index 0000000000..ebfcf6badd --- /dev/null +++ b/apis/opsworks/v1beta1/zz_staticweblayer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this StaticWebLayer +func (mg *StaticWebLayer) GetTerraformResourceType() string { + return "aws_opsworks_static_web_layer" +} + +// GetConnectionDetailsMapping for this StaticWebLayer +func (tr *StaticWebLayer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this StaticWebLayer +func (tr *StaticWebLayer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this StaticWebLayer +func (tr *StaticWebLayer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this StaticWebLayer +func (tr *StaticWebLayer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this StaticWebLayer +func (tr *StaticWebLayer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this StaticWebLayer +func (tr *StaticWebLayer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this StaticWebLayer +func (tr *StaticWebLayer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this StaticWebLayer +func (tr *StaticWebLayer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this StaticWebLayer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *StaticWebLayer) LateInitialize(attrs []byte) (bool, error) { + params := &StaticWebLayerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *StaticWebLayer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_staticweblayer_types.go b/apis/opsworks/v1beta1/zz_staticweblayer_types.go index 3d7f603931..b74f5d5d8b 100755 --- a/apis/opsworks/v1beta1/zz_staticweblayer_types.go +++ b/apis/opsworks/v1beta1/zz_staticweblayer_types.go @@ -639,13 +639,14 @@ type StaticWebLayerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // StaticWebLayer is the Schema for the StaticWebLayers API. Provides an OpsWorks static web server layer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type StaticWebLayer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/opsworks/v1beta1/zz_userprofile_terraformed.go b/apis/opsworks/v1beta1/zz_userprofile_terraformed.go new file mode 100755 index 0000000000..22d8d59b77 --- /dev/null +++ b/apis/opsworks/v1beta1/zz_userprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserProfile +func (mg *UserProfile) GetTerraformResourceType() string { + return "aws_opsworks_user_profile" +} + +// GetConnectionDetailsMapping for this UserProfile +func (tr *UserProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserProfile +func (tr *UserProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserProfile +func (tr *UserProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserProfile +func (tr *UserProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserProfile +func (tr *UserProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserProfile +func (tr *UserProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserProfile +func (tr *UserProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserProfile +func (tr *UserProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserProfile) LateInitialize(attrs []byte) (bool, error) { + params := &UserProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/opsworks/v1beta1/zz_userprofile_types.go b/apis/opsworks/v1beta1/zz_userprofile_types.go index c21da7789a..482d117d02 100755 --- a/apis/opsworks/v1beta1/zz_userprofile_types.go +++ b/apis/opsworks/v1beta1/zz_userprofile_types.go @@ -113,13 +113,14 @@ type UserProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserProfile is the Schema for the UserProfiles API. Provides an OpsWorks User Profile resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/organizations/v1beta1/zz_account_terraformed.go b/apis/organizations/v1beta1/zz_account_terraformed.go new file mode 100755 index 0000000000..acedbca87f --- /dev/null +++ b/apis/organizations/v1beta1/zz_account_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Account +func (mg *Account) GetTerraformResourceType() string { + return "aws_organizations_account" +} + +// GetConnectionDetailsMapping for this Account +func (tr *Account) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Account +func (tr *Account) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Account +func (tr *Account) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Account +func (tr *Account) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Account +func (tr *Account) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Account +func (tr *Account) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Account +func (tr *Account) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Account +func (tr *Account) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Account using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Account) LateInitialize(attrs []byte) (bool, error) { + params := &AccountParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Account) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/organizations/v1beta1/zz_account_types.go b/apis/organizations/v1beta1/zz_account_types.go index d2a3bfd213..99bf44b9b1 100755 --- a/apis/organizations/v1beta1/zz_account_types.go +++ b/apis/organizations/v1beta1/zz_account_types.go @@ -147,13 +147,14 @@ type AccountStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Account is the Schema for the Accounts API. Provides a resource to create a member account in the current AWS Organization. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Account struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/organizations/v1beta1/zz_delegatedadministrator_terraformed.go b/apis/organizations/v1beta1/zz_delegatedadministrator_terraformed.go new file mode 100755 index 0000000000..fdd7994c78 --- /dev/null +++ b/apis/organizations/v1beta1/zz_delegatedadministrator_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DelegatedAdministrator +func (mg *DelegatedAdministrator) GetTerraformResourceType() string { + return "aws_organizations_delegated_administrator" +} + +// GetConnectionDetailsMapping for this DelegatedAdministrator +func (tr *DelegatedAdministrator) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DelegatedAdministrator +func (tr *DelegatedAdministrator) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DelegatedAdministrator +func (tr *DelegatedAdministrator) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DelegatedAdministrator +func (tr *DelegatedAdministrator) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DelegatedAdministrator +func (tr *DelegatedAdministrator) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DelegatedAdministrator +func (tr *DelegatedAdministrator) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DelegatedAdministrator +func (tr *DelegatedAdministrator) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DelegatedAdministrator +func (tr *DelegatedAdministrator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DelegatedAdministrator using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DelegatedAdministrator) LateInitialize(attrs []byte) (bool, error) { + params := &DelegatedAdministratorParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DelegatedAdministrator) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/organizations/v1beta1/zz_delegatedadministrator_types.go b/apis/organizations/v1beta1/zz_delegatedadministrator_types.go index 4c11c77d51..4390417842 100755 --- a/apis/organizations/v1beta1/zz_delegatedadministrator_types.go +++ b/apis/organizations/v1beta1/zz_delegatedadministrator_types.go @@ -117,13 +117,14 @@ type DelegatedAdministratorStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DelegatedAdministrator is the Schema for the DelegatedAdministrators API. Provides a resource to manage an AWS Organizations Delegated Administrator. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DelegatedAdministrator struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/organizations/v1beta1/zz_generated.conversion_hubs.go b/apis/organizations/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..479619ad92 --- /dev/null +++ b/apis/organizations/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Account) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DelegatedAdministrator) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Organization) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *OrganizationalUnit) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Policy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PolicyAttachment) Hub() {} diff --git a/apis/organizations/v1beta1/zz_generated_terraformed.go b/apis/organizations/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index af6a706a23..0000000000 --- a/apis/organizations/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,703 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Account -func (mg *Account) GetTerraformResourceType() string { - return "aws_organizations_account" -} - -// GetConnectionDetailsMapping for this Account -func (tr *Account) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Account -func (tr *Account) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Account -func (tr *Account) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Account -func (tr *Account) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Account -func (tr *Account) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Account -func (tr *Account) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Account -func (tr *Account) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Account -func (tr *Account) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Account using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Account) LateInitialize(attrs []byte) (bool, error) { - params := &AccountParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Account) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DelegatedAdministrator -func (mg *DelegatedAdministrator) GetTerraformResourceType() string { - return "aws_organizations_delegated_administrator" -} - -// GetConnectionDetailsMapping for this DelegatedAdministrator -func (tr *DelegatedAdministrator) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DelegatedAdministrator -func (tr *DelegatedAdministrator) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DelegatedAdministrator -func (tr *DelegatedAdministrator) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DelegatedAdministrator -func (tr *DelegatedAdministrator) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DelegatedAdministrator -func (tr *DelegatedAdministrator) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DelegatedAdministrator -func (tr *DelegatedAdministrator) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DelegatedAdministrator -func (tr *DelegatedAdministrator) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DelegatedAdministrator -func (tr *DelegatedAdministrator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DelegatedAdministrator using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DelegatedAdministrator) LateInitialize(attrs []byte) (bool, error) { - params := &DelegatedAdministratorParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DelegatedAdministrator) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Organization -func (mg *Organization) GetTerraformResourceType() string { - return "aws_organizations_organization" -} - -// GetConnectionDetailsMapping for this Organization -func (tr *Organization) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Organization -func (tr *Organization) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Organization -func (tr *Organization) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Organization -func (tr *Organization) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Organization -func (tr *Organization) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Organization -func (tr *Organization) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Organization -func (tr *Organization) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Organization -func (tr *Organization) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Organization using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Organization) LateInitialize(attrs []byte) (bool, error) { - params := &OrganizationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Organization) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this OrganizationalUnit -func (mg *OrganizationalUnit) GetTerraformResourceType() string { - return "aws_organizations_organizational_unit" -} - -// GetConnectionDetailsMapping for this OrganizationalUnit -func (tr *OrganizationalUnit) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this OrganizationalUnit -func (tr *OrganizationalUnit) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this OrganizationalUnit -func (tr *OrganizationalUnit) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this OrganizationalUnit -func (tr *OrganizationalUnit) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this OrganizationalUnit -func (tr *OrganizationalUnit) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this OrganizationalUnit -func (tr *OrganizationalUnit) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this OrganizationalUnit -func (tr *OrganizationalUnit) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this OrganizationalUnit -func (tr *OrganizationalUnit) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this OrganizationalUnit using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *OrganizationalUnit) LateInitialize(attrs []byte) (bool, error) { - params := &OrganizationalUnitParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *OrganizationalUnit) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Policy -func (mg *Policy) GetTerraformResourceType() string { - return "aws_organizations_policy" -} - -// GetConnectionDetailsMapping for this Policy -func (tr *Policy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Policy -func (tr *Policy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Policy -func (tr *Policy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Policy -func (tr *Policy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Policy -func (tr *Policy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Policy -func (tr *Policy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Policy -func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Policy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { - params := &PolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Policy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PolicyAttachment -func (mg *PolicyAttachment) GetTerraformResourceType() string { - return "aws_organizations_policy_attachment" -} - -// GetConnectionDetailsMapping for this PolicyAttachment -func (tr *PolicyAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PolicyAttachment -func (tr *PolicyAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PolicyAttachment -func (tr *PolicyAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PolicyAttachment -func (tr *PolicyAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PolicyAttachment -func (tr *PolicyAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PolicyAttachment -func (tr *PolicyAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PolicyAttachment -func (tr *PolicyAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PolicyAttachment -func (tr *PolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PolicyAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PolicyAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &PolicyAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PolicyAttachment) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/organizations/v1beta1/zz_organization_terraformed.go b/apis/organizations/v1beta1/zz_organization_terraformed.go new file mode 100755 index 0000000000..9432986248 --- /dev/null +++ b/apis/organizations/v1beta1/zz_organization_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Organization +func (mg *Organization) GetTerraformResourceType() string { + return "aws_organizations_organization" +} + +// GetConnectionDetailsMapping for this Organization +func (tr *Organization) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Organization +func (tr *Organization) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Organization +func (tr *Organization) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Organization +func (tr *Organization) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Organization +func (tr *Organization) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Organization +func (tr *Organization) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Organization +func (tr *Organization) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Organization +func (tr *Organization) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Organization using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Organization) LateInitialize(attrs []byte) (bool, error) { + params := &OrganizationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Organization) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/organizations/v1beta1/zz_organization_types.go b/apis/organizations/v1beta1/zz_organization_types.go index 8759b20331..9ab98879e5 100755 --- a/apis/organizations/v1beta1/zz_organization_types.go +++ b/apis/organizations/v1beta1/zz_organization_types.go @@ -198,13 +198,14 @@ type OrganizationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Organization is the Schema for the Organizations API. Provides a resource to create an organization. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Organization struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/organizations/v1beta1/zz_organizationalunit_terraformed.go b/apis/organizations/v1beta1/zz_organizationalunit_terraformed.go new file mode 100755 index 0000000000..5d0df34dc5 --- /dev/null +++ b/apis/organizations/v1beta1/zz_organizationalunit_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this OrganizationalUnit +func (mg *OrganizationalUnit) GetTerraformResourceType() string { + return "aws_organizations_organizational_unit" +} + +// GetConnectionDetailsMapping for this OrganizationalUnit +func (tr *OrganizationalUnit) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this OrganizationalUnit +func (tr *OrganizationalUnit) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this OrganizationalUnit +func (tr *OrganizationalUnit) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this OrganizationalUnit +func (tr *OrganizationalUnit) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this OrganizationalUnit +func (tr *OrganizationalUnit) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this OrganizationalUnit +func (tr *OrganizationalUnit) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this OrganizationalUnit +func (tr *OrganizationalUnit) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this OrganizationalUnit +func (tr *OrganizationalUnit) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this OrganizationalUnit using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *OrganizationalUnit) LateInitialize(attrs []byte) (bool, error) { + params := &OrganizationalUnitParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *OrganizationalUnit) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/organizations/v1beta1/zz_organizationalunit_types.go b/apis/organizations/v1beta1/zz_organizationalunit_types.go index 74b0a76e96..ba38768631 100755 --- a/apis/organizations/v1beta1/zz_organizationalunit_types.go +++ b/apis/organizations/v1beta1/zz_organizationalunit_types.go @@ -122,13 +122,14 @@ type OrganizationalUnitStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // OrganizationalUnit is the Schema for the OrganizationalUnits API. Provides a resource to create an organizational unit. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type OrganizationalUnit struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/organizations/v1beta1/zz_policy_terraformed.go b/apis/organizations/v1beta1/zz_policy_terraformed.go new file mode 100755 index 0000000000..5e110ad9fb --- /dev/null +++ b/apis/organizations/v1beta1/zz_policy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Policy +func (mg *Policy) GetTerraformResourceType() string { + return "aws_organizations_policy" +} + +// GetConnectionDetailsMapping for this Policy +func (tr *Policy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Policy +func (tr *Policy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Policy +func (tr *Policy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Policy +func (tr *Policy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Policy +func (tr *Policy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Policy +func (tr *Policy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Policy +func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Policy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { + params := &PolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Policy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/organizations/v1beta1/zz_policy_types.go b/apis/organizations/v1beta1/zz_policy_types.go index f653886151..47be453bbe 100755 --- a/apis/organizations/v1beta1/zz_policy_types.go +++ b/apis/organizations/v1beta1/zz_policy_types.go @@ -128,13 +128,14 @@ type PolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Policy is the Schema for the Policys API. Provides a resource to manage an AWS Organizations policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Policy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/organizations/v1beta1/zz_policyattachment_terraformed.go b/apis/organizations/v1beta1/zz_policyattachment_terraformed.go new file mode 100755 index 0000000000..e83b07c511 --- /dev/null +++ b/apis/organizations/v1beta1/zz_policyattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PolicyAttachment +func (mg *PolicyAttachment) GetTerraformResourceType() string { + return "aws_organizations_policy_attachment" +} + +// GetConnectionDetailsMapping for this PolicyAttachment +func (tr *PolicyAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PolicyAttachment +func (tr *PolicyAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PolicyAttachment +func (tr *PolicyAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PolicyAttachment +func (tr *PolicyAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PolicyAttachment +func (tr *PolicyAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PolicyAttachment +func (tr *PolicyAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PolicyAttachment +func (tr *PolicyAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PolicyAttachment +func (tr *PolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PolicyAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PolicyAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &PolicyAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PolicyAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/organizations/v1beta1/zz_policyattachment_types.go b/apis/organizations/v1beta1/zz_policyattachment_types.go index 762964092c..30c168869c 100755 --- a/apis/organizations/v1beta1/zz_policyattachment_types.go +++ b/apis/organizations/v1beta1/zz_policyattachment_types.go @@ -106,13 +106,14 @@ type PolicyAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PolicyAttachment is the Schema for the PolicyAttachments API. Provides a resource to attach an AWS Organizations policy to an organization account, root, or unit. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PolicyAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/pinpoint/v1beta1/zz_app_terraformed.go b/apis/pinpoint/v1beta1/zz_app_terraformed.go new file mode 100755 index 0000000000..0d941f28e0 --- /dev/null +++ b/apis/pinpoint/v1beta1/zz_app_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this App +func (mg *App) GetTerraformResourceType() string { + return "aws_pinpoint_app" +} + +// GetConnectionDetailsMapping for this App +func (tr *App) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this App +func (tr *App) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this App +func (tr *App) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this App +func (tr *App) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this App +func (tr *App) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this App +func (tr *App) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this App +func (tr *App) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this App +func (tr *App) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this App using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *App) LateInitialize(attrs []byte) (bool, error) { + params := &AppParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *App) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/pinpoint/v1beta1/zz_app_types.go b/apis/pinpoint/v1beta1/zz_app_types.go index 9cd250ece3..69c0fc964a 100755 --- a/apis/pinpoint/v1beta1/zz_app_types.go +++ b/apis/pinpoint/v1beta1/zz_app_types.go @@ -237,13 +237,14 @@ type AppStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // App is the Schema for the Apps API. Provides a Pinpoint App resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type App struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/pinpoint/v1beta1/zz_generated.conversion_hubs.go b/apis/pinpoint/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b2ab34f545 --- /dev/null +++ b/apis/pinpoint/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *App) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SMSChannel) Hub() {} diff --git a/apis/pinpoint/v1beta1/zz_generated_terraformed.go b/apis/pinpoint/v1beta1/zz_smschannel_terraformed.go similarity index 53% rename from apis/pinpoint/v1beta1/zz_generated_terraformed.go rename to apis/pinpoint/v1beta1/zz_smschannel_terraformed.go index 42925f43c7..b9a057b0c2 100755 --- a/apis/pinpoint/v1beta1/zz_generated_terraformed.go +++ b/apis/pinpoint/v1beta1/zz_smschannel_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this App -func (mg *App) GetTerraformResourceType() string { - return "aws_pinpoint_app" -} - -// GetConnectionDetailsMapping for this App -func (tr *App) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this App -func (tr *App) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this App -func (tr *App) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this App -func (tr *App) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this App -func (tr *App) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this App -func (tr *App) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this App -func (tr *App) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this App -func (tr *App) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this App using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *App) LateInitialize(attrs []byte) (bool, error) { - params := &AppParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *App) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this SMSChannel func (mg *SMSChannel) GetTerraformResourceType() string { return "aws_pinpoint_sms_channel" diff --git a/apis/pinpoint/v1beta1/zz_smschannel_types.go b/apis/pinpoint/v1beta1/zz_smschannel_types.go index c707469bc1..f3737b16c1 100755 --- a/apis/pinpoint/v1beta1/zz_smschannel_types.go +++ b/apis/pinpoint/v1beta1/zz_smschannel_types.go @@ -123,13 +123,14 @@ type SMSChannelStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SMSChannel is the Schema for the SMSChannels API. Provides a Pinpoint SMS Channel resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SMSChannel struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/qldb/v1beta1/zz_generated.conversion_hubs.go b/apis/qldb/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..17f0a9d8e5 --- /dev/null +++ b/apis/qldb/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Ledger) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Stream) Hub() {} diff --git a/apis/qldb/v1beta1/zz_generated_terraformed.go b/apis/qldb/v1beta1/zz_ledger_terraformed.go similarity index 52% rename from apis/qldb/v1beta1/zz_generated_terraformed.go rename to apis/qldb/v1beta1/zz_ledger_terraformed.go index 353a1f737e..449c4f54b0 100755 --- a/apis/qldb/v1beta1/zz_generated_terraformed.go +++ b/apis/qldb/v1beta1/zz_ledger_terraformed.go @@ -131,117 +131,3 @@ func (tr *Ledger) LateInitialize(attrs []byte) (bool, error) { func (tr *Ledger) GetTerraformSchemaVersion() int { return 0 } - -// GetTerraformResourceType returns Terraform resource type for this Stream -func (mg *Stream) GetTerraformResourceType() string { - return "aws_qldb_stream" -} - -// GetConnectionDetailsMapping for this Stream -func (tr *Stream) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Stream -func (tr *Stream) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Stream -func (tr *Stream) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Stream -func (tr *Stream) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Stream -func (tr *Stream) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Stream -func (tr *Stream) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Stream -func (tr *Stream) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Stream -func (tr *Stream) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Stream using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Stream) LateInitialize(attrs []byte) (bool, error) { - params := &StreamParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Stream) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/qldb/v1beta1/zz_ledger_types.go b/apis/qldb/v1beta1/zz_ledger_types.go index 36e5e4225e..5ba02397a1 100755 --- a/apis/qldb/v1beta1/zz_ledger_types.go +++ b/apis/qldb/v1beta1/zz_ledger_types.go @@ -126,13 +126,14 @@ type LedgerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Ledger is the Schema for the Ledgers API. Provides an QLDB Resource resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Ledger struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/qldb/v1beta1/zz_stream_terraformed.go b/apis/qldb/v1beta1/zz_stream_terraformed.go new file mode 100755 index 0000000000..38afd761d8 --- /dev/null +++ b/apis/qldb/v1beta1/zz_stream_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Stream +func (mg *Stream) GetTerraformResourceType() string { + return "aws_qldb_stream" +} + +// GetConnectionDetailsMapping for this Stream +func (tr *Stream) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Stream +func (tr *Stream) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Stream +func (tr *Stream) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Stream +func (tr *Stream) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Stream +func (tr *Stream) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Stream +func (tr *Stream) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Stream +func (tr *Stream) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Stream +func (tr *Stream) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Stream using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Stream) LateInitialize(attrs []byte) (bool, error) { + params := &StreamParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Stream) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/qldb/v1beta1/zz_stream_types.go b/apis/qldb/v1beta1/zz_stream_types.go index ebfd77894e..849b7dec58 100755 --- a/apis/qldb/v1beta1/zz_stream_types.go +++ b/apis/qldb/v1beta1/zz_stream_types.go @@ -227,13 +227,14 @@ type StreamStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Stream is the Schema for the Streams API. Provides a QLDB Stream resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Stream struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/quicksight/v1beta1/zz_generated.conversion_hubs.go b/apis/quicksight/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..27dcbd5a01 --- /dev/null +++ b/apis/quicksight/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Group) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *User) Hub() {} diff --git a/apis/quicksight/v1beta1/zz_generated_terraformed.go b/apis/quicksight/v1beta1/zz_group_terraformed.go similarity index 52% rename from apis/quicksight/v1beta1/zz_generated_terraformed.go rename to apis/quicksight/v1beta1/zz_group_terraformed.go index f094ced28f..4dbde7545c 100755 --- a/apis/quicksight/v1beta1/zz_generated_terraformed.go +++ b/apis/quicksight/v1beta1/zz_group_terraformed.go @@ -131,117 +131,3 @@ func (tr *Group) LateInitialize(attrs []byte) (bool, error) { func (tr *Group) GetTerraformSchemaVersion() int { return 0 } - -// GetTerraformResourceType returns Terraform resource type for this User -func (mg *User) GetTerraformResourceType() string { - return "aws_quicksight_user" -} - -// GetConnectionDetailsMapping for this User -func (tr *User) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this User -func (tr *User) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this User -func (tr *User) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this User -func (tr *User) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this User -func (tr *User) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this User -func (tr *User) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this User -func (tr *User) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this User -func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this User using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *User) LateInitialize(attrs []byte) (bool, error) { - params := &UserParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *User) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/quicksight/v1beta1/zz_group_types.go b/apis/quicksight/v1beta1/zz_group_types.go index 73d4c35c93..132e41735c 100755 --- a/apis/quicksight/v1beta1/zz_group_types.go +++ b/apis/quicksight/v1beta1/zz_group_types.go @@ -100,13 +100,14 @@ type GroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Group is the Schema for the Groups API. Manages a Resource QuickSight Group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Group struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/quicksight/v1beta1/zz_user_terraformed.go b/apis/quicksight/v1beta1/zz_user_terraformed.go new file mode 100755 index 0000000000..723f463f3b --- /dev/null +++ b/apis/quicksight/v1beta1/zz_user_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this User +func (mg *User) GetTerraformResourceType() string { + return "aws_quicksight_user" +} + +// GetConnectionDetailsMapping for this User +func (tr *User) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this User +func (tr *User) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this User +func (tr *User) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this User +func (tr *User) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this User +func (tr *User) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this User +func (tr *User) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this User +func (tr *User) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this User +func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this User using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *User) LateInitialize(attrs []byte) (bool, error) { + params := &UserParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *User) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/quicksight/v1beta1/zz_user_types.go b/apis/quicksight/v1beta1/zz_user_types.go index 60b83a32a0..7c770a0034 100755 --- a/apis/quicksight/v1beta1/zz_user_types.go +++ b/apis/quicksight/v1beta1/zz_user_types.go @@ -140,13 +140,14 @@ type UserStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // User is the Schema for the Users API. Manages a Resource QuickSight User. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type User struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ram/v1beta1/zz_generated.conversion_hubs.go b/apis/ram/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..7817295e92 --- /dev/null +++ b/apis/ram/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *PrincipalAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResourceAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResourceShare) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResourceShareAccepter) Hub() {} diff --git a/apis/ram/v1beta1/zz_generated_terraformed.go b/apis/ram/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index d1d9512b3c..0000000000 --- a/apis/ram/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this PrincipalAssociation -func (mg *PrincipalAssociation) GetTerraformResourceType() string { - return "aws_ram_principal_association" -} - -// GetConnectionDetailsMapping for this PrincipalAssociation -func (tr *PrincipalAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PrincipalAssociation -func (tr *PrincipalAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PrincipalAssociation -func (tr *PrincipalAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PrincipalAssociation -func (tr *PrincipalAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PrincipalAssociation -func (tr *PrincipalAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PrincipalAssociation -func (tr *PrincipalAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PrincipalAssociation -func (tr *PrincipalAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PrincipalAssociation -func (tr *PrincipalAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PrincipalAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PrincipalAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &PrincipalAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PrincipalAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ResourceAssociation -func (mg *ResourceAssociation) GetTerraformResourceType() string { - return "aws_ram_resource_association" -} - -// GetConnectionDetailsMapping for this ResourceAssociation -func (tr *ResourceAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResourceAssociation -func (tr *ResourceAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResourceAssociation -func (tr *ResourceAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResourceAssociation -func (tr *ResourceAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResourceAssociation -func (tr *ResourceAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResourceAssociation -func (tr *ResourceAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResourceAssociation -func (tr *ResourceAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResourceAssociation -func (tr *ResourceAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResourceAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResourceAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &ResourceAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResourceAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ResourceShare -func (mg *ResourceShare) GetTerraformResourceType() string { - return "aws_ram_resource_share" -} - -// GetConnectionDetailsMapping for this ResourceShare -func (tr *ResourceShare) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResourceShare -func (tr *ResourceShare) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResourceShare -func (tr *ResourceShare) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResourceShare -func (tr *ResourceShare) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResourceShare -func (tr *ResourceShare) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResourceShare -func (tr *ResourceShare) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResourceShare -func (tr *ResourceShare) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResourceShare -func (tr *ResourceShare) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResourceShare using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResourceShare) LateInitialize(attrs []byte) (bool, error) { - params := &ResourceShareParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResourceShare) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ResourceShareAccepter -func (mg *ResourceShareAccepter) GetTerraformResourceType() string { - return "aws_ram_resource_share_accepter" -} - -// GetConnectionDetailsMapping for this ResourceShareAccepter -func (tr *ResourceShareAccepter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResourceShareAccepter -func (tr *ResourceShareAccepter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResourceShareAccepter -func (tr *ResourceShareAccepter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResourceShareAccepter -func (tr *ResourceShareAccepter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResourceShareAccepter -func (tr *ResourceShareAccepter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResourceShareAccepter -func (tr *ResourceShareAccepter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResourceShareAccepter -func (tr *ResourceShareAccepter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResourceShareAccepter -func (tr *ResourceShareAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResourceShareAccepter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResourceShareAccepter) LateInitialize(attrs []byte) (bool, error) { - params := &ResourceShareAccepterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResourceShareAccepter) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/ram/v1beta1/zz_principalassociation_terraformed.go b/apis/ram/v1beta1/zz_principalassociation_terraformed.go new file mode 100755 index 0000000000..9ddb400f71 --- /dev/null +++ b/apis/ram/v1beta1/zz_principalassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PrincipalAssociation +func (mg *PrincipalAssociation) GetTerraformResourceType() string { + return "aws_ram_principal_association" +} + +// GetConnectionDetailsMapping for this PrincipalAssociation +func (tr *PrincipalAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PrincipalAssociation +func (tr *PrincipalAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PrincipalAssociation +func (tr *PrincipalAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PrincipalAssociation +func (tr *PrincipalAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PrincipalAssociation +func (tr *PrincipalAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PrincipalAssociation +func (tr *PrincipalAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PrincipalAssociation +func (tr *PrincipalAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PrincipalAssociation +func (tr *PrincipalAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PrincipalAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PrincipalAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &PrincipalAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PrincipalAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ram/v1beta1/zz_principalassociation_types.go b/apis/ram/v1beta1/zz_principalassociation_types.go index 8ad601184e..f518a7faca 100755 --- a/apis/ram/v1beta1/zz_principalassociation_types.go +++ b/apis/ram/v1beta1/zz_principalassociation_types.go @@ -118,13 +118,14 @@ type PrincipalAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PrincipalAssociation is the Schema for the PrincipalAssociations API. Provides a Resource Access Manager (RAM) principal association. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PrincipalAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ram/v1beta1/zz_resourceassociation_terraformed.go b/apis/ram/v1beta1/zz_resourceassociation_terraformed.go new file mode 100755 index 0000000000..0dbd8d05e2 --- /dev/null +++ b/apis/ram/v1beta1/zz_resourceassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResourceAssociation +func (mg *ResourceAssociation) GetTerraformResourceType() string { + return "aws_ram_resource_association" +} + +// GetConnectionDetailsMapping for this ResourceAssociation +func (tr *ResourceAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResourceAssociation +func (tr *ResourceAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResourceAssociation +func (tr *ResourceAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResourceAssociation +func (tr *ResourceAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResourceAssociation +func (tr *ResourceAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResourceAssociation +func (tr *ResourceAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResourceAssociation +func (tr *ResourceAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResourceAssociation +func (tr *ResourceAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResourceAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResourceAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &ResourceAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResourceAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ram/v1beta1/zz_resourceassociation_types.go b/apis/ram/v1beta1/zz_resourceassociation_types.go index 5e98048e1e..52cf9bc5fd 100755 --- a/apis/ram/v1beta1/zz_resourceassociation_types.go +++ b/apis/ram/v1beta1/zz_resourceassociation_types.go @@ -98,13 +98,14 @@ type ResourceAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResourceAssociation is the Schema for the ResourceAssociations API. Manages a Resource Access Manager (RAM) Resource Association. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResourceAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ram/v1beta1/zz_resourceshare_terraformed.go b/apis/ram/v1beta1/zz_resourceshare_terraformed.go new file mode 100755 index 0000000000..a6958965ea --- /dev/null +++ b/apis/ram/v1beta1/zz_resourceshare_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResourceShare +func (mg *ResourceShare) GetTerraformResourceType() string { + return "aws_ram_resource_share" +} + +// GetConnectionDetailsMapping for this ResourceShare +func (tr *ResourceShare) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResourceShare +func (tr *ResourceShare) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResourceShare +func (tr *ResourceShare) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResourceShare +func (tr *ResourceShare) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResourceShare +func (tr *ResourceShare) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResourceShare +func (tr *ResourceShare) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResourceShare +func (tr *ResourceShare) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResourceShare +func (tr *ResourceShare) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResourceShare using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResourceShare) LateInitialize(attrs []byte) (bool, error) { + params := &ResourceShareParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResourceShare) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ram/v1beta1/zz_resourceshare_types.go b/apis/ram/v1beta1/zz_resourceshare_types.go index 4c72705423..081255903a 100755 --- a/apis/ram/v1beta1/zz_resourceshare_types.go +++ b/apis/ram/v1beta1/zz_resourceshare_types.go @@ -111,13 +111,14 @@ type ResourceShareStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResourceShare is the Schema for the ResourceShares API. Manages a Resource Access Manager (RAM) Resource Share. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResourceShare struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ram/v1beta1/zz_resourceshareaccepter_terraformed.go b/apis/ram/v1beta1/zz_resourceshareaccepter_terraformed.go new file mode 100755 index 0000000000..79d3610326 --- /dev/null +++ b/apis/ram/v1beta1/zz_resourceshareaccepter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResourceShareAccepter +func (mg *ResourceShareAccepter) GetTerraformResourceType() string { + return "aws_ram_resource_share_accepter" +} + +// GetConnectionDetailsMapping for this ResourceShareAccepter +func (tr *ResourceShareAccepter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResourceShareAccepter +func (tr *ResourceShareAccepter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResourceShareAccepter +func (tr *ResourceShareAccepter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResourceShareAccepter +func (tr *ResourceShareAccepter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResourceShareAccepter +func (tr *ResourceShareAccepter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResourceShareAccepter +func (tr *ResourceShareAccepter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResourceShareAccepter +func (tr *ResourceShareAccepter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResourceShareAccepter +func (tr *ResourceShareAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResourceShareAccepter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResourceShareAccepter) LateInitialize(attrs []byte) (bool, error) { + params := &ResourceShareAccepterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResourceShareAccepter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ram/v1beta1/zz_resourceshareaccepter_types.go b/apis/ram/v1beta1/zz_resourceshareaccepter_types.go index 7b2c01ee77..55ba298454 100755 --- a/apis/ram/v1beta1/zz_resourceshareaccepter_types.go +++ b/apis/ram/v1beta1/zz_resourceshareaccepter_types.go @@ -107,13 +107,14 @@ type ResourceShareAccepterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResourceShareAccepter is the Schema for the ResourceShareAccepters API. Manages accepting a Resource Access Manager (RAM) Resource Share invitation. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResourceShareAccepter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_cluster_terraformed.go b/apis/rds/v1beta1/zz_cluster_terraformed.go new file mode 100755 index 0000000000..ffd292c03b --- /dev/null +++ b/apis/rds/v1beta1/zz_cluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cluster +func (mg *Cluster) GetTerraformResourceType() string { + return "aws_rds_cluster" +} + +// GetConnectionDetailsMapping for this Cluster +func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"master_password": "spec.forProvider.masterPasswordSecretRef"} +} + +// GetObservation of this Cluster +func (tr *Cluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cluster +func (tr *Cluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cluster +func (tr *Cluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cluster +func (tr *Cluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cluster +func (tr *Cluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_cluster_types.go b/apis/rds/v1beta1/zz_cluster_types.go index e54c5c2e06..766c53d5de 100755 --- a/apis/rds/v1beta1/zz_cluster_types.go +++ b/apis/rds/v1beta1/zz_cluster_types.go @@ -878,13 +878,14 @@ type ClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cluster is the Schema for the Clusters API. Manages an RDS Aurora Cluster // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_clusteractivitystream_terraformed.go b/apis/rds/v1beta1/zz_clusteractivitystream_terraformed.go new file mode 100755 index 0000000000..118fb8cc10 --- /dev/null +++ b/apis/rds/v1beta1/zz_clusteractivitystream_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterActivityStream +func (mg *ClusterActivityStream) GetTerraformResourceType() string { + return "aws_rds_cluster_activity_stream" +} + +// GetConnectionDetailsMapping for this ClusterActivityStream +func (tr *ClusterActivityStream) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterActivityStream +func (tr *ClusterActivityStream) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterActivityStream +func (tr *ClusterActivityStream) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterActivityStream +func (tr *ClusterActivityStream) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterActivityStream +func (tr *ClusterActivityStream) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterActivityStream +func (tr *ClusterActivityStream) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterActivityStream +func (tr *ClusterActivityStream) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterActivityStream +func (tr *ClusterActivityStream) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterActivityStream using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterActivityStream) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterActivityStreamParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterActivityStream) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_clusteractivitystream_types.go b/apis/rds/v1beta1/zz_clusteractivitystream_types.go index 5016379720..fa288a2b69 100755 --- a/apis/rds/v1beta1/zz_clusteractivitystream_types.go +++ b/apis/rds/v1beta1/zz_clusteractivitystream_types.go @@ -139,13 +139,14 @@ type ClusterActivityStreamStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterActivityStream is the Schema for the ClusterActivityStreams API. Manages RDS Aurora Cluster Database Activity Streams // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterActivityStream struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_clusterendpoint_terraformed.go b/apis/rds/v1beta1/zz_clusterendpoint_terraformed.go new file mode 100755 index 0000000000..c0dbb96208 --- /dev/null +++ b/apis/rds/v1beta1/zz_clusterendpoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterEndpoint +func (mg *ClusterEndpoint) GetTerraformResourceType() string { + return "aws_rds_cluster_endpoint" +} + +// GetConnectionDetailsMapping for this ClusterEndpoint +func (tr *ClusterEndpoint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterEndpoint +func (tr *ClusterEndpoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterEndpoint +func (tr *ClusterEndpoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterEndpoint +func (tr *ClusterEndpoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterEndpoint +func (tr *ClusterEndpoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterEndpoint +func (tr *ClusterEndpoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterEndpoint +func (tr *ClusterEndpoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterEndpoint +func (tr *ClusterEndpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterEndpoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterEndpoint) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterEndpointParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterEndpoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_clusterendpoint_types.go b/apis/rds/v1beta1/zz_clusterendpoint_types.go index 6ef112c145..ffd5f38b25 100755 --- a/apis/rds/v1beta1/zz_clusterendpoint_types.go +++ b/apis/rds/v1beta1/zz_clusterendpoint_types.go @@ -147,13 +147,14 @@ type ClusterEndpointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterEndpoint is the Schema for the ClusterEndpoints API. Manages an RDS Aurora Cluster Endpoint // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterEndpoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_clusterinstance_terraformed.go b/apis/rds/v1beta1/zz_clusterinstance_terraformed.go new file mode 100755 index 0000000000..6135f6a685 --- /dev/null +++ b/apis/rds/v1beta1/zz_clusterinstance_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterInstance +func (mg *ClusterInstance) GetTerraformResourceType() string { + return "aws_rds_cluster_instance" +} + +// GetConnectionDetailsMapping for this ClusterInstance +func (tr *ClusterInstance) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterInstance +func (tr *ClusterInstance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterInstance +func (tr *ClusterInstance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterInstance +func (tr *ClusterInstance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterInstance +func (tr *ClusterInstance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterInstance +func (tr *ClusterInstance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterInstance +func (tr *ClusterInstance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterInstance +func (tr *ClusterInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterInstance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterInstance) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterInstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterInstance) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_clusterinstance_types.go b/apis/rds/v1beta1/zz_clusterinstance_types.go index 55c59c4c3a..cc039fea4d 100755 --- a/apis/rds/v1beta1/zz_clusterinstance_types.go +++ b/apis/rds/v1beta1/zz_clusterinstance_types.go @@ -408,13 +408,14 @@ type ClusterInstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterInstance is the Schema for the ClusterInstances API. Provides an RDS Cluster Resource Instance // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterInstance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_clusterparametergroup_terraformed.go b/apis/rds/v1beta1/zz_clusterparametergroup_terraformed.go new file mode 100755 index 0000000000..ee9995eece --- /dev/null +++ b/apis/rds/v1beta1/zz_clusterparametergroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterParameterGroup +func (mg *ClusterParameterGroup) GetTerraformResourceType() string { + return "aws_rds_cluster_parameter_group" +} + +// GetConnectionDetailsMapping for this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterParameterGroup +func (tr *ClusterParameterGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterParameterGroup +func (tr *ClusterParameterGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterParameterGroup +func (tr *ClusterParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterParameterGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterParameterGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameterGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterParameterGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_clusterparametergroup_types.go b/apis/rds/v1beta1/zz_clusterparametergroup_types.go index ba78b7b0d9..d46bcd3a6c 100755 --- a/apis/rds/v1beta1/zz_clusterparametergroup_types.go +++ b/apis/rds/v1beta1/zz_clusterparametergroup_types.go @@ -153,13 +153,14 @@ type ClusterParameterGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterParameterGroup is the Schema for the ClusterParameterGroups API. Provides an RDS DB cluster parameter group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterParameterGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_clusterroleassociation_terraformed.go b/apis/rds/v1beta1/zz_clusterroleassociation_terraformed.go new file mode 100755 index 0000000000..9cc9baa221 --- /dev/null +++ b/apis/rds/v1beta1/zz_clusterroleassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterRoleAssociation +func (mg *ClusterRoleAssociation) GetTerraformResourceType() string { + return "aws_rds_cluster_role_association" +} + +// GetConnectionDetailsMapping for this ClusterRoleAssociation +func (tr *ClusterRoleAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterRoleAssociation +func (tr *ClusterRoleAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterRoleAssociation +func (tr *ClusterRoleAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterRoleAssociation +func (tr *ClusterRoleAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterRoleAssociation +func (tr *ClusterRoleAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterRoleAssociation +func (tr *ClusterRoleAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterRoleAssociation +func (tr *ClusterRoleAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterRoleAssociation +func (tr *ClusterRoleAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterRoleAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterRoleAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterRoleAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterRoleAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_clusterroleassociation_types.go b/apis/rds/v1beta1/zz_clusterroleassociation_types.go index 2cd25d249a..9769319f71 100755 --- a/apis/rds/v1beta1/zz_clusterroleassociation_types.go +++ b/apis/rds/v1beta1/zz_clusterroleassociation_types.go @@ -128,13 +128,14 @@ type ClusterRoleAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterRoleAssociation is the Schema for the ClusterRoleAssociations API. Manages a RDS DB Cluster association with an IAM Role. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterRoleAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_clustersnapshot_terraformed.go b/apis/rds/v1beta1/zz_clustersnapshot_terraformed.go new file mode 100755 index 0000000000..83338fe955 --- /dev/null +++ b/apis/rds/v1beta1/zz_clustersnapshot_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClusterSnapshot +func (mg *ClusterSnapshot) GetTerraformResourceType() string { + return "aws_db_cluster_snapshot" +} + +// GetConnectionDetailsMapping for this ClusterSnapshot +func (tr *ClusterSnapshot) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClusterSnapshot +func (tr *ClusterSnapshot) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClusterSnapshot +func (tr *ClusterSnapshot) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClusterSnapshot +func (tr *ClusterSnapshot) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClusterSnapshot +func (tr *ClusterSnapshot) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClusterSnapshot +func (tr *ClusterSnapshot) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClusterSnapshot +func (tr *ClusterSnapshot) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClusterSnapshot +func (tr *ClusterSnapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClusterSnapshot using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClusterSnapshot) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterSnapshotParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClusterSnapshot) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_clustersnapshot_types.go b/apis/rds/v1beta1/zz_clustersnapshot_types.go index 7ab2474025..28e7ba7870 100755 --- a/apis/rds/v1beta1/zz_clustersnapshot_types.go +++ b/apis/rds/v1beta1/zz_clustersnapshot_types.go @@ -152,13 +152,14 @@ type ClusterSnapshotStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ClusterSnapshot is the Schema for the ClusterSnapshots API. Manages an RDS database cluster snapshot. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ClusterSnapshot struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_dbinstanceautomatedbackupsreplication_terraformed.go b/apis/rds/v1beta1/zz_dbinstanceautomatedbackupsreplication_terraformed.go new file mode 100755 index 0000000000..a7f8270b55 --- /dev/null +++ b/apis/rds/v1beta1/zz_dbinstanceautomatedbackupsreplication_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DBInstanceAutomatedBackupsReplication +func (mg *DBInstanceAutomatedBackupsReplication) GetTerraformResourceType() string { + return "aws_db_instance_automated_backups_replication" +} + +// GetConnectionDetailsMapping for this DBInstanceAutomatedBackupsReplication +func (tr *DBInstanceAutomatedBackupsReplication) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DBInstanceAutomatedBackupsReplication +func (tr *DBInstanceAutomatedBackupsReplication) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DBInstanceAutomatedBackupsReplication +func (tr *DBInstanceAutomatedBackupsReplication) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DBInstanceAutomatedBackupsReplication +func (tr *DBInstanceAutomatedBackupsReplication) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DBInstanceAutomatedBackupsReplication +func (tr *DBInstanceAutomatedBackupsReplication) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DBInstanceAutomatedBackupsReplication +func (tr *DBInstanceAutomatedBackupsReplication) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DBInstanceAutomatedBackupsReplication +func (tr *DBInstanceAutomatedBackupsReplication) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DBInstanceAutomatedBackupsReplication +func (tr *DBInstanceAutomatedBackupsReplication) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DBInstanceAutomatedBackupsReplication using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DBInstanceAutomatedBackupsReplication) LateInitialize(attrs []byte) (bool, error) { + params := &DBInstanceAutomatedBackupsReplicationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DBInstanceAutomatedBackupsReplication) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_dbinstanceautomatedbackupsreplication_types.go b/apis/rds/v1beta1/zz_dbinstanceautomatedbackupsreplication_types.go index 17a13ae54e..17c7b6b580 100755 --- a/apis/rds/v1beta1/zz_dbinstanceautomatedbackupsreplication_types.go +++ b/apis/rds/v1beta1/zz_dbinstanceautomatedbackupsreplication_types.go @@ -136,13 +136,14 @@ type DBInstanceAutomatedBackupsReplicationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DBInstanceAutomatedBackupsReplication is the Schema for the DBInstanceAutomatedBackupsReplications API. Enables replication of automated backups to a different AWS Region. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DBInstanceAutomatedBackupsReplication struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_dbsnapshotcopy_terraformed.go b/apis/rds/v1beta1/zz_dbsnapshotcopy_terraformed.go new file mode 100755 index 0000000000..666ebe2d45 --- /dev/null +++ b/apis/rds/v1beta1/zz_dbsnapshotcopy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DBSnapshotCopy +func (mg *DBSnapshotCopy) GetTerraformResourceType() string { + return "aws_db_snapshot_copy" +} + +// GetConnectionDetailsMapping for this DBSnapshotCopy +func (tr *DBSnapshotCopy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DBSnapshotCopy +func (tr *DBSnapshotCopy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DBSnapshotCopy +func (tr *DBSnapshotCopy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DBSnapshotCopy +func (tr *DBSnapshotCopy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DBSnapshotCopy +func (tr *DBSnapshotCopy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DBSnapshotCopy +func (tr *DBSnapshotCopy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DBSnapshotCopy +func (tr *DBSnapshotCopy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DBSnapshotCopy +func (tr *DBSnapshotCopy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DBSnapshotCopy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DBSnapshotCopy) LateInitialize(attrs []byte) (bool, error) { + params := &DBSnapshotCopyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DBSnapshotCopy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_dbsnapshotcopy_types.go b/apis/rds/v1beta1/zz_dbsnapshotcopy_types.go index b3143fc41f..5a91e39520 100755 --- a/apis/rds/v1beta1/zz_dbsnapshotcopy_types.go +++ b/apis/rds/v1beta1/zz_dbsnapshotcopy_types.go @@ -230,13 +230,14 @@ type DBSnapshotCopyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DBSnapshotCopy is the Schema for the DBSnapshotCopys API. Manages an RDS database instance snapshot copy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DBSnapshotCopy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_eventsubscription_terraformed.go b/apis/rds/v1beta1/zz_eventsubscription_terraformed.go new file mode 100755 index 0000000000..19ab2cdb07 --- /dev/null +++ b/apis/rds/v1beta1/zz_eventsubscription_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EventSubscription +func (mg *EventSubscription) GetTerraformResourceType() string { + return "aws_db_event_subscription" +} + +// GetConnectionDetailsMapping for this EventSubscription +func (tr *EventSubscription) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EventSubscription +func (tr *EventSubscription) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EventSubscription +func (tr *EventSubscription) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EventSubscription +func (tr *EventSubscription) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EventSubscription +func (tr *EventSubscription) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EventSubscription +func (tr *EventSubscription) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EventSubscription +func (tr *EventSubscription) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EventSubscription +func (tr *EventSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EventSubscription using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EventSubscription) LateInitialize(attrs []byte) (bool, error) { + params := &EventSubscriptionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EventSubscription) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_eventsubscription_types.go b/apis/rds/v1beta1/zz_eventsubscription_types.go index ad7d7921b7..d0f206b9fc 100755 --- a/apis/rds/v1beta1/zz_eventsubscription_types.go +++ b/apis/rds/v1beta1/zz_eventsubscription_types.go @@ -157,13 +157,14 @@ type EventSubscriptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EventSubscription is the Schema for the EventSubscriptions API. Provides a DB event subscription resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EventSubscription struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_generated.conversion_hubs.go b/apis/rds/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..aa5230defd --- /dev/null +++ b/apis/rds/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,74 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ClusterSnapshot) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EventSubscription) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Instance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DBInstanceAutomatedBackupsReplication) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InstanceRoleAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *OptionGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ParameterGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Proxy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ProxyDefaultTargetGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ProxyEndpoint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ProxyTarget) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Snapshot) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DBSnapshotCopy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SubnetGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Cluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterActivityStream) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterEndpoint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterInstance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterParameterGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ClusterRoleAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GlobalCluster) Hub() {} diff --git a/apis/rds/v1beta1/zz_generated_terraformed.go b/apis/rds/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 794730e7d4..0000000000 --- a/apis/rds/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,2415 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this ClusterSnapshot -func (mg *ClusterSnapshot) GetTerraformResourceType() string { - return "aws_db_cluster_snapshot" -} - -// GetConnectionDetailsMapping for this ClusterSnapshot -func (tr *ClusterSnapshot) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterSnapshot -func (tr *ClusterSnapshot) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterSnapshot -func (tr *ClusterSnapshot) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterSnapshot -func (tr *ClusterSnapshot) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterSnapshot -func (tr *ClusterSnapshot) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterSnapshot -func (tr *ClusterSnapshot) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterSnapshot -func (tr *ClusterSnapshot) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterSnapshot -func (tr *ClusterSnapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterSnapshot using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterSnapshot) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterSnapshotParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterSnapshot) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EventSubscription -func (mg *EventSubscription) GetTerraformResourceType() string { - return "aws_db_event_subscription" -} - -// GetConnectionDetailsMapping for this EventSubscription -func (tr *EventSubscription) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EventSubscription -func (tr *EventSubscription) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EventSubscription -func (tr *EventSubscription) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EventSubscription -func (tr *EventSubscription) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EventSubscription -func (tr *EventSubscription) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EventSubscription -func (tr *EventSubscription) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EventSubscription -func (tr *EventSubscription) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EventSubscription -func (tr *EventSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EventSubscription using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EventSubscription) LateInitialize(attrs []byte) (bool, error) { - params := &EventSubscriptionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EventSubscription) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Instance -func (mg *Instance) GetTerraformResourceType() string { - return "aws_db_instance" -} - -// GetConnectionDetailsMapping for this Instance -func (tr *Instance) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"password": "spec.forProvider.passwordSecretRef"} -} - -// GetObservation of this Instance -func (tr *Instance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Instance -func (tr *Instance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Instance -func (tr *Instance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Instance -func (tr *Instance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Instance -func (tr *Instance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Instance -func (tr *Instance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Instance -func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Instance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { - params := &InstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("DBName")) - opts = append(opts, resource.WithNameFilter("Name")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Instance) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this DBInstanceAutomatedBackupsReplication -func (mg *DBInstanceAutomatedBackupsReplication) GetTerraformResourceType() string { - return "aws_db_instance_automated_backups_replication" -} - -// GetConnectionDetailsMapping for this DBInstanceAutomatedBackupsReplication -func (tr *DBInstanceAutomatedBackupsReplication) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DBInstanceAutomatedBackupsReplication -func (tr *DBInstanceAutomatedBackupsReplication) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DBInstanceAutomatedBackupsReplication -func (tr *DBInstanceAutomatedBackupsReplication) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DBInstanceAutomatedBackupsReplication -func (tr *DBInstanceAutomatedBackupsReplication) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DBInstanceAutomatedBackupsReplication -func (tr *DBInstanceAutomatedBackupsReplication) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DBInstanceAutomatedBackupsReplication -func (tr *DBInstanceAutomatedBackupsReplication) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DBInstanceAutomatedBackupsReplication -func (tr *DBInstanceAutomatedBackupsReplication) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DBInstanceAutomatedBackupsReplication -func (tr *DBInstanceAutomatedBackupsReplication) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DBInstanceAutomatedBackupsReplication using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DBInstanceAutomatedBackupsReplication) LateInitialize(attrs []byte) (bool, error) { - params := &DBInstanceAutomatedBackupsReplicationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DBInstanceAutomatedBackupsReplication) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InstanceRoleAssociation -func (mg *InstanceRoleAssociation) GetTerraformResourceType() string { - return "aws_db_instance_role_association" -} - -// GetConnectionDetailsMapping for this InstanceRoleAssociation -func (tr *InstanceRoleAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InstanceRoleAssociation -func (tr *InstanceRoleAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InstanceRoleAssociation -func (tr *InstanceRoleAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InstanceRoleAssociation -func (tr *InstanceRoleAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InstanceRoleAssociation -func (tr *InstanceRoleAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InstanceRoleAssociation -func (tr *InstanceRoleAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InstanceRoleAssociation -func (tr *InstanceRoleAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InstanceRoleAssociation -func (tr *InstanceRoleAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InstanceRoleAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InstanceRoleAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &InstanceRoleAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InstanceRoleAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this OptionGroup -func (mg *OptionGroup) GetTerraformResourceType() string { - return "aws_db_option_group" -} - -// GetConnectionDetailsMapping for this OptionGroup -func (tr *OptionGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this OptionGroup -func (tr *OptionGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this OptionGroup -func (tr *OptionGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this OptionGroup -func (tr *OptionGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this OptionGroup -func (tr *OptionGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this OptionGroup -func (tr *OptionGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this OptionGroup -func (tr *OptionGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this OptionGroup -func (tr *OptionGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this OptionGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *OptionGroup) LateInitialize(attrs []byte) (bool, error) { - params := &OptionGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *OptionGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ParameterGroup -func (mg *ParameterGroup) GetTerraformResourceType() string { - return "aws_db_parameter_group" -} - -// GetConnectionDetailsMapping for this ParameterGroup -func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ParameterGroup -func (tr *ParameterGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ParameterGroup -func (tr *ParameterGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ParameterGroup -func (tr *ParameterGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ParameterGroup -func (tr *ParameterGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ParameterGroup -func (tr *ParameterGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ParameterGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ParameterGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ParameterGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Proxy -func (mg *Proxy) GetTerraformResourceType() string { - return "aws_db_proxy" -} - -// GetConnectionDetailsMapping for this Proxy -func (tr *Proxy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Proxy -func (tr *Proxy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Proxy -func (tr *Proxy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Proxy -func (tr *Proxy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Proxy -func (tr *Proxy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Proxy -func (tr *Proxy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Proxy -func (tr *Proxy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Proxy -func (tr *Proxy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Proxy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Proxy) LateInitialize(attrs []byte) (bool, error) { - params := &ProxyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Proxy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ProxyDefaultTargetGroup -func (mg *ProxyDefaultTargetGroup) GetTerraformResourceType() string { - return "aws_db_proxy_default_target_group" -} - -// GetConnectionDetailsMapping for this ProxyDefaultTargetGroup -func (tr *ProxyDefaultTargetGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ProxyDefaultTargetGroup -func (tr *ProxyDefaultTargetGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ProxyDefaultTargetGroup -func (tr *ProxyDefaultTargetGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ProxyDefaultTargetGroup -func (tr *ProxyDefaultTargetGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ProxyDefaultTargetGroup -func (tr *ProxyDefaultTargetGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ProxyDefaultTargetGroup -func (tr *ProxyDefaultTargetGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ProxyDefaultTargetGroup -func (tr *ProxyDefaultTargetGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ProxyDefaultTargetGroup -func (tr *ProxyDefaultTargetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ProxyDefaultTargetGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ProxyDefaultTargetGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ProxyDefaultTargetGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ProxyDefaultTargetGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ProxyEndpoint -func (mg *ProxyEndpoint) GetTerraformResourceType() string { - return "aws_db_proxy_endpoint" -} - -// GetConnectionDetailsMapping for this ProxyEndpoint -func (tr *ProxyEndpoint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ProxyEndpoint -func (tr *ProxyEndpoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ProxyEndpoint -func (tr *ProxyEndpoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ProxyEndpoint -func (tr *ProxyEndpoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ProxyEndpoint -func (tr *ProxyEndpoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ProxyEndpoint -func (tr *ProxyEndpoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ProxyEndpoint -func (tr *ProxyEndpoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ProxyEndpoint -func (tr *ProxyEndpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ProxyEndpoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ProxyEndpoint) LateInitialize(attrs []byte) (bool, error) { - params := &ProxyEndpointParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ProxyEndpoint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ProxyTarget -func (mg *ProxyTarget) GetTerraformResourceType() string { - return "aws_db_proxy_target" -} - -// GetConnectionDetailsMapping for this ProxyTarget -func (tr *ProxyTarget) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ProxyTarget -func (tr *ProxyTarget) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ProxyTarget -func (tr *ProxyTarget) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ProxyTarget -func (tr *ProxyTarget) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ProxyTarget -func (tr *ProxyTarget) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ProxyTarget -func (tr *ProxyTarget) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ProxyTarget -func (tr *ProxyTarget) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ProxyTarget -func (tr *ProxyTarget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ProxyTarget using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ProxyTarget) LateInitialize(attrs []byte) (bool, error) { - params := &ProxyTargetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ProxyTarget) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Snapshot -func (mg *Snapshot) GetTerraformResourceType() string { - return "aws_db_snapshot" -} - -// GetConnectionDetailsMapping for this Snapshot -func (tr *Snapshot) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Snapshot -func (tr *Snapshot) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Snapshot -func (tr *Snapshot) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Snapshot -func (tr *Snapshot) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Snapshot -func (tr *Snapshot) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Snapshot -func (tr *Snapshot) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Snapshot -func (tr *Snapshot) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Snapshot -func (tr *Snapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Snapshot using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Snapshot) LateInitialize(attrs []byte) (bool, error) { - params := &SnapshotParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Snapshot) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DBSnapshotCopy -func (mg *DBSnapshotCopy) GetTerraformResourceType() string { - return "aws_db_snapshot_copy" -} - -// GetConnectionDetailsMapping for this DBSnapshotCopy -func (tr *DBSnapshotCopy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DBSnapshotCopy -func (tr *DBSnapshotCopy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DBSnapshotCopy -func (tr *DBSnapshotCopy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DBSnapshotCopy -func (tr *DBSnapshotCopy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DBSnapshotCopy -func (tr *DBSnapshotCopy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DBSnapshotCopy -func (tr *DBSnapshotCopy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DBSnapshotCopy -func (tr *DBSnapshotCopy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DBSnapshotCopy -func (tr *DBSnapshotCopy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DBSnapshotCopy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DBSnapshotCopy) LateInitialize(attrs []byte) (bool, error) { - params := &DBSnapshotCopyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DBSnapshotCopy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SubnetGroup -func (mg *SubnetGroup) GetTerraformResourceType() string { - return "aws_db_subnet_group" -} - -// GetConnectionDetailsMapping for this SubnetGroup -func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SubnetGroup -func (tr *SubnetGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SubnetGroup -func (tr *SubnetGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SubnetGroup -func (tr *SubnetGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SubnetGroup -func (tr *SubnetGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SubnetGroup -func (tr *SubnetGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SubnetGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { - params := &SubnetGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SubnetGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Cluster -func (mg *Cluster) GetTerraformResourceType() string { - return "aws_rds_cluster" -} - -// GetConnectionDetailsMapping for this Cluster -func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"master_password": "spec.forProvider.masterPasswordSecretRef"} -} - -// GetObservation of this Cluster -func (tr *Cluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cluster -func (tr *Cluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cluster -func (tr *Cluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cluster -func (tr *Cluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cluster -func (tr *Cluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterActivityStream -func (mg *ClusterActivityStream) GetTerraformResourceType() string { - return "aws_rds_cluster_activity_stream" -} - -// GetConnectionDetailsMapping for this ClusterActivityStream -func (tr *ClusterActivityStream) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterActivityStream -func (tr *ClusterActivityStream) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterActivityStream -func (tr *ClusterActivityStream) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterActivityStream -func (tr *ClusterActivityStream) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterActivityStream -func (tr *ClusterActivityStream) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterActivityStream -func (tr *ClusterActivityStream) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterActivityStream -func (tr *ClusterActivityStream) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterActivityStream -func (tr *ClusterActivityStream) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterActivityStream using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterActivityStream) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterActivityStreamParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterActivityStream) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterEndpoint -func (mg *ClusterEndpoint) GetTerraformResourceType() string { - return "aws_rds_cluster_endpoint" -} - -// GetConnectionDetailsMapping for this ClusterEndpoint -func (tr *ClusterEndpoint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterEndpoint -func (tr *ClusterEndpoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterEndpoint -func (tr *ClusterEndpoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterEndpoint -func (tr *ClusterEndpoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterEndpoint -func (tr *ClusterEndpoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterEndpoint -func (tr *ClusterEndpoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterEndpoint -func (tr *ClusterEndpoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterEndpoint -func (tr *ClusterEndpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterEndpoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterEndpoint) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterEndpointParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterEndpoint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterInstance -func (mg *ClusterInstance) GetTerraformResourceType() string { - return "aws_rds_cluster_instance" -} - -// GetConnectionDetailsMapping for this ClusterInstance -func (tr *ClusterInstance) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterInstance -func (tr *ClusterInstance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterInstance -func (tr *ClusterInstance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterInstance -func (tr *ClusterInstance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterInstance -func (tr *ClusterInstance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterInstance -func (tr *ClusterInstance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterInstance -func (tr *ClusterInstance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterInstance -func (tr *ClusterInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterInstance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterInstance) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterInstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterInstance) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterParameterGroup -func (mg *ClusterParameterGroup) GetTerraformResourceType() string { - return "aws_rds_cluster_parameter_group" -} - -// GetConnectionDetailsMapping for this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterParameterGroup -func (tr *ClusterParameterGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterParameterGroup -func (tr *ClusterParameterGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterParameterGroup -func (tr *ClusterParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterParameterGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterParameterGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameterGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterParameterGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ClusterRoleAssociation -func (mg *ClusterRoleAssociation) GetTerraformResourceType() string { - return "aws_rds_cluster_role_association" -} - -// GetConnectionDetailsMapping for this ClusterRoleAssociation -func (tr *ClusterRoleAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ClusterRoleAssociation -func (tr *ClusterRoleAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ClusterRoleAssociation -func (tr *ClusterRoleAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ClusterRoleAssociation -func (tr *ClusterRoleAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ClusterRoleAssociation -func (tr *ClusterRoleAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ClusterRoleAssociation -func (tr *ClusterRoleAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ClusterRoleAssociation -func (tr *ClusterRoleAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ClusterRoleAssociation -func (tr *ClusterRoleAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ClusterRoleAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ClusterRoleAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterRoleAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ClusterRoleAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GlobalCluster -func (mg *GlobalCluster) GetTerraformResourceType() string { - return "aws_rds_global_cluster" -} - -// GetConnectionDetailsMapping for this GlobalCluster -func (tr *GlobalCluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GlobalCluster -func (tr *GlobalCluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GlobalCluster -func (tr *GlobalCluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GlobalCluster -func (tr *GlobalCluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GlobalCluster -func (tr *GlobalCluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GlobalCluster -func (tr *GlobalCluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GlobalCluster -func (tr *GlobalCluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GlobalCluster -func (tr *GlobalCluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GlobalCluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GlobalCluster) LateInitialize(attrs []byte) (bool, error) { - params := &GlobalClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GlobalCluster) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/rds/v1beta1/zz_globalcluster_terraformed.go b/apis/rds/v1beta1/zz_globalcluster_terraformed.go new file mode 100755 index 0000000000..b8f4b47626 --- /dev/null +++ b/apis/rds/v1beta1/zz_globalcluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GlobalCluster +func (mg *GlobalCluster) GetTerraformResourceType() string { + return "aws_rds_global_cluster" +} + +// GetConnectionDetailsMapping for this GlobalCluster +func (tr *GlobalCluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GlobalCluster +func (tr *GlobalCluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GlobalCluster +func (tr *GlobalCluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GlobalCluster +func (tr *GlobalCluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GlobalCluster +func (tr *GlobalCluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GlobalCluster +func (tr *GlobalCluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GlobalCluster +func (tr *GlobalCluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GlobalCluster +func (tr *GlobalCluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GlobalCluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GlobalCluster) LateInitialize(attrs []byte) (bool, error) { + params := &GlobalClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GlobalCluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_globalcluster_types.go b/apis/rds/v1beta1/zz_globalcluster_types.go index 6b82889077..d86f8c14f8 100755 --- a/apis/rds/v1beta1/zz_globalcluster_types.go +++ b/apis/rds/v1beta1/zz_globalcluster_types.go @@ -174,13 +174,14 @@ type GlobalClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GlobalCluster is the Schema for the GlobalClusters API. Manages an RDS Global Cluster // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GlobalCluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_instance_terraformed.go b/apis/rds/v1beta1/zz_instance_terraformed.go new file mode 100755 index 0000000000..468ba37204 --- /dev/null +++ b/apis/rds/v1beta1/zz_instance_terraformed.go @@ -0,0 +1,135 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Instance +func (mg *Instance) GetTerraformResourceType() string { + return "aws_db_instance" +} + +// GetConnectionDetailsMapping for this Instance +func (tr *Instance) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"password": "spec.forProvider.passwordSecretRef"} +} + +// GetObservation of this Instance +func (tr *Instance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Instance +func (tr *Instance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Instance +func (tr *Instance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Instance +func (tr *Instance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Instance +func (tr *Instance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Instance +func (tr *Instance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Instance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { + params := &InstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("DBName")) + opts = append(opts, resource.WithNameFilter("Name")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Instance) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/rds/v1beta1/zz_instance_types.go b/apis/rds/v1beta1/zz_instance_types.go index a0fd54e71d..6e4f16be81 100755 --- a/apis/rds/v1beta1/zz_instance_types.go +++ b/apis/rds/v1beta1/zz_instance_types.go @@ -1218,13 +1218,14 @@ type InstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Instance is the Schema for the Instances API. Provides an RDS instance resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Instance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_instanceroleassociation_terraformed.go b/apis/rds/v1beta1/zz_instanceroleassociation_terraformed.go new file mode 100755 index 0000000000..b761f7ecdd --- /dev/null +++ b/apis/rds/v1beta1/zz_instanceroleassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InstanceRoleAssociation +func (mg *InstanceRoleAssociation) GetTerraformResourceType() string { + return "aws_db_instance_role_association" +} + +// GetConnectionDetailsMapping for this InstanceRoleAssociation +func (tr *InstanceRoleAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InstanceRoleAssociation +func (tr *InstanceRoleAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InstanceRoleAssociation +func (tr *InstanceRoleAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InstanceRoleAssociation +func (tr *InstanceRoleAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InstanceRoleAssociation +func (tr *InstanceRoleAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InstanceRoleAssociation +func (tr *InstanceRoleAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InstanceRoleAssociation +func (tr *InstanceRoleAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InstanceRoleAssociation +func (tr *InstanceRoleAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InstanceRoleAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InstanceRoleAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &InstanceRoleAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InstanceRoleAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_instanceroleassociation_types.go b/apis/rds/v1beta1/zz_instanceroleassociation_types.go index ead658c7b0..b4c83c0f04 100755 --- a/apis/rds/v1beta1/zz_instanceroleassociation_types.go +++ b/apis/rds/v1beta1/zz_instanceroleassociation_types.go @@ -128,13 +128,14 @@ type InstanceRoleAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InstanceRoleAssociation is the Schema for the InstanceRoleAssociations API. Manages an RDS DB Instance association with an IAM Role. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InstanceRoleAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_optiongroup_terraformed.go b/apis/rds/v1beta1/zz_optiongroup_terraformed.go new file mode 100755 index 0000000000..4ee73df29f --- /dev/null +++ b/apis/rds/v1beta1/zz_optiongroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this OptionGroup +func (mg *OptionGroup) GetTerraformResourceType() string { + return "aws_db_option_group" +} + +// GetConnectionDetailsMapping for this OptionGroup +func (tr *OptionGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this OptionGroup +func (tr *OptionGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this OptionGroup +func (tr *OptionGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this OptionGroup +func (tr *OptionGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this OptionGroup +func (tr *OptionGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this OptionGroup +func (tr *OptionGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this OptionGroup +func (tr *OptionGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this OptionGroup +func (tr *OptionGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this OptionGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *OptionGroup) LateInitialize(attrs []byte) (bool, error) { + params := &OptionGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *OptionGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_optiongroup_types.go b/apis/rds/v1beta1/zz_optiongroup_types.go index 2f142c78b3..7c603a9f0b 100755 --- a/apis/rds/v1beta1/zz_optiongroup_types.go +++ b/apis/rds/v1beta1/zz_optiongroup_types.go @@ -222,13 +222,14 @@ type OptionGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // OptionGroup is the Schema for the OptionGroups API. Provides an RDS DB option group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type OptionGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_parametergroup_terraformed.go b/apis/rds/v1beta1/zz_parametergroup_terraformed.go new file mode 100755 index 0000000000..c4796b4a9e --- /dev/null +++ b/apis/rds/v1beta1/zz_parametergroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ParameterGroup +func (mg *ParameterGroup) GetTerraformResourceType() string { + return "aws_db_parameter_group" +} + +// GetConnectionDetailsMapping for this ParameterGroup +func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ParameterGroup +func (tr *ParameterGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ParameterGroup +func (tr *ParameterGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ParameterGroup +func (tr *ParameterGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ParameterGroup +func (tr *ParameterGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ParameterGroup +func (tr *ParameterGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ParameterGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ParameterGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ParameterGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_parametergroup_types.go b/apis/rds/v1beta1/zz_parametergroup_types.go index 7e4e73f740..825eedcb89 100755 --- a/apis/rds/v1beta1/zz_parametergroup_types.go +++ b/apis/rds/v1beta1/zz_parametergroup_types.go @@ -153,13 +153,14 @@ type ParameterGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ParameterGroup is the Schema for the ParameterGroups API. Provides an RDS DB parameter group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ParameterGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_proxy_terraformed.go b/apis/rds/v1beta1/zz_proxy_terraformed.go new file mode 100755 index 0000000000..62c0d18983 --- /dev/null +++ b/apis/rds/v1beta1/zz_proxy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Proxy +func (mg *Proxy) GetTerraformResourceType() string { + return "aws_db_proxy" +} + +// GetConnectionDetailsMapping for this Proxy +func (tr *Proxy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Proxy +func (tr *Proxy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Proxy +func (tr *Proxy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Proxy +func (tr *Proxy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Proxy +func (tr *Proxy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Proxy +func (tr *Proxy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Proxy +func (tr *Proxy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Proxy +func (tr *Proxy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Proxy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Proxy) LateInitialize(attrs []byte) (bool, error) { + params := &ProxyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Proxy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_proxy_types.go b/apis/rds/v1beta1/zz_proxy_types.go index ab9072d73a..e9dbd789d1 100755 --- a/apis/rds/v1beta1/zz_proxy_types.go +++ b/apis/rds/v1beta1/zz_proxy_types.go @@ -298,13 +298,14 @@ type ProxyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Proxy is the Schema for the Proxys API. Provides an RDS DB proxy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Proxy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_proxydefaulttargetgroup_terraformed.go b/apis/rds/v1beta1/zz_proxydefaulttargetgroup_terraformed.go new file mode 100755 index 0000000000..b99face78b --- /dev/null +++ b/apis/rds/v1beta1/zz_proxydefaulttargetgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ProxyDefaultTargetGroup +func (mg *ProxyDefaultTargetGroup) GetTerraformResourceType() string { + return "aws_db_proxy_default_target_group" +} + +// GetConnectionDetailsMapping for this ProxyDefaultTargetGroup +func (tr *ProxyDefaultTargetGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ProxyDefaultTargetGroup +func (tr *ProxyDefaultTargetGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ProxyDefaultTargetGroup +func (tr *ProxyDefaultTargetGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ProxyDefaultTargetGroup +func (tr *ProxyDefaultTargetGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ProxyDefaultTargetGroup +func (tr *ProxyDefaultTargetGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ProxyDefaultTargetGroup +func (tr *ProxyDefaultTargetGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ProxyDefaultTargetGroup +func (tr *ProxyDefaultTargetGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ProxyDefaultTargetGroup +func (tr *ProxyDefaultTargetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ProxyDefaultTargetGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ProxyDefaultTargetGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ProxyDefaultTargetGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ProxyDefaultTargetGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_proxydefaulttargetgroup_types.go b/apis/rds/v1beta1/zz_proxydefaulttargetgroup_types.go index 7a52127c81..5817431907 100755 --- a/apis/rds/v1beta1/zz_proxydefaulttargetgroup_types.go +++ b/apis/rds/v1beta1/zz_proxydefaulttargetgroup_types.go @@ -164,13 +164,14 @@ type ProxyDefaultTargetGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ProxyDefaultTargetGroup is the Schema for the ProxyDefaultTargetGroups API. Manage an RDS DB proxy default target group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ProxyDefaultTargetGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_proxyendpoint_terraformed.go b/apis/rds/v1beta1/zz_proxyendpoint_terraformed.go new file mode 100755 index 0000000000..954fcfd086 --- /dev/null +++ b/apis/rds/v1beta1/zz_proxyendpoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ProxyEndpoint +func (mg *ProxyEndpoint) GetTerraformResourceType() string { + return "aws_db_proxy_endpoint" +} + +// GetConnectionDetailsMapping for this ProxyEndpoint +func (tr *ProxyEndpoint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ProxyEndpoint +func (tr *ProxyEndpoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ProxyEndpoint +func (tr *ProxyEndpoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ProxyEndpoint +func (tr *ProxyEndpoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ProxyEndpoint +func (tr *ProxyEndpoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ProxyEndpoint +func (tr *ProxyEndpoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ProxyEndpoint +func (tr *ProxyEndpoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ProxyEndpoint +func (tr *ProxyEndpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ProxyEndpoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ProxyEndpoint) LateInitialize(attrs []byte) (bool, error) { + params := &ProxyEndpointParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ProxyEndpoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_proxyendpoint_types.go b/apis/rds/v1beta1/zz_proxyendpoint_types.go index 400141fb49..3e47651241 100755 --- a/apis/rds/v1beta1/zz_proxyendpoint_types.go +++ b/apis/rds/v1beta1/zz_proxyendpoint_types.go @@ -160,13 +160,14 @@ type ProxyEndpointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ProxyEndpoint is the Schema for the ProxyEndpoints API. Provides an RDS DB proxy endpoint resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ProxyEndpoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_proxytarget_terraformed.go b/apis/rds/v1beta1/zz_proxytarget_terraformed.go new file mode 100755 index 0000000000..d4315a5735 --- /dev/null +++ b/apis/rds/v1beta1/zz_proxytarget_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ProxyTarget +func (mg *ProxyTarget) GetTerraformResourceType() string { + return "aws_db_proxy_target" +} + +// GetConnectionDetailsMapping for this ProxyTarget +func (tr *ProxyTarget) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ProxyTarget +func (tr *ProxyTarget) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ProxyTarget +func (tr *ProxyTarget) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ProxyTarget +func (tr *ProxyTarget) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ProxyTarget +func (tr *ProxyTarget) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ProxyTarget +func (tr *ProxyTarget) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ProxyTarget +func (tr *ProxyTarget) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ProxyTarget +func (tr *ProxyTarget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ProxyTarget using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ProxyTarget) LateInitialize(attrs []byte) (bool, error) { + params := &ProxyTargetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ProxyTarget) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_proxytarget_types.go b/apis/rds/v1beta1/zz_proxytarget_types.go index 931b3ef299..f4432dc2c7 100755 --- a/apis/rds/v1beta1/zz_proxytarget_types.go +++ b/apis/rds/v1beta1/zz_proxytarget_types.go @@ -154,13 +154,14 @@ type ProxyTargetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ProxyTarget is the Schema for the ProxyTargets API. Provides an RDS DB proxy target resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ProxyTarget struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_snapshot_terraformed.go b/apis/rds/v1beta1/zz_snapshot_terraformed.go new file mode 100755 index 0000000000..f33c9da28e --- /dev/null +++ b/apis/rds/v1beta1/zz_snapshot_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Snapshot +func (mg *Snapshot) GetTerraformResourceType() string { + return "aws_db_snapshot" +} + +// GetConnectionDetailsMapping for this Snapshot +func (tr *Snapshot) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Snapshot +func (tr *Snapshot) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Snapshot +func (tr *Snapshot) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Snapshot +func (tr *Snapshot) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Snapshot +func (tr *Snapshot) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Snapshot +func (tr *Snapshot) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Snapshot +func (tr *Snapshot) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Snapshot +func (tr *Snapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Snapshot using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Snapshot) LateInitialize(attrs []byte) (bool, error) { + params := &SnapshotParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Snapshot) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_snapshot_types.go b/apis/rds/v1beta1/zz_snapshot_types.go index 85024d0763..03757c9aeb 100755 --- a/apis/rds/v1beta1/zz_snapshot_types.go +++ b/apis/rds/v1beta1/zz_snapshot_types.go @@ -166,13 +166,14 @@ type SnapshotStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Snapshot is the Schema for the Snapshots API. Manages an RDS database instance snapshot. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Snapshot struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rds/v1beta1/zz_subnetgroup_terraformed.go b/apis/rds/v1beta1/zz_subnetgroup_terraformed.go new file mode 100755 index 0000000000..e9863830a8 --- /dev/null +++ b/apis/rds/v1beta1/zz_subnetgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SubnetGroup +func (mg *SubnetGroup) GetTerraformResourceType() string { + return "aws_db_subnet_group" +} + +// GetConnectionDetailsMapping for this SubnetGroup +func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SubnetGroup +func (tr *SubnetGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SubnetGroup +func (tr *SubnetGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SubnetGroup +func (tr *SubnetGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SubnetGroup +func (tr *SubnetGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SubnetGroup +func (tr *SubnetGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SubnetGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { + params := &SubnetGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SubnetGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rds/v1beta1/zz_subnetgroup_types.go b/apis/rds/v1beta1/zz_subnetgroup_types.go index 99bd7548ed..df2d1bc185 100755 --- a/apis/rds/v1beta1/zz_subnetgroup_types.go +++ b/apis/rds/v1beta1/zz_subnetgroup_types.go @@ -130,13 +130,14 @@ type SubnetGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SubnetGroup is the Schema for the SubnetGroups API. Provides an RDS DB subnet group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SubnetGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_authenticationprofile_terraformed.go b/apis/redshift/v1beta1/zz_authenticationprofile_terraformed.go new file mode 100755 index 0000000000..ad980ad7e7 --- /dev/null +++ b/apis/redshift/v1beta1/zz_authenticationprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AuthenticationProfile +func (mg *AuthenticationProfile) GetTerraformResourceType() string { + return "aws_redshift_authentication_profile" +} + +// GetConnectionDetailsMapping for this AuthenticationProfile +func (tr *AuthenticationProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AuthenticationProfile +func (tr *AuthenticationProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AuthenticationProfile +func (tr *AuthenticationProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AuthenticationProfile +func (tr *AuthenticationProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AuthenticationProfile +func (tr *AuthenticationProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AuthenticationProfile +func (tr *AuthenticationProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AuthenticationProfile +func (tr *AuthenticationProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AuthenticationProfile +func (tr *AuthenticationProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AuthenticationProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AuthenticationProfile) LateInitialize(attrs []byte) (bool, error) { + params := &AuthenticationProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AuthenticationProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_authenticationprofile_types.go b/apis/redshift/v1beta1/zz_authenticationprofile_types.go index 32729470b1..d0ffa9005c 100755 --- a/apis/redshift/v1beta1/zz_authenticationprofile_types.go +++ b/apis/redshift/v1beta1/zz_authenticationprofile_types.go @@ -68,13 +68,14 @@ type AuthenticationProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AuthenticationProfile is the Schema for the AuthenticationProfiles API. Creates a Redshift authentication profile // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AuthenticationProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_cluster_terraformed.go b/apis/redshift/v1beta1/zz_cluster_terraformed.go new file mode 100755 index 0000000000..6299d08911 --- /dev/null +++ b/apis/redshift/v1beta1/zz_cluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cluster +func (mg *Cluster) GetTerraformResourceType() string { + return "aws_redshift_cluster" +} + +// GetConnectionDetailsMapping for this Cluster +func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"master_password": "spec.forProvider.masterPasswordSecretRef"} +} + +// GetObservation of this Cluster +func (tr *Cluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cluster +func (tr *Cluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cluster +func (tr *Cluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cluster +func (tr *Cluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cluster +func (tr *Cluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_cluster_types.go b/apis/redshift/v1beta1/zz_cluster_types.go index f3c205a557..2251621012 100755 --- a/apis/redshift/v1beta1/zz_cluster_types.go +++ b/apis/redshift/v1beta1/zz_cluster_types.go @@ -691,13 +691,14 @@ type ClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cluster is the Schema for the Clusters API. Provides a Redshift Cluster resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_eventsubscription_terraformed.go b/apis/redshift/v1beta1/zz_eventsubscription_terraformed.go new file mode 100755 index 0000000000..54c6438517 --- /dev/null +++ b/apis/redshift/v1beta1/zz_eventsubscription_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EventSubscription +func (mg *EventSubscription) GetTerraformResourceType() string { + return "aws_redshift_event_subscription" +} + +// GetConnectionDetailsMapping for this EventSubscription +func (tr *EventSubscription) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EventSubscription +func (tr *EventSubscription) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EventSubscription +func (tr *EventSubscription) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EventSubscription +func (tr *EventSubscription) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EventSubscription +func (tr *EventSubscription) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EventSubscription +func (tr *EventSubscription) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EventSubscription +func (tr *EventSubscription) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EventSubscription +func (tr *EventSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EventSubscription using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EventSubscription) LateInitialize(attrs []byte) (bool, error) { + params := &EventSubscriptionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EventSubscription) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_eventsubscription_types.go b/apis/redshift/v1beta1/zz_eventsubscription_types.go index 5fa6b1e957..60931c39d0 100755 --- a/apis/redshift/v1beta1/zz_eventsubscription_types.go +++ b/apis/redshift/v1beta1/zz_eventsubscription_types.go @@ -169,13 +169,14 @@ type EventSubscriptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EventSubscription is the Schema for the EventSubscriptions API. Provides a Redshift event subscription resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EventSubscription struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_generated.conversion_hubs.go b/apis/redshift/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..e666df7885 --- /dev/null +++ b/apis/redshift/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AuthenticationProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Cluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EventSubscription) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HSMClientCertificate) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HSMConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ParameterGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ScheduledAction) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SnapshotCopyGrant) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SnapshotSchedule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SnapshotScheduleAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SubnetGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UsageLimit) Hub() {} diff --git a/apis/redshift/v1beta1/zz_generated_terraformed.go b/apis/redshift/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index a87dfad577..0000000000 --- a/apis/redshift/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1387 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AuthenticationProfile -func (mg *AuthenticationProfile) GetTerraformResourceType() string { - return "aws_redshift_authentication_profile" -} - -// GetConnectionDetailsMapping for this AuthenticationProfile -func (tr *AuthenticationProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AuthenticationProfile -func (tr *AuthenticationProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AuthenticationProfile -func (tr *AuthenticationProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AuthenticationProfile -func (tr *AuthenticationProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AuthenticationProfile -func (tr *AuthenticationProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AuthenticationProfile -func (tr *AuthenticationProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AuthenticationProfile -func (tr *AuthenticationProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AuthenticationProfile -func (tr *AuthenticationProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AuthenticationProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AuthenticationProfile) LateInitialize(attrs []byte) (bool, error) { - params := &AuthenticationProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AuthenticationProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Cluster -func (mg *Cluster) GetTerraformResourceType() string { - return "aws_redshift_cluster" -} - -// GetConnectionDetailsMapping for this Cluster -func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"master_password": "spec.forProvider.masterPasswordSecretRef"} -} - -// GetObservation of this Cluster -func (tr *Cluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cluster -func (tr *Cluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cluster -func (tr *Cluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cluster -func (tr *Cluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cluster -func (tr *Cluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EventSubscription -func (mg *EventSubscription) GetTerraformResourceType() string { - return "aws_redshift_event_subscription" -} - -// GetConnectionDetailsMapping for this EventSubscription -func (tr *EventSubscription) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EventSubscription -func (tr *EventSubscription) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EventSubscription -func (tr *EventSubscription) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EventSubscription -func (tr *EventSubscription) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EventSubscription -func (tr *EventSubscription) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EventSubscription -func (tr *EventSubscription) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EventSubscription -func (tr *EventSubscription) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EventSubscription -func (tr *EventSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EventSubscription using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EventSubscription) LateInitialize(attrs []byte) (bool, error) { - params := &EventSubscriptionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EventSubscription) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HSMClientCertificate -func (mg *HSMClientCertificate) GetTerraformResourceType() string { - return "aws_redshift_hsm_client_certificate" -} - -// GetConnectionDetailsMapping for this HSMClientCertificate -func (tr *HSMClientCertificate) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HSMClientCertificate -func (tr *HSMClientCertificate) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HSMClientCertificate -func (tr *HSMClientCertificate) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HSMClientCertificate -func (tr *HSMClientCertificate) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HSMClientCertificate -func (tr *HSMClientCertificate) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HSMClientCertificate -func (tr *HSMClientCertificate) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HSMClientCertificate -func (tr *HSMClientCertificate) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HSMClientCertificate -func (tr *HSMClientCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HSMClientCertificate using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HSMClientCertificate) LateInitialize(attrs []byte) (bool, error) { - params := &HSMClientCertificateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HSMClientCertificate) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HSMConfiguration -func (mg *HSMConfiguration) GetTerraformResourceType() string { - return "aws_redshift_hsm_configuration" -} - -// GetConnectionDetailsMapping for this HSMConfiguration -func (tr *HSMConfiguration) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"hsm_partition_password": "spec.forProvider.hsmPartitionPasswordSecretRef"} -} - -// GetObservation of this HSMConfiguration -func (tr *HSMConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HSMConfiguration -func (tr *HSMConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HSMConfiguration -func (tr *HSMConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HSMConfiguration -func (tr *HSMConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HSMConfiguration -func (tr *HSMConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HSMConfiguration -func (tr *HSMConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HSMConfiguration -func (tr *HSMConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HSMConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HSMConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &HSMConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HSMConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ParameterGroup -func (mg *ParameterGroup) GetTerraformResourceType() string { - return "aws_redshift_parameter_group" -} - -// GetConnectionDetailsMapping for this ParameterGroup -func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ParameterGroup -func (tr *ParameterGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ParameterGroup -func (tr *ParameterGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ParameterGroup -func (tr *ParameterGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ParameterGroup -func (tr *ParameterGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ParameterGroup -func (tr *ParameterGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ParameterGroup -func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ParameterGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ParameterGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ParameterGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ScheduledAction -func (mg *ScheduledAction) GetTerraformResourceType() string { - return "aws_redshift_scheduled_action" -} - -// GetConnectionDetailsMapping for this ScheduledAction -func (tr *ScheduledAction) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ScheduledAction -func (tr *ScheduledAction) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ScheduledAction -func (tr *ScheduledAction) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ScheduledAction -func (tr *ScheduledAction) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ScheduledAction -func (tr *ScheduledAction) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ScheduledAction -func (tr *ScheduledAction) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ScheduledAction -func (tr *ScheduledAction) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ScheduledAction -func (tr *ScheduledAction) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ScheduledAction using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ScheduledAction) LateInitialize(attrs []byte) (bool, error) { - params := &ScheduledActionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ScheduledAction) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SnapshotCopyGrant -func (mg *SnapshotCopyGrant) GetTerraformResourceType() string { - return "aws_redshift_snapshot_copy_grant" -} - -// GetConnectionDetailsMapping for this SnapshotCopyGrant -func (tr *SnapshotCopyGrant) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SnapshotCopyGrant -func (tr *SnapshotCopyGrant) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SnapshotCopyGrant -func (tr *SnapshotCopyGrant) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SnapshotCopyGrant -func (tr *SnapshotCopyGrant) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SnapshotCopyGrant -func (tr *SnapshotCopyGrant) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SnapshotCopyGrant -func (tr *SnapshotCopyGrant) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SnapshotCopyGrant -func (tr *SnapshotCopyGrant) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SnapshotCopyGrant -func (tr *SnapshotCopyGrant) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SnapshotCopyGrant using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SnapshotCopyGrant) LateInitialize(attrs []byte) (bool, error) { - params := &SnapshotCopyGrantParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SnapshotCopyGrant) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SnapshotSchedule -func (mg *SnapshotSchedule) GetTerraformResourceType() string { - return "aws_redshift_snapshot_schedule" -} - -// GetConnectionDetailsMapping for this SnapshotSchedule -func (tr *SnapshotSchedule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SnapshotSchedule -func (tr *SnapshotSchedule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SnapshotSchedule -func (tr *SnapshotSchedule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SnapshotSchedule -func (tr *SnapshotSchedule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SnapshotSchedule -func (tr *SnapshotSchedule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SnapshotSchedule -func (tr *SnapshotSchedule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SnapshotSchedule -func (tr *SnapshotSchedule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SnapshotSchedule -func (tr *SnapshotSchedule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SnapshotSchedule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SnapshotSchedule) LateInitialize(attrs []byte) (bool, error) { - params := &SnapshotScheduleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SnapshotSchedule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SnapshotScheduleAssociation -func (mg *SnapshotScheduleAssociation) GetTerraformResourceType() string { - return "aws_redshift_snapshot_schedule_association" -} - -// GetConnectionDetailsMapping for this SnapshotScheduleAssociation -func (tr *SnapshotScheduleAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SnapshotScheduleAssociation -func (tr *SnapshotScheduleAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SnapshotScheduleAssociation -func (tr *SnapshotScheduleAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SnapshotScheduleAssociation -func (tr *SnapshotScheduleAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SnapshotScheduleAssociation -func (tr *SnapshotScheduleAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SnapshotScheduleAssociation -func (tr *SnapshotScheduleAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SnapshotScheduleAssociation -func (tr *SnapshotScheduleAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SnapshotScheduleAssociation -func (tr *SnapshotScheduleAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SnapshotScheduleAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SnapshotScheduleAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &SnapshotScheduleAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SnapshotScheduleAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SubnetGroup -func (mg *SubnetGroup) GetTerraformResourceType() string { - return "aws_redshift_subnet_group" -} - -// GetConnectionDetailsMapping for this SubnetGroup -func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SubnetGroup -func (tr *SubnetGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SubnetGroup -func (tr *SubnetGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SubnetGroup -func (tr *SubnetGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SubnetGroup -func (tr *SubnetGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SubnetGroup -func (tr *SubnetGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SubnetGroup -func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SubnetGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { - params := &SubnetGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SubnetGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UsageLimit -func (mg *UsageLimit) GetTerraformResourceType() string { - return "aws_redshift_usage_limit" -} - -// GetConnectionDetailsMapping for this UsageLimit -func (tr *UsageLimit) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UsageLimit -func (tr *UsageLimit) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UsageLimit -func (tr *UsageLimit) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UsageLimit -func (tr *UsageLimit) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UsageLimit -func (tr *UsageLimit) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UsageLimit -func (tr *UsageLimit) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UsageLimit -func (tr *UsageLimit) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UsageLimit -func (tr *UsageLimit) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UsageLimit using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UsageLimit) LateInitialize(attrs []byte) (bool, error) { - params := &UsageLimitParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UsageLimit) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/redshift/v1beta1/zz_hsmclientcertificate_terraformed.go b/apis/redshift/v1beta1/zz_hsmclientcertificate_terraformed.go new file mode 100755 index 0000000000..121a3ccdc4 --- /dev/null +++ b/apis/redshift/v1beta1/zz_hsmclientcertificate_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HSMClientCertificate +func (mg *HSMClientCertificate) GetTerraformResourceType() string { + return "aws_redshift_hsm_client_certificate" +} + +// GetConnectionDetailsMapping for this HSMClientCertificate +func (tr *HSMClientCertificate) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HSMClientCertificate +func (tr *HSMClientCertificate) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HSMClientCertificate +func (tr *HSMClientCertificate) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HSMClientCertificate +func (tr *HSMClientCertificate) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HSMClientCertificate +func (tr *HSMClientCertificate) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HSMClientCertificate +func (tr *HSMClientCertificate) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HSMClientCertificate +func (tr *HSMClientCertificate) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HSMClientCertificate +func (tr *HSMClientCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HSMClientCertificate using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HSMClientCertificate) LateInitialize(attrs []byte) (bool, error) { + params := &HSMClientCertificateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HSMClientCertificate) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_hsmclientcertificate_types.go b/apis/redshift/v1beta1/zz_hsmclientcertificate_types.go index 280450373c..7860bd16f0 100755 --- a/apis/redshift/v1beta1/zz_hsmclientcertificate_types.go +++ b/apis/redshift/v1beta1/zz_hsmclientcertificate_types.go @@ -80,13 +80,14 @@ type HSMClientCertificateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HSMClientCertificate is the Schema for the HSMClientCertificates API. Creates an HSM client certificate that an Amazon Redshift cluster will use to connect to the client's HSM in order to store and retrieve the keys used to encrypt the cluster databases. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HSMClientCertificate struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_hsmconfiguration_terraformed.go b/apis/redshift/v1beta1/zz_hsmconfiguration_terraformed.go new file mode 100755 index 0000000000..471056e584 --- /dev/null +++ b/apis/redshift/v1beta1/zz_hsmconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HSMConfiguration +func (mg *HSMConfiguration) GetTerraformResourceType() string { + return "aws_redshift_hsm_configuration" +} + +// GetConnectionDetailsMapping for this HSMConfiguration +func (tr *HSMConfiguration) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"hsm_partition_password": "spec.forProvider.hsmPartitionPasswordSecretRef"} +} + +// GetObservation of this HSMConfiguration +func (tr *HSMConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HSMConfiguration +func (tr *HSMConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HSMConfiguration +func (tr *HSMConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HSMConfiguration +func (tr *HSMConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HSMConfiguration +func (tr *HSMConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HSMConfiguration +func (tr *HSMConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HSMConfiguration +func (tr *HSMConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HSMConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HSMConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &HSMConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HSMConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_hsmconfiguration_types.go b/apis/redshift/v1beta1/zz_hsmconfiguration_types.go index 97835907cb..1646c5e641 100755 --- a/apis/redshift/v1beta1/zz_hsmconfiguration_types.go +++ b/apis/redshift/v1beta1/zz_hsmconfiguration_types.go @@ -121,13 +121,14 @@ type HSMConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HSMConfiguration is the Schema for the HSMConfigurations API. Creates an HSM configuration that contains the information required by an Amazon Redshift cluster to store and use database encryption keys in a Hardware Security Module (HSM). // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HSMConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_parametergroup_terraformed.go b/apis/redshift/v1beta1/zz_parametergroup_terraformed.go new file mode 100755 index 0000000000..71e6da9229 --- /dev/null +++ b/apis/redshift/v1beta1/zz_parametergroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ParameterGroup +func (mg *ParameterGroup) GetTerraformResourceType() string { + return "aws_redshift_parameter_group" +} + +// GetConnectionDetailsMapping for this ParameterGroup +func (tr *ParameterGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ParameterGroup +func (tr *ParameterGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ParameterGroup +func (tr *ParameterGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ParameterGroup +func (tr *ParameterGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ParameterGroup +func (tr *ParameterGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ParameterGroup +func (tr *ParameterGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ParameterGroup +func (tr *ParameterGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ParameterGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ParameterGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ParameterGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ParameterGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_parametergroup_types.go b/apis/redshift/v1beta1/zz_parametergroup_types.go index ca3f73baf3..5b94b8868f 100755 --- a/apis/redshift/v1beta1/zz_parametergroup_types.go +++ b/apis/redshift/v1beta1/zz_parametergroup_types.go @@ -147,13 +147,14 @@ type ParameterGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ParameterGroup is the Schema for the ParameterGroups API. Provides a Redshift Cluster parameter group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ParameterGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_scheduledaction_terraformed.go b/apis/redshift/v1beta1/zz_scheduledaction_terraformed.go new file mode 100755 index 0000000000..194a6b0afb --- /dev/null +++ b/apis/redshift/v1beta1/zz_scheduledaction_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ScheduledAction +func (mg *ScheduledAction) GetTerraformResourceType() string { + return "aws_redshift_scheduled_action" +} + +// GetConnectionDetailsMapping for this ScheduledAction +func (tr *ScheduledAction) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ScheduledAction +func (tr *ScheduledAction) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ScheduledAction +func (tr *ScheduledAction) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ScheduledAction +func (tr *ScheduledAction) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ScheduledAction +func (tr *ScheduledAction) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ScheduledAction +func (tr *ScheduledAction) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ScheduledAction +func (tr *ScheduledAction) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ScheduledAction +func (tr *ScheduledAction) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ScheduledAction using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ScheduledAction) LateInitialize(attrs []byte) (bool, error) { + params := &ScheduledActionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ScheduledAction) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_scheduledaction_types.go b/apis/redshift/v1beta1/zz_scheduledaction_types.go index 8456b2be3e..f2171eca92 100755 --- a/apis/redshift/v1beta1/zz_scheduledaction_types.go +++ b/apis/redshift/v1beta1/zz_scheduledaction_types.go @@ -284,13 +284,14 @@ type ScheduledActionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ScheduledAction is the Schema for the ScheduledActions API. Provides a Redshift Scheduled Action resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ScheduledAction struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_snapshotcopygrant_terraformed.go b/apis/redshift/v1beta1/zz_snapshotcopygrant_terraformed.go new file mode 100755 index 0000000000..5439d4933d --- /dev/null +++ b/apis/redshift/v1beta1/zz_snapshotcopygrant_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SnapshotCopyGrant +func (mg *SnapshotCopyGrant) GetTerraformResourceType() string { + return "aws_redshift_snapshot_copy_grant" +} + +// GetConnectionDetailsMapping for this SnapshotCopyGrant +func (tr *SnapshotCopyGrant) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SnapshotCopyGrant +func (tr *SnapshotCopyGrant) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SnapshotCopyGrant +func (tr *SnapshotCopyGrant) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SnapshotCopyGrant +func (tr *SnapshotCopyGrant) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SnapshotCopyGrant +func (tr *SnapshotCopyGrant) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SnapshotCopyGrant +func (tr *SnapshotCopyGrant) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SnapshotCopyGrant +func (tr *SnapshotCopyGrant) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SnapshotCopyGrant +func (tr *SnapshotCopyGrant) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SnapshotCopyGrant using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SnapshotCopyGrant) LateInitialize(attrs []byte) (bool, error) { + params := &SnapshotCopyGrantParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SnapshotCopyGrant) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_snapshotcopygrant_types.go b/apis/redshift/v1beta1/zz_snapshotcopygrant_types.go index 3245cb92e2..7680061a5e 100755 --- a/apis/redshift/v1beta1/zz_snapshotcopygrant_types.go +++ b/apis/redshift/v1beta1/zz_snapshotcopygrant_types.go @@ -115,13 +115,14 @@ type SnapshotCopyGrantStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SnapshotCopyGrant is the Schema for the SnapshotCopyGrants API. Creates a snapshot copy grant that allows AWS Redshift to encrypt copied snapshots with a customer master key from AWS KMS in a destination region. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SnapshotCopyGrant struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_snapshotschedule_terraformed.go b/apis/redshift/v1beta1/zz_snapshotschedule_terraformed.go new file mode 100755 index 0000000000..dc94ca9f80 --- /dev/null +++ b/apis/redshift/v1beta1/zz_snapshotschedule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SnapshotSchedule +func (mg *SnapshotSchedule) GetTerraformResourceType() string { + return "aws_redshift_snapshot_schedule" +} + +// GetConnectionDetailsMapping for this SnapshotSchedule +func (tr *SnapshotSchedule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SnapshotSchedule +func (tr *SnapshotSchedule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SnapshotSchedule +func (tr *SnapshotSchedule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SnapshotSchedule +func (tr *SnapshotSchedule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SnapshotSchedule +func (tr *SnapshotSchedule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SnapshotSchedule +func (tr *SnapshotSchedule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SnapshotSchedule +func (tr *SnapshotSchedule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SnapshotSchedule +func (tr *SnapshotSchedule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SnapshotSchedule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SnapshotSchedule) LateInitialize(attrs []byte) (bool, error) { + params := &SnapshotScheduleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SnapshotSchedule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_snapshotschedule_types.go b/apis/redshift/v1beta1/zz_snapshotschedule_types.go index 1932dbf905..fb2227b554 100755 --- a/apis/redshift/v1beta1/zz_snapshotschedule_types.go +++ b/apis/redshift/v1beta1/zz_snapshotschedule_types.go @@ -110,13 +110,14 @@ type SnapshotScheduleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SnapshotSchedule is the Schema for the SnapshotSchedules API. Provides an Redshift Snapshot Schedule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SnapshotSchedule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_snapshotscheduleassociation_terraformed.go b/apis/redshift/v1beta1/zz_snapshotscheduleassociation_terraformed.go new file mode 100755 index 0000000000..86b9ca0661 --- /dev/null +++ b/apis/redshift/v1beta1/zz_snapshotscheduleassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SnapshotScheduleAssociation +func (mg *SnapshotScheduleAssociation) GetTerraformResourceType() string { + return "aws_redshift_snapshot_schedule_association" +} + +// GetConnectionDetailsMapping for this SnapshotScheduleAssociation +func (tr *SnapshotScheduleAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SnapshotScheduleAssociation +func (tr *SnapshotScheduleAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SnapshotScheduleAssociation +func (tr *SnapshotScheduleAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SnapshotScheduleAssociation +func (tr *SnapshotScheduleAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SnapshotScheduleAssociation +func (tr *SnapshotScheduleAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SnapshotScheduleAssociation +func (tr *SnapshotScheduleAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SnapshotScheduleAssociation +func (tr *SnapshotScheduleAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SnapshotScheduleAssociation +func (tr *SnapshotScheduleAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SnapshotScheduleAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SnapshotScheduleAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &SnapshotScheduleAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SnapshotScheduleAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_snapshotscheduleassociation_types.go b/apis/redshift/v1beta1/zz_snapshotscheduleassociation_types.go index 916753cb66..833e81c996 100755 --- a/apis/redshift/v1beta1/zz_snapshotscheduleassociation_types.go +++ b/apis/redshift/v1beta1/zz_snapshotscheduleassociation_types.go @@ -117,13 +117,14 @@ type SnapshotScheduleAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SnapshotScheduleAssociation is the Schema for the SnapshotScheduleAssociations API. Provides an Association Redshift Cluster and Snapshot Schedule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SnapshotScheduleAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_subnetgroup_terraformed.go b/apis/redshift/v1beta1/zz_subnetgroup_terraformed.go new file mode 100755 index 0000000000..b25941aa57 --- /dev/null +++ b/apis/redshift/v1beta1/zz_subnetgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SubnetGroup +func (mg *SubnetGroup) GetTerraformResourceType() string { + return "aws_redshift_subnet_group" +} + +// GetConnectionDetailsMapping for this SubnetGroup +func (tr *SubnetGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SubnetGroup +func (tr *SubnetGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SubnetGroup +func (tr *SubnetGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SubnetGroup +func (tr *SubnetGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SubnetGroup +func (tr *SubnetGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SubnetGroup +func (tr *SubnetGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SubnetGroup +func (tr *SubnetGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SubnetGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SubnetGroup) LateInitialize(attrs []byte) (bool, error) { + params := &SubnetGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SubnetGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_subnetgroup_types.go b/apis/redshift/v1beta1/zz_subnetgroup_types.go index 4cedcb082b..fc52e0b71a 100755 --- a/apis/redshift/v1beta1/zz_subnetgroup_types.go +++ b/apis/redshift/v1beta1/zz_subnetgroup_types.go @@ -123,13 +123,14 @@ type SubnetGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SubnetGroup is the Schema for the SubnetGroups API. Provides a Redshift Subnet Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SubnetGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshift/v1beta1/zz_usagelimit_terraformed.go b/apis/redshift/v1beta1/zz_usagelimit_terraformed.go new file mode 100755 index 0000000000..25f9044fc0 --- /dev/null +++ b/apis/redshift/v1beta1/zz_usagelimit_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UsageLimit +func (mg *UsageLimit) GetTerraformResourceType() string { + return "aws_redshift_usage_limit" +} + +// GetConnectionDetailsMapping for this UsageLimit +func (tr *UsageLimit) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UsageLimit +func (tr *UsageLimit) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UsageLimit +func (tr *UsageLimit) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UsageLimit +func (tr *UsageLimit) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UsageLimit +func (tr *UsageLimit) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UsageLimit +func (tr *UsageLimit) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UsageLimit +func (tr *UsageLimit) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UsageLimit +func (tr *UsageLimit) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UsageLimit using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UsageLimit) LateInitialize(attrs []byte) (bool, error) { + params := &UsageLimitParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UsageLimit) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshift/v1beta1/zz_usagelimit_types.go b/apis/redshift/v1beta1/zz_usagelimit_types.go index a290cd1780..520cad0676 100755 --- a/apis/redshift/v1beta1/zz_usagelimit_types.go +++ b/apis/redshift/v1beta1/zz_usagelimit_types.go @@ -158,13 +158,14 @@ type UsageLimitStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UsageLimit is the Schema for the UsageLimits API. Provides a Redshift Usage Limit resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UsageLimit struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshiftserverless/v1beta1/zz_endpointaccess_terraformed.go b/apis/redshiftserverless/v1beta1/zz_endpointaccess_terraformed.go new file mode 100755 index 0000000000..1d84433f49 --- /dev/null +++ b/apis/redshiftserverless/v1beta1/zz_endpointaccess_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EndpointAccess +func (mg *EndpointAccess) GetTerraformResourceType() string { + return "aws_redshiftserverless_endpoint_access" +} + +// GetConnectionDetailsMapping for this EndpointAccess +func (tr *EndpointAccess) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EndpointAccess +func (tr *EndpointAccess) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EndpointAccess +func (tr *EndpointAccess) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EndpointAccess +func (tr *EndpointAccess) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EndpointAccess +func (tr *EndpointAccess) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EndpointAccess +func (tr *EndpointAccess) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EndpointAccess +func (tr *EndpointAccess) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EndpointAccess +func (tr *EndpointAccess) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EndpointAccess using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EndpointAccess) LateInitialize(attrs []byte) (bool, error) { + params := &EndpointAccessParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EndpointAccess) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshiftserverless/v1beta1/zz_endpointaccess_types.go b/apis/redshiftserverless/v1beta1/zz_endpointaccess_types.go index ed5f7c79c9..0ab45c15b7 100755 --- a/apis/redshiftserverless/v1beta1/zz_endpointaccess_types.go +++ b/apis/redshiftserverless/v1beta1/zz_endpointaccess_types.go @@ -189,13 +189,14 @@ type EndpointAccessStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EndpointAccess is the Schema for the EndpointAccesss API. Provides a Redshift Serverless Endpoint Access resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EndpointAccess struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshiftserverless/v1beta1/zz_generated.conversion_hubs.go b/apis/redshiftserverless/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..de47c74d4a --- /dev/null +++ b/apis/redshiftserverless/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *EndpointAccess) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RedshiftServerlessNamespace) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResourcePolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Snapshot) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UsageLimit) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Workgroup) Hub() {} diff --git a/apis/redshiftserverless/v1beta1/zz_generated_terraformed.go b/apis/redshiftserverless/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index e85511ffc2..0000000000 --- a/apis/redshiftserverless/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,705 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this EndpointAccess -func (mg *EndpointAccess) GetTerraformResourceType() string { - return "aws_redshiftserverless_endpoint_access" -} - -// GetConnectionDetailsMapping for this EndpointAccess -func (tr *EndpointAccess) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EndpointAccess -func (tr *EndpointAccess) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EndpointAccess -func (tr *EndpointAccess) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EndpointAccess -func (tr *EndpointAccess) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EndpointAccess -func (tr *EndpointAccess) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EndpointAccess -func (tr *EndpointAccess) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EndpointAccess -func (tr *EndpointAccess) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EndpointAccess -func (tr *EndpointAccess) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EndpointAccess using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EndpointAccess) LateInitialize(attrs []byte) (bool, error) { - params := &EndpointAccessParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EndpointAccess) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RedshiftServerlessNamespace -func (mg *RedshiftServerlessNamespace) GetTerraformResourceType() string { - return "aws_redshiftserverless_namespace" -} - -// GetConnectionDetailsMapping for this RedshiftServerlessNamespace -func (tr *RedshiftServerlessNamespace) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"admin_user_password": "spec.forProvider.adminUserPasswordSecretRef", "admin_username": "spec.forProvider.adminUsernameSecretRef"} -} - -// GetObservation of this RedshiftServerlessNamespace -func (tr *RedshiftServerlessNamespace) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RedshiftServerlessNamespace -func (tr *RedshiftServerlessNamespace) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RedshiftServerlessNamespace -func (tr *RedshiftServerlessNamespace) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RedshiftServerlessNamespace -func (tr *RedshiftServerlessNamespace) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RedshiftServerlessNamespace -func (tr *RedshiftServerlessNamespace) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RedshiftServerlessNamespace -func (tr *RedshiftServerlessNamespace) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RedshiftServerlessNamespace -func (tr *RedshiftServerlessNamespace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RedshiftServerlessNamespace using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RedshiftServerlessNamespace) LateInitialize(attrs []byte) (bool, error) { - params := &RedshiftServerlessNamespaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("KMSKeyID")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RedshiftServerlessNamespace) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ResourcePolicy -func (mg *ResourcePolicy) GetTerraformResourceType() string { - return "aws_redshiftserverless_resource_policy" -} - -// GetConnectionDetailsMapping for this ResourcePolicy -func (tr *ResourcePolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResourcePolicy -func (tr *ResourcePolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResourcePolicy -func (tr *ResourcePolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResourcePolicy -func (tr *ResourcePolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResourcePolicy -func (tr *ResourcePolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResourcePolicy -func (tr *ResourcePolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResourcePolicy -func (tr *ResourcePolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResourcePolicy -func (tr *ResourcePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResourcePolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResourcePolicy) LateInitialize(attrs []byte) (bool, error) { - params := &ResourcePolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResourcePolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Snapshot -func (mg *Snapshot) GetTerraformResourceType() string { - return "aws_redshiftserverless_snapshot" -} - -// GetConnectionDetailsMapping for this Snapshot -func (tr *Snapshot) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Snapshot -func (tr *Snapshot) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Snapshot -func (tr *Snapshot) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Snapshot -func (tr *Snapshot) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Snapshot -func (tr *Snapshot) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Snapshot -func (tr *Snapshot) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Snapshot -func (tr *Snapshot) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Snapshot -func (tr *Snapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Snapshot using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Snapshot) LateInitialize(attrs []byte) (bool, error) { - params := &SnapshotParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Snapshot) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UsageLimit -func (mg *UsageLimit) GetTerraformResourceType() string { - return "aws_redshiftserverless_usage_limit" -} - -// GetConnectionDetailsMapping for this UsageLimit -func (tr *UsageLimit) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UsageLimit -func (tr *UsageLimit) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UsageLimit -func (tr *UsageLimit) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UsageLimit -func (tr *UsageLimit) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UsageLimit -func (tr *UsageLimit) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UsageLimit -func (tr *UsageLimit) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UsageLimit -func (tr *UsageLimit) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UsageLimit -func (tr *UsageLimit) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UsageLimit using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UsageLimit) LateInitialize(attrs []byte) (bool, error) { - params := &UsageLimitParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UsageLimit) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Workgroup -func (mg *Workgroup) GetTerraformResourceType() string { - return "aws_redshiftserverless_workgroup" -} - -// GetConnectionDetailsMapping for this Workgroup -func (tr *Workgroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Workgroup -func (tr *Workgroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Workgroup -func (tr *Workgroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Workgroup -func (tr *Workgroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Workgroup -func (tr *Workgroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Workgroup -func (tr *Workgroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Workgroup -func (tr *Workgroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Workgroup -func (tr *Workgroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Workgroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Workgroup) LateInitialize(attrs []byte) (bool, error) { - params := &WorkgroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("ConfigParameter")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Workgroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/redshiftserverless/v1beta1/zz_redshiftserverlessnamespace_terraformed.go b/apis/redshiftserverless/v1beta1/zz_redshiftserverlessnamespace_terraformed.go new file mode 100755 index 0000000000..b95e4ed030 --- /dev/null +++ b/apis/redshiftserverless/v1beta1/zz_redshiftserverlessnamespace_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RedshiftServerlessNamespace +func (mg *RedshiftServerlessNamespace) GetTerraformResourceType() string { + return "aws_redshiftserverless_namespace" +} + +// GetConnectionDetailsMapping for this RedshiftServerlessNamespace +func (tr *RedshiftServerlessNamespace) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"admin_user_password": "spec.forProvider.adminUserPasswordSecretRef", "admin_username": "spec.forProvider.adminUsernameSecretRef"} +} + +// GetObservation of this RedshiftServerlessNamespace +func (tr *RedshiftServerlessNamespace) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RedshiftServerlessNamespace +func (tr *RedshiftServerlessNamespace) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RedshiftServerlessNamespace +func (tr *RedshiftServerlessNamespace) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RedshiftServerlessNamespace +func (tr *RedshiftServerlessNamespace) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RedshiftServerlessNamespace +func (tr *RedshiftServerlessNamespace) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RedshiftServerlessNamespace +func (tr *RedshiftServerlessNamespace) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RedshiftServerlessNamespace +func (tr *RedshiftServerlessNamespace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RedshiftServerlessNamespace using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RedshiftServerlessNamespace) LateInitialize(attrs []byte) (bool, error) { + params := &RedshiftServerlessNamespaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("KMSKeyID")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RedshiftServerlessNamespace) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshiftserverless/v1beta1/zz_redshiftserverlessnamespace_types.go b/apis/redshiftserverless/v1beta1/zz_redshiftserverlessnamespace_types.go index 8ffb79d45c..f7decb7145 100755 --- a/apis/redshiftserverless/v1beta1/zz_redshiftserverlessnamespace_types.go +++ b/apis/redshiftserverless/v1beta1/zz_redshiftserverlessnamespace_types.go @@ -205,13 +205,14 @@ type RedshiftServerlessNamespaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RedshiftServerlessNamespace is the Schema for the RedshiftServerlessNamespaces API. Provides a Redshift Serverless Namespace resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RedshiftServerlessNamespace struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshiftserverless/v1beta1/zz_resourcepolicy_terraformed.go b/apis/redshiftserverless/v1beta1/zz_resourcepolicy_terraformed.go new file mode 100755 index 0000000000..e736b16dad --- /dev/null +++ b/apis/redshiftserverless/v1beta1/zz_resourcepolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResourcePolicy +func (mg *ResourcePolicy) GetTerraformResourceType() string { + return "aws_redshiftserverless_resource_policy" +} + +// GetConnectionDetailsMapping for this ResourcePolicy +func (tr *ResourcePolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResourcePolicy +func (tr *ResourcePolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResourcePolicy +func (tr *ResourcePolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResourcePolicy +func (tr *ResourcePolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResourcePolicy +func (tr *ResourcePolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResourcePolicy +func (tr *ResourcePolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResourcePolicy +func (tr *ResourcePolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResourcePolicy +func (tr *ResourcePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResourcePolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResourcePolicy) LateInitialize(attrs []byte) (bool, error) { + params := &ResourcePolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResourcePolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshiftserverless/v1beta1/zz_resourcepolicy_types.go b/apis/redshiftserverless/v1beta1/zz_resourcepolicy_types.go index 9238b42470..6b9013e486 100755 --- a/apis/redshiftserverless/v1beta1/zz_resourcepolicy_types.go +++ b/apis/redshiftserverless/v1beta1/zz_resourcepolicy_types.go @@ -98,13 +98,14 @@ type ResourcePolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResourcePolicy is the Schema for the ResourcePolicys API. Provides a Redshift Serverless Resource Policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResourcePolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshiftserverless/v1beta1/zz_snapshot_terraformed.go b/apis/redshiftserverless/v1beta1/zz_snapshot_terraformed.go new file mode 100755 index 0000000000..adb5436fb0 --- /dev/null +++ b/apis/redshiftserverless/v1beta1/zz_snapshot_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Snapshot +func (mg *Snapshot) GetTerraformResourceType() string { + return "aws_redshiftserverless_snapshot" +} + +// GetConnectionDetailsMapping for this Snapshot +func (tr *Snapshot) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Snapshot +func (tr *Snapshot) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Snapshot +func (tr *Snapshot) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Snapshot +func (tr *Snapshot) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Snapshot +func (tr *Snapshot) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Snapshot +func (tr *Snapshot) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Snapshot +func (tr *Snapshot) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Snapshot +func (tr *Snapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Snapshot using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Snapshot) LateInitialize(attrs []byte) (bool, error) { + params := &SnapshotParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Snapshot) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshiftserverless/v1beta1/zz_snapshot_types.go b/apis/redshiftserverless/v1beta1/zz_snapshot_types.go index bde37d8f03..7672397942 100755 --- a/apis/redshiftserverless/v1beta1/zz_snapshot_types.go +++ b/apis/redshiftserverless/v1beta1/zz_snapshot_types.go @@ -121,13 +121,14 @@ type SnapshotStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Snapshot is the Schema for the Snapshots API. Provides a Redshift Serverless Snapshot resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Snapshot struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshiftserverless/v1beta1/zz_usagelimit_terraformed.go b/apis/redshiftserverless/v1beta1/zz_usagelimit_terraformed.go new file mode 100755 index 0000000000..aaa4efdf37 --- /dev/null +++ b/apis/redshiftserverless/v1beta1/zz_usagelimit_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UsageLimit +func (mg *UsageLimit) GetTerraformResourceType() string { + return "aws_redshiftserverless_usage_limit" +} + +// GetConnectionDetailsMapping for this UsageLimit +func (tr *UsageLimit) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UsageLimit +func (tr *UsageLimit) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UsageLimit +func (tr *UsageLimit) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UsageLimit +func (tr *UsageLimit) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UsageLimit +func (tr *UsageLimit) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UsageLimit +func (tr *UsageLimit) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UsageLimit +func (tr *UsageLimit) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UsageLimit +func (tr *UsageLimit) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UsageLimit using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UsageLimit) LateInitialize(attrs []byte) (bool, error) { + params := &UsageLimitParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UsageLimit) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshiftserverless/v1beta1/zz_usagelimit_types.go b/apis/redshiftserverless/v1beta1/zz_usagelimit_types.go index ddf04b1400..898e06812c 100755 --- a/apis/redshiftserverless/v1beta1/zz_usagelimit_types.go +++ b/apis/redshiftserverless/v1beta1/zz_usagelimit_types.go @@ -131,13 +131,14 @@ type UsageLimitStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UsageLimit is the Schema for the UsageLimits API. Provides a Redshift Serverless Usage Limit resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UsageLimit struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/redshiftserverless/v1beta1/zz_workgroup_terraformed.go b/apis/redshiftserverless/v1beta1/zz_workgroup_terraformed.go new file mode 100755 index 0000000000..9bbbf134b7 --- /dev/null +++ b/apis/redshiftserverless/v1beta1/zz_workgroup_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Workgroup +func (mg *Workgroup) GetTerraformResourceType() string { + return "aws_redshiftserverless_workgroup" +} + +// GetConnectionDetailsMapping for this Workgroup +func (tr *Workgroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Workgroup +func (tr *Workgroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Workgroup +func (tr *Workgroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Workgroup +func (tr *Workgroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Workgroup +func (tr *Workgroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Workgroup +func (tr *Workgroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Workgroup +func (tr *Workgroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Workgroup +func (tr *Workgroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Workgroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Workgroup) LateInitialize(attrs []byte) (bool, error) { + params := &WorkgroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("ConfigParameter")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Workgroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/redshiftserverless/v1beta1/zz_workgroup_types.go b/apis/redshiftserverless/v1beta1/zz_workgroup_types.go index edf39609e9..e11f48fda2 100755 --- a/apis/redshiftserverless/v1beta1/zz_workgroup_types.go +++ b/apis/redshiftserverless/v1beta1/zz_workgroup_types.go @@ -290,13 +290,14 @@ type WorkgroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Workgroup is the Schema for the Workgroups API. Provides a Redshift Serverless Workgroup resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Workgroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/resourcegroups/v1beta1/zz_generated.conversion_hubs.go b/apis/resourcegroups/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..242f4effde --- /dev/null +++ b/apis/resourcegroups/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Group) Hub() {} diff --git a/apis/resourcegroups/v1beta1/zz_generated_terraformed.go b/apis/resourcegroups/v1beta1/zz_group_terraformed.go similarity index 100% rename from apis/resourcegroups/v1beta1/zz_generated_terraformed.go rename to apis/resourcegroups/v1beta1/zz_group_terraformed.go diff --git a/apis/resourcegroups/v1beta1/zz_group_types.go b/apis/resourcegroups/v1beta1/zz_group_types.go index bde4b54b8c..4d7aae4318 100755 --- a/apis/resourcegroups/v1beta1/zz_group_types.go +++ b/apis/resourcegroups/v1beta1/zz_group_types.go @@ -194,13 +194,14 @@ type GroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Group is the Schema for the Groups API. Provides a Resource Group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Group struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rolesanywhere/v1beta1/zz_generated.conversion_hubs.go b/apis/rolesanywhere/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..0f5ae3d5d5 --- /dev/null +++ b/apis/rolesanywhere/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Profile) Hub() {} diff --git a/apis/rolesanywhere/v1beta1/zz_generated_terraformed.go b/apis/rolesanywhere/v1beta1/zz_profile_terraformed.go similarity index 100% rename from apis/rolesanywhere/v1beta1/zz_generated_terraformed.go rename to apis/rolesanywhere/v1beta1/zz_profile_terraformed.go diff --git a/apis/rolesanywhere/v1beta1/zz_profile_types.go b/apis/rolesanywhere/v1beta1/zz_profile_types.go index eae88f5257..17592586ef 100755 --- a/apis/rolesanywhere/v1beta1/zz_profile_types.go +++ b/apis/rolesanywhere/v1beta1/zz_profile_types.go @@ -174,13 +174,14 @@ type ProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Profile is the Schema for the Profiles API. Provides a Roles Anywhere Profile resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Profile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53/v1beta1/zz_delegationset_terraformed.go b/apis/route53/v1beta1/zz_delegationset_terraformed.go new file mode 100755 index 0000000000..0e00038dcf --- /dev/null +++ b/apis/route53/v1beta1/zz_delegationset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DelegationSet +func (mg *DelegationSet) GetTerraformResourceType() string { + return "aws_route53_delegation_set" +} + +// GetConnectionDetailsMapping for this DelegationSet +func (tr *DelegationSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DelegationSet +func (tr *DelegationSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DelegationSet +func (tr *DelegationSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DelegationSet +func (tr *DelegationSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DelegationSet +func (tr *DelegationSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DelegationSet +func (tr *DelegationSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DelegationSet +func (tr *DelegationSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DelegationSet +func (tr *DelegationSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DelegationSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DelegationSet) LateInitialize(attrs []byte) (bool, error) { + params := &DelegationSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DelegationSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53/v1beta1/zz_delegationset_types.go b/apis/route53/v1beta1/zz_delegationset_types.go index 02d5f64e2d..96ba89fb06 100755 --- a/apis/route53/v1beta1/zz_delegationset_types.go +++ b/apis/route53/v1beta1/zz_delegationset_types.go @@ -78,13 +78,14 @@ type DelegationSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DelegationSet is the Schema for the DelegationSets API. Provides a Route53 Delegation Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DelegationSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53/v1beta1/zz_generated.conversion_hubs.go b/apis/route53/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..56305a44df --- /dev/null +++ b/apis/route53/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,41 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *DelegationSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HealthCheck) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *HostedZoneDNSSEC) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Record) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResolverConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TrafficPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TrafficPolicyInstance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VPCAssociationAuthorization) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Zone) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ZoneAssociation) Hub() {} diff --git a/apis/route53/v1beta1/zz_generated_terraformed.go b/apis/route53/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 57d52d097e..0000000000 --- a/apis/route53/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1159 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this DelegationSet -func (mg *DelegationSet) GetTerraformResourceType() string { - return "aws_route53_delegation_set" -} - -// GetConnectionDetailsMapping for this DelegationSet -func (tr *DelegationSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DelegationSet -func (tr *DelegationSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DelegationSet -func (tr *DelegationSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DelegationSet -func (tr *DelegationSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DelegationSet -func (tr *DelegationSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DelegationSet -func (tr *DelegationSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DelegationSet -func (tr *DelegationSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DelegationSet -func (tr *DelegationSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DelegationSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DelegationSet) LateInitialize(attrs []byte) (bool, error) { - params := &DelegationSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DelegationSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HealthCheck -func (mg *HealthCheck) GetTerraformResourceType() string { - return "aws_route53_health_check" -} - -// GetConnectionDetailsMapping for this HealthCheck -func (tr *HealthCheck) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HealthCheck -func (tr *HealthCheck) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HealthCheck -func (tr *HealthCheck) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HealthCheck -func (tr *HealthCheck) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HealthCheck -func (tr *HealthCheck) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HealthCheck -func (tr *HealthCheck) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HealthCheck -func (tr *HealthCheck) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HealthCheck -func (tr *HealthCheck) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HealthCheck using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HealthCheck) LateInitialize(attrs []byte) (bool, error) { - params := &HealthCheckParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HealthCheck) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this HostedZoneDNSSEC -func (mg *HostedZoneDNSSEC) GetTerraformResourceType() string { - return "aws_route53_hosted_zone_dnssec" -} - -// GetConnectionDetailsMapping for this HostedZoneDNSSEC -func (tr *HostedZoneDNSSEC) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HostedZoneDNSSEC -func (tr *HostedZoneDNSSEC) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HostedZoneDNSSEC -func (tr *HostedZoneDNSSEC) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HostedZoneDNSSEC -func (tr *HostedZoneDNSSEC) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HostedZoneDNSSEC -func (tr *HostedZoneDNSSEC) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HostedZoneDNSSEC -func (tr *HostedZoneDNSSEC) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HostedZoneDNSSEC -func (tr *HostedZoneDNSSEC) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HostedZoneDNSSEC -func (tr *HostedZoneDNSSEC) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HostedZoneDNSSEC using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HostedZoneDNSSEC) LateInitialize(attrs []byte) (bool, error) { - params := &HostedZoneDNSSECParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HostedZoneDNSSEC) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Record -func (mg *Record) GetTerraformResourceType() string { - return "aws_route53_record" -} - -// GetConnectionDetailsMapping for this Record -func (tr *Record) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Record -func (tr *Record) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Record -func (tr *Record) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Record -func (tr *Record) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Record -func (tr *Record) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Record -func (tr *Record) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Record -func (tr *Record) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Record -func (tr *Record) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Record using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Record) LateInitialize(attrs []byte) (bool, error) { - params := &RecordParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Record) GetTerraformSchemaVersion() int { - return 2 -} - -// GetTerraformResourceType returns Terraform resource type for this ResolverConfig -func (mg *ResolverConfig) GetTerraformResourceType() string { - return "aws_route53_resolver_config" -} - -// GetConnectionDetailsMapping for this ResolverConfig -func (tr *ResolverConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResolverConfig -func (tr *ResolverConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResolverConfig -func (tr *ResolverConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResolverConfig -func (tr *ResolverConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResolverConfig -func (tr *ResolverConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResolverConfig -func (tr *ResolverConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResolverConfig -func (tr *ResolverConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResolverConfig -func (tr *ResolverConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResolverConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResolverConfig) LateInitialize(attrs []byte) (bool, error) { - params := &ResolverConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResolverConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TrafficPolicy -func (mg *TrafficPolicy) GetTerraformResourceType() string { - return "aws_route53_traffic_policy" -} - -// GetConnectionDetailsMapping for this TrafficPolicy -func (tr *TrafficPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TrafficPolicy -func (tr *TrafficPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TrafficPolicy -func (tr *TrafficPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TrafficPolicy -func (tr *TrafficPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TrafficPolicy -func (tr *TrafficPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TrafficPolicy -func (tr *TrafficPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TrafficPolicy -func (tr *TrafficPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TrafficPolicy -func (tr *TrafficPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TrafficPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TrafficPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &TrafficPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TrafficPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TrafficPolicyInstance -func (mg *TrafficPolicyInstance) GetTerraformResourceType() string { - return "aws_route53_traffic_policy_instance" -} - -// GetConnectionDetailsMapping for this TrafficPolicyInstance -func (tr *TrafficPolicyInstance) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TrafficPolicyInstance -func (tr *TrafficPolicyInstance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TrafficPolicyInstance -func (tr *TrafficPolicyInstance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TrafficPolicyInstance -func (tr *TrafficPolicyInstance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TrafficPolicyInstance -func (tr *TrafficPolicyInstance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TrafficPolicyInstance -func (tr *TrafficPolicyInstance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TrafficPolicyInstance -func (tr *TrafficPolicyInstance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TrafficPolicyInstance -func (tr *TrafficPolicyInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TrafficPolicyInstance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TrafficPolicyInstance) LateInitialize(attrs []byte) (bool, error) { - params := &TrafficPolicyInstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TrafficPolicyInstance) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VPCAssociationAuthorization -func (mg *VPCAssociationAuthorization) GetTerraformResourceType() string { - return "aws_route53_vpc_association_authorization" -} - -// GetConnectionDetailsMapping for this VPCAssociationAuthorization -func (tr *VPCAssociationAuthorization) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VPCAssociationAuthorization -func (tr *VPCAssociationAuthorization) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VPCAssociationAuthorization -func (tr *VPCAssociationAuthorization) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VPCAssociationAuthorization -func (tr *VPCAssociationAuthorization) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VPCAssociationAuthorization -func (tr *VPCAssociationAuthorization) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VPCAssociationAuthorization -func (tr *VPCAssociationAuthorization) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VPCAssociationAuthorization -func (tr *VPCAssociationAuthorization) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VPCAssociationAuthorization -func (tr *VPCAssociationAuthorization) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VPCAssociationAuthorization using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VPCAssociationAuthorization) LateInitialize(attrs []byte) (bool, error) { - params := &VPCAssociationAuthorizationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VPCAssociationAuthorization) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Zone -func (mg *Zone) GetTerraformResourceType() string { - return "aws_route53_zone" -} - -// GetConnectionDetailsMapping for this Zone -func (tr *Zone) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Zone -func (tr *Zone) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Zone -func (tr *Zone) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Zone -func (tr *Zone) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Zone -func (tr *Zone) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Zone -func (tr *Zone) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Zone -func (tr *Zone) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Zone -func (tr *Zone) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Zone using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Zone) LateInitialize(attrs []byte) (bool, error) { - params := &ZoneParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Zone) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ZoneAssociation -func (mg *ZoneAssociation) GetTerraformResourceType() string { - return "aws_route53_zone_association" -} - -// GetConnectionDetailsMapping for this ZoneAssociation -func (tr *ZoneAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ZoneAssociation -func (tr *ZoneAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ZoneAssociation -func (tr *ZoneAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ZoneAssociation -func (tr *ZoneAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ZoneAssociation -func (tr *ZoneAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ZoneAssociation -func (tr *ZoneAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ZoneAssociation -func (tr *ZoneAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ZoneAssociation -func (tr *ZoneAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ZoneAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ZoneAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &ZoneAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ZoneAssociation) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/route53/v1beta1/zz_healthcheck_terraformed.go b/apis/route53/v1beta1/zz_healthcheck_terraformed.go new file mode 100755 index 0000000000..44571b3ce2 --- /dev/null +++ b/apis/route53/v1beta1/zz_healthcheck_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HealthCheck +func (mg *HealthCheck) GetTerraformResourceType() string { + return "aws_route53_health_check" +} + +// GetConnectionDetailsMapping for this HealthCheck +func (tr *HealthCheck) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HealthCheck +func (tr *HealthCheck) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HealthCheck +func (tr *HealthCheck) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HealthCheck +func (tr *HealthCheck) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HealthCheck +func (tr *HealthCheck) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HealthCheck +func (tr *HealthCheck) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HealthCheck +func (tr *HealthCheck) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HealthCheck +func (tr *HealthCheck) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HealthCheck using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HealthCheck) LateInitialize(attrs []byte) (bool, error) { + params := &HealthCheckParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HealthCheck) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53/v1beta1/zz_healthcheck_types.go b/apis/route53/v1beta1/zz_healthcheck_types.go index c68fcfdc21..981ca3d026 100755 --- a/apis/route53/v1beta1/zz_healthcheck_types.go +++ b/apis/route53/v1beta1/zz_healthcheck_types.go @@ -305,13 +305,14 @@ type HealthCheckStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HealthCheck is the Schema for the HealthChecks API. Provides a Route53 health check. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HealthCheck struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53/v1beta1/zz_hostedzonednssec_terraformed.go b/apis/route53/v1beta1/zz_hostedzonednssec_terraformed.go new file mode 100755 index 0000000000..53c222c5c0 --- /dev/null +++ b/apis/route53/v1beta1/zz_hostedzonednssec_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HostedZoneDNSSEC +func (mg *HostedZoneDNSSEC) GetTerraformResourceType() string { + return "aws_route53_hosted_zone_dnssec" +} + +// GetConnectionDetailsMapping for this HostedZoneDNSSEC +func (tr *HostedZoneDNSSEC) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HostedZoneDNSSEC +func (tr *HostedZoneDNSSEC) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HostedZoneDNSSEC +func (tr *HostedZoneDNSSEC) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HostedZoneDNSSEC +func (tr *HostedZoneDNSSEC) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HostedZoneDNSSEC +func (tr *HostedZoneDNSSEC) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HostedZoneDNSSEC +func (tr *HostedZoneDNSSEC) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HostedZoneDNSSEC +func (tr *HostedZoneDNSSEC) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HostedZoneDNSSEC +func (tr *HostedZoneDNSSEC) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HostedZoneDNSSEC using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HostedZoneDNSSEC) LateInitialize(attrs []byte) (bool, error) { + params := &HostedZoneDNSSECParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HostedZoneDNSSEC) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53/v1beta1/zz_hostedzonednssec_types.go b/apis/route53/v1beta1/zz_hostedzonednssec_types.go index fa5f653453..e7cd43f2f3 100755 --- a/apis/route53/v1beta1/zz_hostedzonednssec_types.go +++ b/apis/route53/v1beta1/zz_hostedzonednssec_types.go @@ -96,13 +96,14 @@ type HostedZoneDNSSECStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HostedZoneDNSSEC is the Schema for the HostedZoneDNSSECs API. Manages Route 53 Hosted Zone DNSSEC // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HostedZoneDNSSEC struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53/v1beta1/zz_record_terraformed.go b/apis/route53/v1beta1/zz_record_terraformed.go new file mode 100755 index 0000000000..78595bb708 --- /dev/null +++ b/apis/route53/v1beta1/zz_record_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Record +func (mg *Record) GetTerraformResourceType() string { + return "aws_route53_record" +} + +// GetConnectionDetailsMapping for this Record +func (tr *Record) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Record +func (tr *Record) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Record +func (tr *Record) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Record +func (tr *Record) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Record +func (tr *Record) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Record +func (tr *Record) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Record +func (tr *Record) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Record +func (tr *Record) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Record using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Record) LateInitialize(attrs []byte) (bool, error) { + params := &RecordParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Record) GetTerraformSchemaVersion() int { + return 2 +} diff --git a/apis/route53/v1beta1/zz_record_types.go b/apis/route53/v1beta1/zz_record_types.go index 6742a9dee3..00db112889 100755 --- a/apis/route53/v1beta1/zz_record_types.go +++ b/apis/route53/v1beta1/zz_record_types.go @@ -414,13 +414,14 @@ type RecordStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Record is the Schema for the Records API. Provides a Route53 record resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Record struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53/v1beta1/zz_resolverconfig_terraformed.go b/apis/route53/v1beta1/zz_resolverconfig_terraformed.go new file mode 100755 index 0000000000..51023f03f3 --- /dev/null +++ b/apis/route53/v1beta1/zz_resolverconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResolverConfig +func (mg *ResolverConfig) GetTerraformResourceType() string { + return "aws_route53_resolver_config" +} + +// GetConnectionDetailsMapping for this ResolverConfig +func (tr *ResolverConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResolverConfig +func (tr *ResolverConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResolverConfig +func (tr *ResolverConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResolverConfig +func (tr *ResolverConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResolverConfig +func (tr *ResolverConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResolverConfig +func (tr *ResolverConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResolverConfig +func (tr *ResolverConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResolverConfig +func (tr *ResolverConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResolverConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResolverConfig) LateInitialize(attrs []byte) (bool, error) { + params := &ResolverConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResolverConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53/v1beta1/zz_resolverconfig_types.go b/apis/route53/v1beta1/zz_resolverconfig_types.go index f8d0d43c51..e4781b0509 100755 --- a/apis/route53/v1beta1/zz_resolverconfig_types.go +++ b/apis/route53/v1beta1/zz_resolverconfig_types.go @@ -101,13 +101,14 @@ type ResolverConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResolverConfig is the Schema for the ResolverConfigs API. Provides a Route 53 Resolver config resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResolverConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53/v1beta1/zz_trafficpolicy_terraformed.go b/apis/route53/v1beta1/zz_trafficpolicy_terraformed.go new file mode 100755 index 0000000000..027ddb8939 --- /dev/null +++ b/apis/route53/v1beta1/zz_trafficpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TrafficPolicy +func (mg *TrafficPolicy) GetTerraformResourceType() string { + return "aws_route53_traffic_policy" +} + +// GetConnectionDetailsMapping for this TrafficPolicy +func (tr *TrafficPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TrafficPolicy +func (tr *TrafficPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TrafficPolicy +func (tr *TrafficPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TrafficPolicy +func (tr *TrafficPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TrafficPolicy +func (tr *TrafficPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TrafficPolicy +func (tr *TrafficPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TrafficPolicy +func (tr *TrafficPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TrafficPolicy +func (tr *TrafficPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TrafficPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TrafficPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &TrafficPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TrafficPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53/v1beta1/zz_trafficpolicy_types.go b/apis/route53/v1beta1/zz_trafficpolicy_types.go index 90bf33d384..e69787f112 100755 --- a/apis/route53/v1beta1/zz_trafficpolicy_types.go +++ b/apis/route53/v1beta1/zz_trafficpolicy_types.go @@ -94,13 +94,14 @@ type TrafficPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TrafficPolicy is the Schema for the TrafficPolicys API. Manages a Route53 Traffic Policy // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TrafficPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53/v1beta1/zz_trafficpolicyinstance_terraformed.go b/apis/route53/v1beta1/zz_trafficpolicyinstance_terraformed.go new file mode 100755 index 0000000000..21cb9232bb --- /dev/null +++ b/apis/route53/v1beta1/zz_trafficpolicyinstance_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TrafficPolicyInstance +func (mg *TrafficPolicyInstance) GetTerraformResourceType() string { + return "aws_route53_traffic_policy_instance" +} + +// GetConnectionDetailsMapping for this TrafficPolicyInstance +func (tr *TrafficPolicyInstance) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TrafficPolicyInstance +func (tr *TrafficPolicyInstance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TrafficPolicyInstance +func (tr *TrafficPolicyInstance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TrafficPolicyInstance +func (tr *TrafficPolicyInstance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TrafficPolicyInstance +func (tr *TrafficPolicyInstance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TrafficPolicyInstance +func (tr *TrafficPolicyInstance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TrafficPolicyInstance +func (tr *TrafficPolicyInstance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TrafficPolicyInstance +func (tr *TrafficPolicyInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TrafficPolicyInstance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TrafficPolicyInstance) LateInitialize(attrs []byte) (bool, error) { + params := &TrafficPolicyInstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TrafficPolicyInstance) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53/v1beta1/zz_trafficpolicyinstance_types.go b/apis/route53/v1beta1/zz_trafficpolicyinstance_types.go index b8bfb917a1..607c67da10 100755 --- a/apis/route53/v1beta1/zz_trafficpolicyinstance_types.go +++ b/apis/route53/v1beta1/zz_trafficpolicyinstance_types.go @@ -144,13 +144,14 @@ type TrafficPolicyInstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TrafficPolicyInstance is the Schema for the TrafficPolicyInstances API. Provides a Route53 traffic policy instance resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TrafficPolicyInstance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53/v1beta1/zz_vpcassociationauthorization_terraformed.go b/apis/route53/v1beta1/zz_vpcassociationauthorization_terraformed.go new file mode 100755 index 0000000000..38ee41ab99 --- /dev/null +++ b/apis/route53/v1beta1/zz_vpcassociationauthorization_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VPCAssociationAuthorization +func (mg *VPCAssociationAuthorization) GetTerraformResourceType() string { + return "aws_route53_vpc_association_authorization" +} + +// GetConnectionDetailsMapping for this VPCAssociationAuthorization +func (tr *VPCAssociationAuthorization) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VPCAssociationAuthorization +func (tr *VPCAssociationAuthorization) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VPCAssociationAuthorization +func (tr *VPCAssociationAuthorization) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VPCAssociationAuthorization +func (tr *VPCAssociationAuthorization) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VPCAssociationAuthorization +func (tr *VPCAssociationAuthorization) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VPCAssociationAuthorization +func (tr *VPCAssociationAuthorization) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VPCAssociationAuthorization +func (tr *VPCAssociationAuthorization) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VPCAssociationAuthorization +func (tr *VPCAssociationAuthorization) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VPCAssociationAuthorization using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VPCAssociationAuthorization) LateInitialize(attrs []byte) (bool, error) { + params := &VPCAssociationAuthorizationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VPCAssociationAuthorization) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53/v1beta1/zz_vpcassociationauthorization_types.go b/apis/route53/v1beta1/zz_vpcassociationauthorization_types.go index ffe8701e6b..892f1dc378 100755 --- a/apis/route53/v1beta1/zz_vpcassociationauthorization_types.go +++ b/apis/route53/v1beta1/zz_vpcassociationauthorization_types.go @@ -124,13 +124,14 @@ type VPCAssociationAuthorizationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VPCAssociationAuthorization is the Schema for the VPCAssociationAuthorizations API. Authorizes a VPC in a different account to be associated with a local Route53 Hosted Zone // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VPCAssociationAuthorization struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53/v1beta1/zz_zone_terraformed.go b/apis/route53/v1beta1/zz_zone_terraformed.go new file mode 100755 index 0000000000..81da86510c --- /dev/null +++ b/apis/route53/v1beta1/zz_zone_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Zone +func (mg *Zone) GetTerraformResourceType() string { + return "aws_route53_zone" +} + +// GetConnectionDetailsMapping for this Zone +func (tr *Zone) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Zone +func (tr *Zone) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Zone +func (tr *Zone) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Zone +func (tr *Zone) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Zone +func (tr *Zone) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Zone +func (tr *Zone) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Zone +func (tr *Zone) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Zone +func (tr *Zone) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Zone using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Zone) LateInitialize(attrs []byte) (bool, error) { + params := &ZoneParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Zone) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53/v1beta1/zz_zone_types.go b/apis/route53/v1beta1/zz_zone_types.go index 506465026d..36458df387 100755 --- a/apis/route53/v1beta1/zz_zone_types.go +++ b/apis/route53/v1beta1/zz_zone_types.go @@ -201,13 +201,14 @@ type ZoneStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Zone is the Schema for the Zones API. Manages a Route53 Hosted Zone // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Zone struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53/v1beta1/zz_zoneassociation_terraformed.go b/apis/route53/v1beta1/zz_zoneassociation_terraformed.go new file mode 100755 index 0000000000..75c56c2635 --- /dev/null +++ b/apis/route53/v1beta1/zz_zoneassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ZoneAssociation +func (mg *ZoneAssociation) GetTerraformResourceType() string { + return "aws_route53_zone_association" +} + +// GetConnectionDetailsMapping for this ZoneAssociation +func (tr *ZoneAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ZoneAssociation +func (tr *ZoneAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ZoneAssociation +func (tr *ZoneAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ZoneAssociation +func (tr *ZoneAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ZoneAssociation +func (tr *ZoneAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ZoneAssociation +func (tr *ZoneAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ZoneAssociation +func (tr *ZoneAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ZoneAssociation +func (tr *ZoneAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ZoneAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ZoneAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &ZoneAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ZoneAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53/v1beta1/zz_zoneassociation_types.go b/apis/route53/v1beta1/zz_zoneassociation_types.go index 6993e6489d..cd38830d6a 100755 --- a/apis/route53/v1beta1/zz_zoneassociation_types.go +++ b/apis/route53/v1beta1/zz_zoneassociation_types.go @@ -129,13 +129,14 @@ type ZoneAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ZoneAssociation is the Schema for the ZoneAssociations API. Manages a Route53 Hosted Zone VPC association // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ZoneAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53recoverycontrolconfig/v1beta1/zz_cluster_terraformed.go b/apis/route53recoverycontrolconfig/v1beta1/zz_cluster_terraformed.go new file mode 100755 index 0000000000..70f3d3ad0f --- /dev/null +++ b/apis/route53recoverycontrolconfig/v1beta1/zz_cluster_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cluster +func (mg *Cluster) GetTerraformResourceType() string { + return "aws_route53recoverycontrolconfig_cluster" +} + +// GetConnectionDetailsMapping for this Cluster +func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Cluster +func (tr *Cluster) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cluster +func (tr *Cluster) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cluster +func (tr *Cluster) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cluster +func (tr *Cluster) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cluster +func (tr *Cluster) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cluster using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { + params := &ClusterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cluster) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53recoverycontrolconfig/v1beta1/zz_cluster_types.go b/apis/route53recoverycontrolconfig/v1beta1/zz_cluster_types.go index f142c6b0a2..87991add87 100755 --- a/apis/route53recoverycontrolconfig/v1beta1/zz_cluster_types.go +++ b/apis/route53recoverycontrolconfig/v1beta1/zz_cluster_types.go @@ -92,13 +92,14 @@ type ClusterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cluster is the Schema for the Clusters API. Provides an AWS Route 53 Recovery Control Config Cluster // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cluster struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53recoverycontrolconfig/v1beta1/zz_controlpanel_terraformed.go b/apis/route53recoverycontrolconfig/v1beta1/zz_controlpanel_terraformed.go new file mode 100755 index 0000000000..894307a449 --- /dev/null +++ b/apis/route53recoverycontrolconfig/v1beta1/zz_controlpanel_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ControlPanel +func (mg *ControlPanel) GetTerraformResourceType() string { + return "aws_route53recoverycontrolconfig_control_panel" +} + +// GetConnectionDetailsMapping for this ControlPanel +func (tr *ControlPanel) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ControlPanel +func (tr *ControlPanel) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ControlPanel +func (tr *ControlPanel) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ControlPanel +func (tr *ControlPanel) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ControlPanel +func (tr *ControlPanel) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ControlPanel +func (tr *ControlPanel) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ControlPanel +func (tr *ControlPanel) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ControlPanel +func (tr *ControlPanel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ControlPanel using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ControlPanel) LateInitialize(attrs []byte) (bool, error) { + params := &ControlPanelParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ControlPanel) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53recoverycontrolconfig/v1beta1/zz_controlpanel_types.go b/apis/route53recoverycontrolconfig/v1beta1/zz_controlpanel_types.go index fe245b8efe..4e0dcdaa8d 100755 --- a/apis/route53recoverycontrolconfig/v1beta1/zz_controlpanel_types.go +++ b/apis/route53recoverycontrolconfig/v1beta1/zz_controlpanel_types.go @@ -109,13 +109,14 @@ type ControlPanelStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ControlPanel is the Schema for the ControlPanels API. Provides an AWS Route 53 Recovery Control Config Control Panel // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ControlPanel struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53recoverycontrolconfig/v1beta1/zz_generated.conversion_hubs.go b/apis/route53recoverycontrolconfig/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..91069a9973 --- /dev/null +++ b/apis/route53recoverycontrolconfig/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Cluster) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ControlPanel) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RoutingControl) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SafetyRule) Hub() {} diff --git a/apis/route53recoverycontrolconfig/v1beta1/zz_generated_terraformed.go b/apis/route53recoverycontrolconfig/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 527aa18b0e..0000000000 --- a/apis/route53recoverycontrolconfig/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Cluster -func (mg *Cluster) GetTerraformResourceType() string { - return "aws_route53recoverycontrolconfig_cluster" -} - -// GetConnectionDetailsMapping for this Cluster -func (tr *Cluster) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Cluster -func (tr *Cluster) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cluster -func (tr *Cluster) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cluster -func (tr *Cluster) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cluster -func (tr *Cluster) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cluster -func (tr *Cluster) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cluster -func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cluster using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { - params := &ClusterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cluster) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ControlPanel -func (mg *ControlPanel) GetTerraformResourceType() string { - return "aws_route53recoverycontrolconfig_control_panel" -} - -// GetConnectionDetailsMapping for this ControlPanel -func (tr *ControlPanel) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ControlPanel -func (tr *ControlPanel) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ControlPanel -func (tr *ControlPanel) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ControlPanel -func (tr *ControlPanel) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ControlPanel -func (tr *ControlPanel) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ControlPanel -func (tr *ControlPanel) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ControlPanel -func (tr *ControlPanel) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ControlPanel -func (tr *ControlPanel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ControlPanel using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ControlPanel) LateInitialize(attrs []byte) (bool, error) { - params := &ControlPanelParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ControlPanel) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RoutingControl -func (mg *RoutingControl) GetTerraformResourceType() string { - return "aws_route53recoverycontrolconfig_routing_control" -} - -// GetConnectionDetailsMapping for this RoutingControl -func (tr *RoutingControl) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RoutingControl -func (tr *RoutingControl) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RoutingControl -func (tr *RoutingControl) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RoutingControl -func (tr *RoutingControl) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RoutingControl -func (tr *RoutingControl) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RoutingControl -func (tr *RoutingControl) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RoutingControl -func (tr *RoutingControl) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RoutingControl -func (tr *RoutingControl) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RoutingControl using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RoutingControl) LateInitialize(attrs []byte) (bool, error) { - params := &RoutingControlParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RoutingControl) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SafetyRule -func (mg *SafetyRule) GetTerraformResourceType() string { - return "aws_route53recoverycontrolconfig_safety_rule" -} - -// GetConnectionDetailsMapping for this SafetyRule -func (tr *SafetyRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SafetyRule -func (tr *SafetyRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SafetyRule -func (tr *SafetyRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SafetyRule -func (tr *SafetyRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SafetyRule -func (tr *SafetyRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SafetyRule -func (tr *SafetyRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SafetyRule -func (tr *SafetyRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SafetyRule -func (tr *SafetyRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SafetyRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SafetyRule) LateInitialize(attrs []byte) (bool, error) { - params := &SafetyRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SafetyRule) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/route53recoverycontrolconfig/v1beta1/zz_routingcontrol_terraformed.go b/apis/route53recoverycontrolconfig/v1beta1/zz_routingcontrol_terraformed.go new file mode 100755 index 0000000000..176e969417 --- /dev/null +++ b/apis/route53recoverycontrolconfig/v1beta1/zz_routingcontrol_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RoutingControl +func (mg *RoutingControl) GetTerraformResourceType() string { + return "aws_route53recoverycontrolconfig_routing_control" +} + +// GetConnectionDetailsMapping for this RoutingControl +func (tr *RoutingControl) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RoutingControl +func (tr *RoutingControl) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RoutingControl +func (tr *RoutingControl) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RoutingControl +func (tr *RoutingControl) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RoutingControl +func (tr *RoutingControl) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RoutingControl +func (tr *RoutingControl) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RoutingControl +func (tr *RoutingControl) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RoutingControl +func (tr *RoutingControl) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RoutingControl using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RoutingControl) LateInitialize(attrs []byte) (bool, error) { + params := &RoutingControlParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RoutingControl) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53recoverycontrolconfig/v1beta1/zz_routingcontrol_types.go b/apis/route53recoverycontrolconfig/v1beta1/zz_routingcontrol_types.go index 5b570378ba..fb6ce8f319 100755 --- a/apis/route53recoverycontrolconfig/v1beta1/zz_routingcontrol_types.go +++ b/apis/route53recoverycontrolconfig/v1beta1/zz_routingcontrol_types.go @@ -133,13 +133,14 @@ type RoutingControlStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RoutingControl is the Schema for the RoutingControls API. Provides an AWS Route 53 Recovery Control Config Routing Control // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RoutingControl struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53recoverycontrolconfig/v1beta1/zz_safetyrule_terraformed.go b/apis/route53recoverycontrolconfig/v1beta1/zz_safetyrule_terraformed.go new file mode 100755 index 0000000000..2f924c48b2 --- /dev/null +++ b/apis/route53recoverycontrolconfig/v1beta1/zz_safetyrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SafetyRule +func (mg *SafetyRule) GetTerraformResourceType() string { + return "aws_route53recoverycontrolconfig_safety_rule" +} + +// GetConnectionDetailsMapping for this SafetyRule +func (tr *SafetyRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SafetyRule +func (tr *SafetyRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SafetyRule +func (tr *SafetyRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SafetyRule +func (tr *SafetyRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SafetyRule +func (tr *SafetyRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SafetyRule +func (tr *SafetyRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SafetyRule +func (tr *SafetyRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SafetyRule +func (tr *SafetyRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SafetyRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SafetyRule) LateInitialize(attrs []byte) (bool, error) { + params := &SafetyRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SafetyRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53recoverycontrolconfig/v1beta1/zz_safetyrule_types.go b/apis/route53recoverycontrolconfig/v1beta1/zz_safetyrule_types.go index d7f3c19986..de4abd7c64 100755 --- a/apis/route53recoverycontrolconfig/v1beta1/zz_safetyrule_types.go +++ b/apis/route53recoverycontrolconfig/v1beta1/zz_safetyrule_types.go @@ -212,13 +212,14 @@ type SafetyRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SafetyRule is the Schema for the SafetyRules API. Provides an AWS Route 53 Recovery Control Config Safety Rule // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SafetyRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53recoveryreadiness/v1beta1/zz_cell_terraformed.go b/apis/route53recoveryreadiness/v1beta1/zz_cell_terraformed.go new file mode 100755 index 0000000000..7c78dbdbd9 --- /dev/null +++ b/apis/route53recoveryreadiness/v1beta1/zz_cell_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Cell +func (mg *Cell) GetTerraformResourceType() string { + return "aws_route53recoveryreadiness_cell" +} + +// GetConnectionDetailsMapping for this Cell +func (tr *Cell) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Cell +func (tr *Cell) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Cell +func (tr *Cell) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Cell +func (tr *Cell) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Cell +func (tr *Cell) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Cell +func (tr *Cell) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Cell +func (tr *Cell) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Cell +func (tr *Cell) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Cell using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Cell) LateInitialize(attrs []byte) (bool, error) { + params := &CellParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Cell) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53recoveryreadiness/v1beta1/zz_cell_types.go b/apis/route53recoveryreadiness/v1beta1/zz_cell_types.go index 749f100e14..3d91282e18 100755 --- a/apis/route53recoveryreadiness/v1beta1/zz_cell_types.go +++ b/apis/route53recoveryreadiness/v1beta1/zz_cell_types.go @@ -90,13 +90,14 @@ type CellStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Cell is the Schema for the Cells API. Provides an AWS Route 53 Recovery Readiness Cell // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Cell struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53recoveryreadiness/v1beta1/zz_generated.conversion_hubs.go b/apis/route53recoveryreadiness/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..c0547cb8df --- /dev/null +++ b/apis/route53recoveryreadiness/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Cell) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReadinessCheck) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RecoveryGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResourceSet) Hub() {} diff --git a/apis/route53recoveryreadiness/v1beta1/zz_generated_terraformed.go b/apis/route53recoveryreadiness/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index d75772d6ba..0000000000 --- a/apis/route53recoveryreadiness/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Cell -func (mg *Cell) GetTerraformResourceType() string { - return "aws_route53recoveryreadiness_cell" -} - -// GetConnectionDetailsMapping for this Cell -func (tr *Cell) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Cell -func (tr *Cell) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Cell -func (tr *Cell) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Cell -func (tr *Cell) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Cell -func (tr *Cell) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Cell -func (tr *Cell) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Cell -func (tr *Cell) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Cell -func (tr *Cell) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Cell using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Cell) LateInitialize(attrs []byte) (bool, error) { - params := &CellParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Cell) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReadinessCheck -func (mg *ReadinessCheck) GetTerraformResourceType() string { - return "aws_route53recoveryreadiness_readiness_check" -} - -// GetConnectionDetailsMapping for this ReadinessCheck -func (tr *ReadinessCheck) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ReadinessCheck -func (tr *ReadinessCheck) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReadinessCheck -func (tr *ReadinessCheck) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReadinessCheck -func (tr *ReadinessCheck) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReadinessCheck -func (tr *ReadinessCheck) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReadinessCheck -func (tr *ReadinessCheck) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReadinessCheck -func (tr *ReadinessCheck) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReadinessCheck -func (tr *ReadinessCheck) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReadinessCheck using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReadinessCheck) LateInitialize(attrs []byte) (bool, error) { - params := &ReadinessCheckParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReadinessCheck) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RecoveryGroup -func (mg *RecoveryGroup) GetTerraformResourceType() string { - return "aws_route53recoveryreadiness_recovery_group" -} - -// GetConnectionDetailsMapping for this RecoveryGroup -func (tr *RecoveryGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RecoveryGroup -func (tr *RecoveryGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RecoveryGroup -func (tr *RecoveryGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RecoveryGroup -func (tr *RecoveryGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RecoveryGroup -func (tr *RecoveryGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RecoveryGroup -func (tr *RecoveryGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RecoveryGroup -func (tr *RecoveryGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RecoveryGroup -func (tr *RecoveryGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RecoveryGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RecoveryGroup) LateInitialize(attrs []byte) (bool, error) { - params := &RecoveryGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RecoveryGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ResourceSet -func (mg *ResourceSet) GetTerraformResourceType() string { - return "aws_route53recoveryreadiness_resource_set" -} - -// GetConnectionDetailsMapping for this ResourceSet -func (tr *ResourceSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResourceSet -func (tr *ResourceSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResourceSet -func (tr *ResourceSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResourceSet -func (tr *ResourceSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResourceSet -func (tr *ResourceSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResourceSet -func (tr *ResourceSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResourceSet -func (tr *ResourceSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResourceSet -func (tr *ResourceSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResourceSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResourceSet) LateInitialize(attrs []byte) (bool, error) { - params := &ResourceSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResourceSet) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/route53recoveryreadiness/v1beta1/zz_readinesscheck_terraformed.go b/apis/route53recoveryreadiness/v1beta1/zz_readinesscheck_terraformed.go new file mode 100755 index 0000000000..2b48b79c0b --- /dev/null +++ b/apis/route53recoveryreadiness/v1beta1/zz_readinesscheck_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReadinessCheck +func (mg *ReadinessCheck) GetTerraformResourceType() string { + return "aws_route53recoveryreadiness_readiness_check" +} + +// GetConnectionDetailsMapping for this ReadinessCheck +func (tr *ReadinessCheck) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReadinessCheck +func (tr *ReadinessCheck) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReadinessCheck +func (tr *ReadinessCheck) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReadinessCheck +func (tr *ReadinessCheck) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReadinessCheck +func (tr *ReadinessCheck) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReadinessCheck +func (tr *ReadinessCheck) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReadinessCheck +func (tr *ReadinessCheck) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReadinessCheck +func (tr *ReadinessCheck) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReadinessCheck using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReadinessCheck) LateInitialize(attrs []byte) (bool, error) { + params := &ReadinessCheckParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReadinessCheck) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53recoveryreadiness/v1beta1/zz_readinesscheck_types.go b/apis/route53recoveryreadiness/v1beta1/zz_readinesscheck_types.go index fdbe8a7e94..987202086c 100755 --- a/apis/route53recoveryreadiness/v1beta1/zz_readinesscheck_types.go +++ b/apis/route53recoveryreadiness/v1beta1/zz_readinesscheck_types.go @@ -87,13 +87,14 @@ type ReadinessCheckStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReadinessCheck is the Schema for the ReadinessChecks API. Provides an AWS Route 53 Recovery Readiness Readiness Check // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReadinessCheck struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53recoveryreadiness/v1beta1/zz_recoverygroup_terraformed.go b/apis/route53recoveryreadiness/v1beta1/zz_recoverygroup_terraformed.go new file mode 100755 index 0000000000..b27792d2cd --- /dev/null +++ b/apis/route53recoveryreadiness/v1beta1/zz_recoverygroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RecoveryGroup +func (mg *RecoveryGroup) GetTerraformResourceType() string { + return "aws_route53recoveryreadiness_recovery_group" +} + +// GetConnectionDetailsMapping for this RecoveryGroup +func (tr *RecoveryGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RecoveryGroup +func (tr *RecoveryGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RecoveryGroup +func (tr *RecoveryGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RecoveryGroup +func (tr *RecoveryGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RecoveryGroup +func (tr *RecoveryGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RecoveryGroup +func (tr *RecoveryGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RecoveryGroup +func (tr *RecoveryGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RecoveryGroup +func (tr *RecoveryGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RecoveryGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RecoveryGroup) LateInitialize(attrs []byte) (bool, error) { + params := &RecoveryGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RecoveryGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53recoveryreadiness/v1beta1/zz_recoverygroup_types.go b/apis/route53recoveryreadiness/v1beta1/zz_recoverygroup_types.go index d8d09a6e1d..d0cb0ac372 100755 --- a/apis/route53recoveryreadiness/v1beta1/zz_recoverygroup_types.go +++ b/apis/route53recoveryreadiness/v1beta1/zz_recoverygroup_types.go @@ -87,13 +87,14 @@ type RecoveryGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RecoveryGroup is the Schema for the RecoveryGroups API. Provides an AWS Route 53 Recovery Readiness Recovery Group // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RecoveryGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53recoveryreadiness/v1beta1/zz_resourceset_terraformed.go b/apis/route53recoveryreadiness/v1beta1/zz_resourceset_terraformed.go new file mode 100755 index 0000000000..37ad4fd9dd --- /dev/null +++ b/apis/route53recoveryreadiness/v1beta1/zz_resourceset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResourceSet +func (mg *ResourceSet) GetTerraformResourceType() string { + return "aws_route53recoveryreadiness_resource_set" +} + +// GetConnectionDetailsMapping for this ResourceSet +func (tr *ResourceSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResourceSet +func (tr *ResourceSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResourceSet +func (tr *ResourceSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResourceSet +func (tr *ResourceSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResourceSet +func (tr *ResourceSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResourceSet +func (tr *ResourceSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResourceSet +func (tr *ResourceSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResourceSet +func (tr *ResourceSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResourceSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResourceSet) LateInitialize(attrs []byte) (bool, error) { + params := &ResourceSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResourceSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53recoveryreadiness/v1beta1/zz_resourceset_types.go b/apis/route53recoveryreadiness/v1beta1/zz_resourceset_types.go index 0bc4af63d1..1effc255f0 100755 --- a/apis/route53recoveryreadiness/v1beta1/zz_resourceset_types.go +++ b/apis/route53recoveryreadiness/v1beta1/zz_resourceset_types.go @@ -295,13 +295,14 @@ type ResourceSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResourceSet is the Schema for the ResourceSets API. Provides an AWS Route 53 Recovery Readiness Resource Set // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResourceSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53resolver/v1beta1/zz_endpoint_terraformed.go b/apis/route53resolver/v1beta1/zz_endpoint_terraformed.go new file mode 100755 index 0000000000..25ee50e217 --- /dev/null +++ b/apis/route53resolver/v1beta1/zz_endpoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Endpoint +func (mg *Endpoint) GetTerraformResourceType() string { + return "aws_route53_resolver_endpoint" +} + +// GetConnectionDetailsMapping for this Endpoint +func (tr *Endpoint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Endpoint +func (tr *Endpoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Endpoint +func (tr *Endpoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Endpoint +func (tr *Endpoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Endpoint +func (tr *Endpoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Endpoint +func (tr *Endpoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Endpoint +func (tr *Endpoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Endpoint +func (tr *Endpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Endpoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Endpoint) LateInitialize(attrs []byte) (bool, error) { + params := &EndpointParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Endpoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53resolver/v1beta1/zz_endpoint_types.go b/apis/route53resolver/v1beta1/zz_endpoint_types.go index 7df221ed28..d14758e8d3 100755 --- a/apis/route53resolver/v1beta1/zz_endpoint_types.go +++ b/apis/route53resolver/v1beta1/zz_endpoint_types.go @@ -207,13 +207,14 @@ type EndpointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Endpoint is the Schema for the Endpoints API. Provides a Route 53 Resolver endpoint resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Endpoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53resolver/v1beta1/zz_generated.conversion_hubs.go b/apis/route53resolver/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..74d71fa30d --- /dev/null +++ b/apis/route53resolver/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Endpoint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Rule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RuleAssociation) Hub() {} diff --git a/apis/route53resolver/v1beta1/zz_generated_terraformed.go b/apis/route53resolver/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index aa676f82f6..0000000000 --- a/apis/route53resolver/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Endpoint -func (mg *Endpoint) GetTerraformResourceType() string { - return "aws_route53_resolver_endpoint" -} - -// GetConnectionDetailsMapping for this Endpoint -func (tr *Endpoint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Endpoint -func (tr *Endpoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Endpoint -func (tr *Endpoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Endpoint -func (tr *Endpoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Endpoint -func (tr *Endpoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Endpoint -func (tr *Endpoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Endpoint -func (tr *Endpoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Endpoint -func (tr *Endpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Endpoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Endpoint) LateInitialize(attrs []byte) (bool, error) { - params := &EndpointParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Endpoint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Rule -func (mg *Rule) GetTerraformResourceType() string { - return "aws_route53_resolver_rule" -} - -// GetConnectionDetailsMapping for this Rule -func (tr *Rule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Rule -func (tr *Rule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Rule -func (tr *Rule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Rule -func (tr *Rule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Rule -func (tr *Rule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Rule -func (tr *Rule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Rule -func (tr *Rule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Rule -func (tr *Rule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Rule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Rule) LateInitialize(attrs []byte) (bool, error) { - params := &RuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Rule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RuleAssociation -func (mg *RuleAssociation) GetTerraformResourceType() string { - return "aws_route53_resolver_rule_association" -} - -// GetConnectionDetailsMapping for this RuleAssociation -func (tr *RuleAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RuleAssociation -func (tr *RuleAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RuleAssociation -func (tr *RuleAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RuleAssociation -func (tr *RuleAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RuleAssociation -func (tr *RuleAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RuleAssociation -func (tr *RuleAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RuleAssociation -func (tr *RuleAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RuleAssociation -func (tr *RuleAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RuleAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RuleAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &RuleAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RuleAssociation) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/route53resolver/v1beta1/zz_rule_terraformed.go b/apis/route53resolver/v1beta1/zz_rule_terraformed.go new file mode 100755 index 0000000000..68c6f028fa --- /dev/null +++ b/apis/route53resolver/v1beta1/zz_rule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Rule +func (mg *Rule) GetTerraformResourceType() string { + return "aws_route53_resolver_rule" +} + +// GetConnectionDetailsMapping for this Rule +func (tr *Rule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Rule +func (tr *Rule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Rule +func (tr *Rule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Rule +func (tr *Rule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Rule +func (tr *Rule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Rule +func (tr *Rule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Rule +func (tr *Rule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Rule +func (tr *Rule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Rule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Rule) LateInitialize(attrs []byte) (bool, error) { + params := &RuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Rule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53resolver/v1beta1/zz_rule_types.go b/apis/route53resolver/v1beta1/zz_rule_types.go index 2e90bfd7bb..eef0b740e3 100755 --- a/apis/route53resolver/v1beta1/zz_rule_types.go +++ b/apis/route53resolver/v1beta1/zz_rule_types.go @@ -190,13 +190,14 @@ type RuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Rule is the Schema for the Rules API. Provides a Route53 Resolver rule. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Rule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/route53resolver/v1beta1/zz_ruleassociation_terraformed.go b/apis/route53resolver/v1beta1/zz_ruleassociation_terraformed.go new file mode 100755 index 0000000000..83573597d9 --- /dev/null +++ b/apis/route53resolver/v1beta1/zz_ruleassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RuleAssociation +func (mg *RuleAssociation) GetTerraformResourceType() string { + return "aws_route53_resolver_rule_association" +} + +// GetConnectionDetailsMapping for this RuleAssociation +func (tr *RuleAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RuleAssociation +func (tr *RuleAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RuleAssociation +func (tr *RuleAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RuleAssociation +func (tr *RuleAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RuleAssociation +func (tr *RuleAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RuleAssociation +func (tr *RuleAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RuleAssociation +func (tr *RuleAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RuleAssociation +func (tr *RuleAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RuleAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RuleAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &RuleAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RuleAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53resolver/v1beta1/zz_ruleassociation_types.go b/apis/route53resolver/v1beta1/zz_ruleassociation_types.go index e6f0d1d9da..51e8e62cee 100755 --- a/apis/route53resolver/v1beta1/zz_ruleassociation_types.go +++ b/apis/route53resolver/v1beta1/zz_ruleassociation_types.go @@ -126,13 +126,14 @@ type RuleAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RuleAssociation is the Schema for the RuleAssociations API. Provides a Route53 Resolver rule association. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RuleAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rum/v1beta1/zz_appmonitor_terraformed.go b/apis/rum/v1beta1/zz_appmonitor_terraformed.go new file mode 100755 index 0000000000..183580cddc --- /dev/null +++ b/apis/rum/v1beta1/zz_appmonitor_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AppMonitor +func (mg *AppMonitor) GetTerraformResourceType() string { + return "aws_rum_app_monitor" +} + +// GetConnectionDetailsMapping for this AppMonitor +func (tr *AppMonitor) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AppMonitor +func (tr *AppMonitor) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AppMonitor +func (tr *AppMonitor) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AppMonitor +func (tr *AppMonitor) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AppMonitor +func (tr *AppMonitor) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AppMonitor +func (tr *AppMonitor) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AppMonitor +func (tr *AppMonitor) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AppMonitor +func (tr *AppMonitor) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AppMonitor using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AppMonitor) LateInitialize(attrs []byte) (bool, error) { + params := &AppMonitorParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AppMonitor) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/rum/v1beta1/zz_appmonitor_types.go b/apis/rum/v1beta1/zz_appmonitor_types.go index 03e1759d20..2d5b8e485d 100755 --- a/apis/rum/v1beta1/zz_appmonitor_types.go +++ b/apis/rum/v1beta1/zz_appmonitor_types.go @@ -254,13 +254,14 @@ type AppMonitorStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AppMonitor is the Schema for the AppMonitors API. Provides a CloudWatch RUM App Monitor resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AppMonitor struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/rum/v1beta1/zz_generated.conversion_hubs.go b/apis/rum/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..75f8a0109d --- /dev/null +++ b/apis/rum/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AppMonitor) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MetricsDestination) Hub() {} diff --git a/apis/rum/v1beta1/zz_generated_terraformed.go b/apis/rum/v1beta1/zz_metricsdestination_terraformed.go similarity index 53% rename from apis/rum/v1beta1/zz_generated_terraformed.go rename to apis/rum/v1beta1/zz_metricsdestination_terraformed.go index 8d51a95e3f..76dfbc3ba4 100755 --- a/apis/rum/v1beta1/zz_generated_terraformed.go +++ b/apis/rum/v1beta1/zz_metricsdestination_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this AppMonitor -func (mg *AppMonitor) GetTerraformResourceType() string { - return "aws_rum_app_monitor" -} - -// GetConnectionDetailsMapping for this AppMonitor -func (tr *AppMonitor) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AppMonitor -func (tr *AppMonitor) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AppMonitor -func (tr *AppMonitor) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AppMonitor -func (tr *AppMonitor) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AppMonitor -func (tr *AppMonitor) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AppMonitor -func (tr *AppMonitor) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AppMonitor -func (tr *AppMonitor) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AppMonitor -func (tr *AppMonitor) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AppMonitor using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AppMonitor) LateInitialize(attrs []byte) (bool, error) { - params := &AppMonitorParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AppMonitor) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this MetricsDestination func (mg *MetricsDestination) GetTerraformResourceType() string { return "aws_rum_metrics_destination" diff --git a/apis/rum/v1beta1/zz_metricsdestination_types.go b/apis/rum/v1beta1/zz_metricsdestination_types.go index 26e61265f9..356e686984 100755 --- a/apis/rum/v1beta1/zz_metricsdestination_types.go +++ b/apis/rum/v1beta1/zz_metricsdestination_types.go @@ -136,13 +136,14 @@ type MetricsDestinationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MetricsDestination is the Schema for the MetricsDestinations API. Provides a CloudWatch RUM Metrics Destination resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MetricsDestination struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucket_terraformed.go b/apis/s3/v1beta1/zz_bucket_terraformed.go new file mode 100755 index 0000000000..b9bfd55cb5 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucket_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Bucket +func (mg *Bucket) GetTerraformResourceType() string { + return "aws_s3_bucket" +} + +// GetConnectionDetailsMapping for this Bucket +func (tr *Bucket) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Bucket +func (tr *Bucket) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Bucket +func (tr *Bucket) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Bucket +func (tr *Bucket) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Bucket +func (tr *Bucket) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Bucket +func (tr *Bucket) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Bucket +func (tr *Bucket) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Bucket +func (tr *Bucket) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Bucket using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Bucket) LateInitialize(attrs []byte) (bool, error) { + params := &BucketParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Bucket) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucket_types.go b/apis/s3/v1beta1/zz_bucket_types.go index 1e9a9fbac7..5856ece710 100755 --- a/apis/s3/v1beta1/zz_bucket_types.go +++ b/apis/s3/v1beta1/zz_bucket_types.go @@ -614,13 +614,14 @@ type BucketStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Bucket is the Schema for the Buckets API. Provides a S3 bucket resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Bucket struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketaccelerateconfiguration_terraformed.go b/apis/s3/v1beta1/zz_bucketaccelerateconfiguration_terraformed.go new file mode 100755 index 0000000000..296c393214 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketaccelerateconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketAccelerateConfiguration +func (mg *BucketAccelerateConfiguration) GetTerraformResourceType() string { + return "aws_s3_bucket_accelerate_configuration" +} + +// GetConnectionDetailsMapping for this BucketAccelerateConfiguration +func (tr *BucketAccelerateConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketAccelerateConfiguration +func (tr *BucketAccelerateConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketAccelerateConfiguration +func (tr *BucketAccelerateConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketAccelerateConfiguration +func (tr *BucketAccelerateConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketAccelerateConfiguration +func (tr *BucketAccelerateConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketAccelerateConfiguration +func (tr *BucketAccelerateConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketAccelerateConfiguration +func (tr *BucketAccelerateConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketAccelerateConfiguration +func (tr *BucketAccelerateConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketAccelerateConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketAccelerateConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &BucketAccelerateConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketAccelerateConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketaccelerateconfiguration_types.go b/apis/s3/v1beta1/zz_bucketaccelerateconfiguration_types.go index ca1b56c122..c3645b3461 100755 --- a/apis/s3/v1beta1/zz_bucketaccelerateconfiguration_types.go +++ b/apis/s3/v1beta1/zz_bucketaccelerateconfiguration_types.go @@ -108,13 +108,14 @@ type BucketAccelerateConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketAccelerateConfiguration is the Schema for the BucketAccelerateConfigurations API. Provides an S3 bucket accelerate configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketAccelerateConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketacl_terraformed.go b/apis/s3/v1beta1/zz_bucketacl_terraformed.go new file mode 100755 index 0000000000..eb831d4547 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketacl_terraformed.go @@ -0,0 +1,135 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketACL +func (mg *BucketACL) GetTerraformResourceType() string { + return "aws_s3_bucket_acl" +} + +// GetConnectionDetailsMapping for this BucketACL +func (tr *BucketACL) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketACL +func (tr *BucketACL) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketACL +func (tr *BucketACL) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketACL +func (tr *BucketACL) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketACL +func (tr *BucketACL) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketACL +func (tr *BucketACL) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketACL +func (tr *BucketACL) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketACL +func (tr *BucketACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketACL using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketACL) LateInitialize(attrs []byte) (bool, error) { + params := &BucketACLParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("AccessControlPolicy")) + opts = append(opts, resource.WithNameFilter("ACL")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketACL) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketacl_types.go b/apis/s3/v1beta1/zz_bucketacl_types.go index fc22f36405..9b642a0079 100755 --- a/apis/s3/v1beta1/zz_bucketacl_types.go +++ b/apis/s3/v1beta1/zz_bucketacl_types.go @@ -257,13 +257,14 @@ type BucketACLStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketACL is the Schema for the BucketACLs API. Provides an S3 bucket ACL resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketACL struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketanalyticsconfiguration_terraformed.go b/apis/s3/v1beta1/zz_bucketanalyticsconfiguration_terraformed.go new file mode 100755 index 0000000000..943030f7ae --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketanalyticsconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketAnalyticsConfiguration +func (mg *BucketAnalyticsConfiguration) GetTerraformResourceType() string { + return "aws_s3_bucket_analytics_configuration" +} + +// GetConnectionDetailsMapping for this BucketAnalyticsConfiguration +func (tr *BucketAnalyticsConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketAnalyticsConfiguration +func (tr *BucketAnalyticsConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketAnalyticsConfiguration +func (tr *BucketAnalyticsConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketAnalyticsConfiguration +func (tr *BucketAnalyticsConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketAnalyticsConfiguration +func (tr *BucketAnalyticsConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketAnalyticsConfiguration +func (tr *BucketAnalyticsConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketAnalyticsConfiguration +func (tr *BucketAnalyticsConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketAnalyticsConfiguration +func (tr *BucketAnalyticsConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketAnalyticsConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketAnalyticsConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &BucketAnalyticsConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketAnalyticsConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketanalyticsconfiguration_types.go b/apis/s3/v1beta1/zz_bucketanalyticsconfiguration_types.go index 6ceb58a952..5b9f672541 100755 --- a/apis/s3/v1beta1/zz_bucketanalyticsconfiguration_types.go +++ b/apis/s3/v1beta1/zz_bucketanalyticsconfiguration_types.go @@ -285,13 +285,14 @@ type BucketAnalyticsConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketAnalyticsConfiguration is the Schema for the BucketAnalyticsConfigurations API. Provides a S3 bucket analytics configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketAnalyticsConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketcorsconfiguration_terraformed.go b/apis/s3/v1beta1/zz_bucketcorsconfiguration_terraformed.go new file mode 100755 index 0000000000..d5787b27e0 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketcorsconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketCorsConfiguration +func (mg *BucketCorsConfiguration) GetTerraformResourceType() string { + return "aws_s3_bucket_cors_configuration" +} + +// GetConnectionDetailsMapping for this BucketCorsConfiguration +func (tr *BucketCorsConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketCorsConfiguration +func (tr *BucketCorsConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketCorsConfiguration +func (tr *BucketCorsConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketCorsConfiguration +func (tr *BucketCorsConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketCorsConfiguration +func (tr *BucketCorsConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketCorsConfiguration +func (tr *BucketCorsConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketCorsConfiguration +func (tr *BucketCorsConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketCorsConfiguration +func (tr *BucketCorsConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketCorsConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketCorsConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &BucketCorsConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketCorsConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketcorsconfiguration_types.go b/apis/s3/v1beta1/zz_bucketcorsconfiguration_types.go index 85cd9f6f33..04aba4f4be 100755 --- a/apis/s3/v1beta1/zz_bucketcorsconfiguration_types.go +++ b/apis/s3/v1beta1/zz_bucketcorsconfiguration_types.go @@ -189,13 +189,14 @@ type BucketCorsConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketCorsConfiguration is the Schema for the BucketCorsConfigurations API. Provides an S3 bucket CORS configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketCorsConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketintelligenttieringconfiguration_terraformed.go b/apis/s3/v1beta1/zz_bucketintelligenttieringconfiguration_terraformed.go new file mode 100755 index 0000000000..dff87011f3 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketintelligenttieringconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketIntelligentTieringConfiguration +func (mg *BucketIntelligentTieringConfiguration) GetTerraformResourceType() string { + return "aws_s3_bucket_intelligent_tiering_configuration" +} + +// GetConnectionDetailsMapping for this BucketIntelligentTieringConfiguration +func (tr *BucketIntelligentTieringConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketIntelligentTieringConfiguration +func (tr *BucketIntelligentTieringConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketIntelligentTieringConfiguration +func (tr *BucketIntelligentTieringConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketIntelligentTieringConfiguration +func (tr *BucketIntelligentTieringConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketIntelligentTieringConfiguration +func (tr *BucketIntelligentTieringConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketIntelligentTieringConfiguration +func (tr *BucketIntelligentTieringConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketIntelligentTieringConfiguration +func (tr *BucketIntelligentTieringConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketIntelligentTieringConfiguration +func (tr *BucketIntelligentTieringConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketIntelligentTieringConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketIntelligentTieringConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &BucketIntelligentTieringConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketIntelligentTieringConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketintelligenttieringconfiguration_types.go b/apis/s3/v1beta1/zz_bucketintelligenttieringconfiguration_types.go index 862c8627c6..aee82ed610 100755 --- a/apis/s3/v1beta1/zz_bucketintelligenttieringconfiguration_types.go +++ b/apis/s3/v1beta1/zz_bucketintelligenttieringconfiguration_types.go @@ -188,13 +188,14 @@ type BucketIntelligentTieringConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketIntelligentTieringConfiguration is the Schema for the BucketIntelligentTieringConfigurations API. Provides an S3 Intelligent-Tiering configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketIntelligentTieringConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketinventory_terraformed.go b/apis/s3/v1beta1/zz_bucketinventory_terraformed.go new file mode 100755 index 0000000000..71454b0e15 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketinventory_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketInventory +func (mg *BucketInventory) GetTerraformResourceType() string { + return "aws_s3_bucket_inventory" +} + +// GetConnectionDetailsMapping for this BucketInventory +func (tr *BucketInventory) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketInventory +func (tr *BucketInventory) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketInventory +func (tr *BucketInventory) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketInventory +func (tr *BucketInventory) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketInventory +func (tr *BucketInventory) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketInventory +func (tr *BucketInventory) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketInventory +func (tr *BucketInventory) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketInventory +func (tr *BucketInventory) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketInventory using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketInventory) LateInitialize(attrs []byte) (bool, error) { + params := &BucketInventoryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketInventory) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketinventory_types.go b/apis/s3/v1beta1/zz_bucketinventory_types.go index d8dbc919e0..d81c661bf4 100755 --- a/apis/s3/v1beta1/zz_bucketinventory_types.go +++ b/apis/s3/v1beta1/zz_bucketinventory_types.go @@ -353,13 +353,14 @@ type BucketInventoryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketInventory is the Schema for the BucketInventorys API. Provides a S3 bucket inventory configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketInventory struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketlifecycleconfiguration_terraformed.go b/apis/s3/v1beta1/zz_bucketlifecycleconfiguration_terraformed.go new file mode 100755 index 0000000000..fceebe7168 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketlifecycleconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketLifecycleConfiguration +func (mg *BucketLifecycleConfiguration) GetTerraformResourceType() string { + return "aws_s3_bucket_lifecycle_configuration" +} + +// GetConnectionDetailsMapping for this BucketLifecycleConfiguration +func (tr *BucketLifecycleConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketLifecycleConfiguration +func (tr *BucketLifecycleConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketLifecycleConfiguration +func (tr *BucketLifecycleConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketLifecycleConfiguration +func (tr *BucketLifecycleConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketLifecycleConfiguration +func (tr *BucketLifecycleConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketLifecycleConfiguration +func (tr *BucketLifecycleConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketLifecycleConfiguration +func (tr *BucketLifecycleConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketLifecycleConfiguration +func (tr *BucketLifecycleConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketLifecycleConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketLifecycleConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &BucketLifecycleConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketLifecycleConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketlifecycleconfiguration_types.go b/apis/s3/v1beta1/zz_bucketlifecycleconfiguration_types.go index 6f67a98a50..be0708f752 100755 --- a/apis/s3/v1beta1/zz_bucketlifecycleconfiguration_types.go +++ b/apis/s3/v1beta1/zz_bucketlifecycleconfiguration_types.go @@ -512,13 +512,14 @@ type BucketLifecycleConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketLifecycleConfiguration is the Schema for the BucketLifecycleConfigurations API. Provides a S3 bucket lifecycle configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketLifecycleConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketlogging_terraformed.go b/apis/s3/v1beta1/zz_bucketlogging_terraformed.go new file mode 100755 index 0000000000..e1b4dd02e5 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketlogging_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketLogging +func (mg *BucketLogging) GetTerraformResourceType() string { + return "aws_s3_bucket_logging" +} + +// GetConnectionDetailsMapping for this BucketLogging +func (tr *BucketLogging) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketLogging +func (tr *BucketLogging) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketLogging +func (tr *BucketLogging) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketLogging +func (tr *BucketLogging) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketLogging +func (tr *BucketLogging) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketLogging +func (tr *BucketLogging) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketLogging +func (tr *BucketLogging) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketLogging +func (tr *BucketLogging) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketLogging using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketLogging) LateInitialize(attrs []byte) (bool, error) { + params := &BucketLoggingParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketLogging) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketlogging_types.go b/apis/s3/v1beta1/zz_bucketlogging_types.go index 0952b2eb7b..adbaaa5c84 100755 --- a/apis/s3/v1beta1/zz_bucketlogging_types.go +++ b/apis/s3/v1beta1/zz_bucketlogging_types.go @@ -227,13 +227,14 @@ type BucketLoggingStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketLogging is the Schema for the BucketLoggings API. Provides an S3 bucket (server access) logging resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketLogging struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketmetric_terraformed.go b/apis/s3/v1beta1/zz_bucketmetric_terraformed.go new file mode 100755 index 0000000000..0edb838b6e --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketmetric_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketMetric +func (mg *BucketMetric) GetTerraformResourceType() string { + return "aws_s3_bucket_metric" +} + +// GetConnectionDetailsMapping for this BucketMetric +func (tr *BucketMetric) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketMetric +func (tr *BucketMetric) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketMetric +func (tr *BucketMetric) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketMetric +func (tr *BucketMetric) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketMetric +func (tr *BucketMetric) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketMetric +func (tr *BucketMetric) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketMetric +func (tr *BucketMetric) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketMetric +func (tr *BucketMetric) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketMetric using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketMetric) LateInitialize(attrs []byte) (bool, error) { + params := &BucketMetricParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketMetric) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketmetric_types.go b/apis/s3/v1beta1/zz_bucketmetric_types.go index c8816835ae..f4dca33e10 100755 --- a/apis/s3/v1beta1/zz_bucketmetric_types.go +++ b/apis/s3/v1beta1/zz_bucketmetric_types.go @@ -139,13 +139,14 @@ type BucketMetricStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketMetric is the Schema for the BucketMetrics API. Provides a S3 bucket metrics configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketMetric struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketnotification_terraformed.go b/apis/s3/v1beta1/zz_bucketnotification_terraformed.go new file mode 100755 index 0000000000..e2146141a2 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketnotification_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketNotification +func (mg *BucketNotification) GetTerraformResourceType() string { + return "aws_s3_bucket_notification" +} + +// GetConnectionDetailsMapping for this BucketNotification +func (tr *BucketNotification) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketNotification +func (tr *BucketNotification) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketNotification +func (tr *BucketNotification) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketNotification +func (tr *BucketNotification) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketNotification +func (tr *BucketNotification) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketNotification +func (tr *BucketNotification) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketNotification +func (tr *BucketNotification) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketNotification +func (tr *BucketNotification) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketNotification using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketNotification) LateInitialize(attrs []byte) (bool, error) { + params := &BucketNotificationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketNotification) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketnotification_types.go b/apis/s3/v1beta1/zz_bucketnotification_types.go index 49271b315b..b76d58e7fb 100755 --- a/apis/s3/v1beta1/zz_bucketnotification_types.go +++ b/apis/s3/v1beta1/zz_bucketnotification_types.go @@ -354,13 +354,14 @@ type BucketNotificationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketNotification is the Schema for the BucketNotifications API. Manages a S3 Bucket Notification Configuration // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketNotification struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketobject_terraformed.go b/apis/s3/v1beta1/zz_bucketobject_terraformed.go new file mode 100755 index 0000000000..f0cd5bbbd8 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketobject_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketObject +func (mg *BucketObject) GetTerraformResourceType() string { + return "aws_s3_bucket_object" +} + +// GetConnectionDetailsMapping for this BucketObject +func (tr *BucketObject) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketObject +func (tr *BucketObject) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketObject +func (tr *BucketObject) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketObject +func (tr *BucketObject) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketObject +func (tr *BucketObject) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketObject +func (tr *BucketObject) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketObject +func (tr *BucketObject) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketObject +func (tr *BucketObject) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketObject using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketObject) LateInitialize(attrs []byte) (bool, error) { + params := &BucketObjectParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketObject) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketobject_types.go b/apis/s3/v1beta1/zz_bucketobject_types.go index a63be6f712..f041c926c0 100755 --- a/apis/s3/v1beta1/zz_bucketobject_types.go +++ b/apis/s3/v1beta1/zz_bucketobject_types.go @@ -349,13 +349,14 @@ type BucketObjectStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketObject is the Schema for the BucketObjects API. Provides an S3 object resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketObject struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketobjectlockconfiguration_terraformed.go b/apis/s3/v1beta1/zz_bucketobjectlockconfiguration_terraformed.go new file mode 100755 index 0000000000..cf2812b195 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketobjectlockconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketObjectLockConfiguration +func (mg *BucketObjectLockConfiguration) GetTerraformResourceType() string { + return "aws_s3_bucket_object_lock_configuration" +} + +// GetConnectionDetailsMapping for this BucketObjectLockConfiguration +func (tr *BucketObjectLockConfiguration) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"token": "spec.forProvider.tokenSecretRef"} +} + +// GetObservation of this BucketObjectLockConfiguration +func (tr *BucketObjectLockConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketObjectLockConfiguration +func (tr *BucketObjectLockConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketObjectLockConfiguration +func (tr *BucketObjectLockConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketObjectLockConfiguration +func (tr *BucketObjectLockConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketObjectLockConfiguration +func (tr *BucketObjectLockConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketObjectLockConfiguration +func (tr *BucketObjectLockConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketObjectLockConfiguration +func (tr *BucketObjectLockConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketObjectLockConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketObjectLockConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &BucketObjectLockConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketObjectLockConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketobjectlockconfiguration_types.go b/apis/s3/v1beta1/zz_bucketobjectlockconfiguration_types.go index 580844f406..811b64426c 100755 --- a/apis/s3/v1beta1/zz_bucketobjectlockconfiguration_types.go +++ b/apis/s3/v1beta1/zz_bucketobjectlockconfiguration_types.go @@ -181,13 +181,14 @@ type BucketObjectLockConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketObjectLockConfiguration is the Schema for the BucketObjectLockConfigurations API. Provides an S3 bucket Object Lock configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketObjectLockConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketownershipcontrols_terraformed.go b/apis/s3/v1beta1/zz_bucketownershipcontrols_terraformed.go new file mode 100755 index 0000000000..11a95c71e3 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketownershipcontrols_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketOwnershipControls +func (mg *BucketOwnershipControls) GetTerraformResourceType() string { + return "aws_s3_bucket_ownership_controls" +} + +// GetConnectionDetailsMapping for this BucketOwnershipControls +func (tr *BucketOwnershipControls) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketOwnershipControls +func (tr *BucketOwnershipControls) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketOwnershipControls +func (tr *BucketOwnershipControls) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketOwnershipControls +func (tr *BucketOwnershipControls) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketOwnershipControls +func (tr *BucketOwnershipControls) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketOwnershipControls +func (tr *BucketOwnershipControls) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketOwnershipControls +func (tr *BucketOwnershipControls) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketOwnershipControls +func (tr *BucketOwnershipControls) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketOwnershipControls using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketOwnershipControls) LateInitialize(attrs []byte) (bool, error) { + params := &BucketOwnershipControlsParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketOwnershipControls) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketownershipcontrols_types.go b/apis/s3/v1beta1/zz_bucketownershipcontrols_types.go index 4c9b450025..d0199649a0 100755 --- a/apis/s3/v1beta1/zz_bucketownershipcontrols_types.go +++ b/apis/s3/v1beta1/zz_bucketownershipcontrols_types.go @@ -117,13 +117,14 @@ type BucketOwnershipControlsStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketOwnershipControls is the Schema for the BucketOwnershipControlss API. Manages S3 Bucket Ownership Controls. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketOwnershipControls struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketpolicy_terraformed.go b/apis/s3/v1beta1/zz_bucketpolicy_terraformed.go new file mode 100755 index 0000000000..b1b72b36b4 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketPolicy +func (mg *BucketPolicy) GetTerraformResourceType() string { + return "aws_s3_bucket_policy" +} + +// GetConnectionDetailsMapping for this BucketPolicy +func (tr *BucketPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketPolicy +func (tr *BucketPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketPolicy +func (tr *BucketPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketPolicy +func (tr *BucketPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketPolicy +func (tr *BucketPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketPolicy +func (tr *BucketPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketPolicy +func (tr *BucketPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketPolicy +func (tr *BucketPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &BucketPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketpolicy_types.go b/apis/s3/v1beta1/zz_bucketpolicy_types.go index 4bb8574480..ee8b3ce7fa 100755 --- a/apis/s3/v1beta1/zz_bucketpolicy_types.go +++ b/apis/s3/v1beta1/zz_bucketpolicy_types.go @@ -97,13 +97,14 @@ type BucketPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketPolicy is the Schema for the BucketPolicys API. Attaches a policy to an S3 bucket resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketpublicaccessblock_terraformed.go b/apis/s3/v1beta1/zz_bucketpublicaccessblock_terraformed.go new file mode 100755 index 0000000000..a75071089e --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketpublicaccessblock_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketPublicAccessBlock +func (mg *BucketPublicAccessBlock) GetTerraformResourceType() string { + return "aws_s3_bucket_public_access_block" +} + +// GetConnectionDetailsMapping for this BucketPublicAccessBlock +func (tr *BucketPublicAccessBlock) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketPublicAccessBlock +func (tr *BucketPublicAccessBlock) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketPublicAccessBlock +func (tr *BucketPublicAccessBlock) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketPublicAccessBlock +func (tr *BucketPublicAccessBlock) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketPublicAccessBlock +func (tr *BucketPublicAccessBlock) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketPublicAccessBlock +func (tr *BucketPublicAccessBlock) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketPublicAccessBlock +func (tr *BucketPublicAccessBlock) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketPublicAccessBlock +func (tr *BucketPublicAccessBlock) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketPublicAccessBlock using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketPublicAccessBlock) LateInitialize(attrs []byte) (bool, error) { + params := &BucketPublicAccessBlockParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketPublicAccessBlock) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketpublicaccessblock_types.go b/apis/s3/v1beta1/zz_bucketpublicaccessblock_types.go index f0815edc22..057e00f17d 100755 --- a/apis/s3/v1beta1/zz_bucketpublicaccessblock_types.go +++ b/apis/s3/v1beta1/zz_bucketpublicaccessblock_types.go @@ -128,13 +128,14 @@ type BucketPublicAccessBlockStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketPublicAccessBlock is the Schema for the BucketPublicAccessBlocks API. Manages S3 bucket-level Public Access Block Configuration // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketPublicAccessBlock struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketreplicationconfiguration_terraformed.go b/apis/s3/v1beta1/zz_bucketreplicationconfiguration_terraformed.go new file mode 100755 index 0000000000..88847de248 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketreplicationconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketReplicationConfiguration +func (mg *BucketReplicationConfiguration) GetTerraformResourceType() string { + return "aws_s3_bucket_replication_configuration" +} + +// GetConnectionDetailsMapping for this BucketReplicationConfiguration +func (tr *BucketReplicationConfiguration) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"token": "spec.forProvider.tokenSecretRef"} +} + +// GetObservation of this BucketReplicationConfiguration +func (tr *BucketReplicationConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketReplicationConfiguration +func (tr *BucketReplicationConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketReplicationConfiguration +func (tr *BucketReplicationConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketReplicationConfiguration +func (tr *BucketReplicationConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketReplicationConfiguration +func (tr *BucketReplicationConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketReplicationConfiguration +func (tr *BucketReplicationConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketReplicationConfiguration +func (tr *BucketReplicationConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketReplicationConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketReplicationConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &BucketReplicationConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketReplicationConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketreplicationconfiguration_types.go b/apis/s3/v1beta1/zz_bucketreplicationconfiguration_types.go index 39171dacac..3bd287f65e 100755 --- a/apis/s3/v1beta1/zz_bucketreplicationconfiguration_types.go +++ b/apis/s3/v1beta1/zz_bucketreplicationconfiguration_types.go @@ -670,13 +670,14 @@ type BucketReplicationConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketReplicationConfiguration is the Schema for the BucketReplicationConfigurations API. Provides a S3 bucket replication configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketReplicationConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketrequestpaymentconfiguration_terraformed.go b/apis/s3/v1beta1/zz_bucketrequestpaymentconfiguration_terraformed.go new file mode 100755 index 0000000000..a4e8a42ad7 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketrequestpaymentconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketRequestPaymentConfiguration +func (mg *BucketRequestPaymentConfiguration) GetTerraformResourceType() string { + return "aws_s3_bucket_request_payment_configuration" +} + +// GetConnectionDetailsMapping for this BucketRequestPaymentConfiguration +func (tr *BucketRequestPaymentConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketRequestPaymentConfiguration +func (tr *BucketRequestPaymentConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketRequestPaymentConfiguration +func (tr *BucketRequestPaymentConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketRequestPaymentConfiguration +func (tr *BucketRequestPaymentConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketRequestPaymentConfiguration +func (tr *BucketRequestPaymentConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketRequestPaymentConfiguration +func (tr *BucketRequestPaymentConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketRequestPaymentConfiguration +func (tr *BucketRequestPaymentConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketRequestPaymentConfiguration +func (tr *BucketRequestPaymentConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketRequestPaymentConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketRequestPaymentConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &BucketRequestPaymentConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketRequestPaymentConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketrequestpaymentconfiguration_types.go b/apis/s3/v1beta1/zz_bucketrequestpaymentconfiguration_types.go index 9195bc94cd..9c7c24a1b2 100755 --- a/apis/s3/v1beta1/zz_bucketrequestpaymentconfiguration_types.go +++ b/apis/s3/v1beta1/zz_bucketrequestpaymentconfiguration_types.go @@ -108,13 +108,14 @@ type BucketRequestPaymentConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketRequestPaymentConfiguration is the Schema for the BucketRequestPaymentConfigurations API. Provides an S3 bucket request payment configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketRequestPaymentConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketserversideencryptionconfiguration_terraformed.go b/apis/s3/v1beta1/zz_bucketserversideencryptionconfiguration_terraformed.go new file mode 100755 index 0000000000..825312e8b0 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketserversideencryptionconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketServerSideEncryptionConfiguration +func (mg *BucketServerSideEncryptionConfiguration) GetTerraformResourceType() string { + return "aws_s3_bucket_server_side_encryption_configuration" +} + +// GetConnectionDetailsMapping for this BucketServerSideEncryptionConfiguration +func (tr *BucketServerSideEncryptionConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketServerSideEncryptionConfiguration +func (tr *BucketServerSideEncryptionConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketServerSideEncryptionConfiguration +func (tr *BucketServerSideEncryptionConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketServerSideEncryptionConfiguration +func (tr *BucketServerSideEncryptionConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketServerSideEncryptionConfiguration +func (tr *BucketServerSideEncryptionConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketServerSideEncryptionConfiguration +func (tr *BucketServerSideEncryptionConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketServerSideEncryptionConfiguration +func (tr *BucketServerSideEncryptionConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketServerSideEncryptionConfiguration +func (tr *BucketServerSideEncryptionConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketServerSideEncryptionConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketServerSideEncryptionConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &BucketServerSideEncryptionConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketServerSideEncryptionConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketserversideencryptionconfiguration_types.go b/apis/s3/v1beta1/zz_bucketserversideencryptionconfiguration_types.go index d8679a4131..0ef2a07771 100755 --- a/apis/s3/v1beta1/zz_bucketserversideencryptionconfiguration_types.go +++ b/apis/s3/v1beta1/zz_bucketserversideencryptionconfiguration_types.go @@ -186,13 +186,14 @@ type BucketServerSideEncryptionConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketServerSideEncryptionConfiguration is the Schema for the BucketServerSideEncryptionConfigurations API. Provides a S3 bucket server-side encryption configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketServerSideEncryptionConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketversioning_terraformed.go b/apis/s3/v1beta1/zz_bucketversioning_terraformed.go new file mode 100755 index 0000000000..a094244f3d --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketversioning_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketVersioning +func (mg *BucketVersioning) GetTerraformResourceType() string { + return "aws_s3_bucket_versioning" +} + +// GetConnectionDetailsMapping for this BucketVersioning +func (tr *BucketVersioning) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketVersioning +func (tr *BucketVersioning) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketVersioning +func (tr *BucketVersioning) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketVersioning +func (tr *BucketVersioning) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketVersioning +func (tr *BucketVersioning) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketVersioning +func (tr *BucketVersioning) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketVersioning +func (tr *BucketVersioning) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketVersioning +func (tr *BucketVersioning) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketVersioning using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketVersioning) LateInitialize(attrs []byte) (bool, error) { + params := &BucketVersioningParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketVersioning) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketversioning_types.go b/apis/s3/v1beta1/zz_bucketversioning_types.go index 6889d680b9..acc5b46844 100755 --- a/apis/s3/v1beta1/zz_bucketversioning_types.go +++ b/apis/s3/v1beta1/zz_bucketversioning_types.go @@ -147,13 +147,14 @@ type BucketVersioningStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketVersioning is the Schema for the BucketVersionings API. Provides an S3 bucket versioning resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketVersioning struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_bucketwebsiteconfiguration_terraformed.go b/apis/s3/v1beta1/zz_bucketwebsiteconfiguration_terraformed.go new file mode 100755 index 0000000000..ca212ed3a9 --- /dev/null +++ b/apis/s3/v1beta1/zz_bucketwebsiteconfiguration_terraformed.go @@ -0,0 +1,135 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BucketWebsiteConfiguration +func (mg *BucketWebsiteConfiguration) GetTerraformResourceType() string { + return "aws_s3_bucket_website_configuration" +} + +// GetConnectionDetailsMapping for this BucketWebsiteConfiguration +func (tr *BucketWebsiteConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BucketWebsiteConfiguration +func (tr *BucketWebsiteConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BucketWebsiteConfiguration +func (tr *BucketWebsiteConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BucketWebsiteConfiguration +func (tr *BucketWebsiteConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BucketWebsiteConfiguration +func (tr *BucketWebsiteConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BucketWebsiteConfiguration +func (tr *BucketWebsiteConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BucketWebsiteConfiguration +func (tr *BucketWebsiteConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BucketWebsiteConfiguration +func (tr *BucketWebsiteConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BucketWebsiteConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BucketWebsiteConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &BucketWebsiteConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("RoutingRule")) + opts = append(opts, resource.WithNameFilter("RoutingRules")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BucketWebsiteConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_bucketwebsiteconfiguration_types.go b/apis/s3/v1beta1/zz_bucketwebsiteconfiguration_types.go index 49bc239216..caf2b5dfe0 100755 --- a/apis/s3/v1beta1/zz_bucketwebsiteconfiguration_types.go +++ b/apis/s3/v1beta1/zz_bucketwebsiteconfiguration_types.go @@ -347,13 +347,14 @@ type BucketWebsiteConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BucketWebsiteConfiguration is the Schema for the BucketWebsiteConfigurations API. Provides an S3 bucket website configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BucketWebsiteConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_generated.conversion_hubs.go b/apis/s3/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..9e942a11ac --- /dev/null +++ b/apis/s3/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,80 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Bucket) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketAccelerateConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketACL) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketAnalyticsConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketCorsConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketIntelligentTieringConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketInventory) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketLifecycleConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketLogging) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketMetric) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketNotification) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketObject) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketObjectLockConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketOwnershipControls) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketPublicAccessBlock) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketReplicationConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketRequestPaymentConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketServerSideEncryptionConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketVersioning) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *BucketWebsiteConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Object) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ObjectCopy) Hub() {} diff --git a/apis/s3/v1beta1/zz_generated_terraformed.go b/apis/s3/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index b8b7ee9ce6..0000000000 --- a/apis/s3/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,2649 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Bucket -func (mg *Bucket) GetTerraformResourceType() string { - return "aws_s3_bucket" -} - -// GetConnectionDetailsMapping for this Bucket -func (tr *Bucket) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Bucket -func (tr *Bucket) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Bucket -func (tr *Bucket) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Bucket -func (tr *Bucket) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Bucket -func (tr *Bucket) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Bucket -func (tr *Bucket) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Bucket -func (tr *Bucket) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Bucket -func (tr *Bucket) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Bucket using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Bucket) LateInitialize(attrs []byte) (bool, error) { - params := &BucketParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Bucket) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketAccelerateConfiguration -func (mg *BucketAccelerateConfiguration) GetTerraformResourceType() string { - return "aws_s3_bucket_accelerate_configuration" -} - -// GetConnectionDetailsMapping for this BucketAccelerateConfiguration -func (tr *BucketAccelerateConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketAccelerateConfiguration -func (tr *BucketAccelerateConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketAccelerateConfiguration -func (tr *BucketAccelerateConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketAccelerateConfiguration -func (tr *BucketAccelerateConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketAccelerateConfiguration -func (tr *BucketAccelerateConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketAccelerateConfiguration -func (tr *BucketAccelerateConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketAccelerateConfiguration -func (tr *BucketAccelerateConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketAccelerateConfiguration -func (tr *BucketAccelerateConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketAccelerateConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketAccelerateConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &BucketAccelerateConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketAccelerateConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketACL -func (mg *BucketACL) GetTerraformResourceType() string { - return "aws_s3_bucket_acl" -} - -// GetConnectionDetailsMapping for this BucketACL -func (tr *BucketACL) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketACL -func (tr *BucketACL) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketACL -func (tr *BucketACL) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketACL -func (tr *BucketACL) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketACL -func (tr *BucketACL) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketACL -func (tr *BucketACL) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketACL -func (tr *BucketACL) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketACL -func (tr *BucketACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketACL using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketACL) LateInitialize(attrs []byte) (bool, error) { - params := &BucketACLParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("AccessControlPolicy")) - opts = append(opts, resource.WithNameFilter("ACL")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketACL) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketAnalyticsConfiguration -func (mg *BucketAnalyticsConfiguration) GetTerraformResourceType() string { - return "aws_s3_bucket_analytics_configuration" -} - -// GetConnectionDetailsMapping for this BucketAnalyticsConfiguration -func (tr *BucketAnalyticsConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketAnalyticsConfiguration -func (tr *BucketAnalyticsConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketAnalyticsConfiguration -func (tr *BucketAnalyticsConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketAnalyticsConfiguration -func (tr *BucketAnalyticsConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketAnalyticsConfiguration -func (tr *BucketAnalyticsConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketAnalyticsConfiguration -func (tr *BucketAnalyticsConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketAnalyticsConfiguration -func (tr *BucketAnalyticsConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketAnalyticsConfiguration -func (tr *BucketAnalyticsConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketAnalyticsConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketAnalyticsConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &BucketAnalyticsConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketAnalyticsConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketCorsConfiguration -func (mg *BucketCorsConfiguration) GetTerraformResourceType() string { - return "aws_s3_bucket_cors_configuration" -} - -// GetConnectionDetailsMapping for this BucketCorsConfiguration -func (tr *BucketCorsConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketCorsConfiguration -func (tr *BucketCorsConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketCorsConfiguration -func (tr *BucketCorsConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketCorsConfiguration -func (tr *BucketCorsConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketCorsConfiguration -func (tr *BucketCorsConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketCorsConfiguration -func (tr *BucketCorsConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketCorsConfiguration -func (tr *BucketCorsConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketCorsConfiguration -func (tr *BucketCorsConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketCorsConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketCorsConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &BucketCorsConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketCorsConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketIntelligentTieringConfiguration -func (mg *BucketIntelligentTieringConfiguration) GetTerraformResourceType() string { - return "aws_s3_bucket_intelligent_tiering_configuration" -} - -// GetConnectionDetailsMapping for this BucketIntelligentTieringConfiguration -func (tr *BucketIntelligentTieringConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketIntelligentTieringConfiguration -func (tr *BucketIntelligentTieringConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketIntelligentTieringConfiguration -func (tr *BucketIntelligentTieringConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketIntelligentTieringConfiguration -func (tr *BucketIntelligentTieringConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketIntelligentTieringConfiguration -func (tr *BucketIntelligentTieringConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketIntelligentTieringConfiguration -func (tr *BucketIntelligentTieringConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketIntelligentTieringConfiguration -func (tr *BucketIntelligentTieringConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketIntelligentTieringConfiguration -func (tr *BucketIntelligentTieringConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketIntelligentTieringConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketIntelligentTieringConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &BucketIntelligentTieringConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketIntelligentTieringConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketInventory -func (mg *BucketInventory) GetTerraformResourceType() string { - return "aws_s3_bucket_inventory" -} - -// GetConnectionDetailsMapping for this BucketInventory -func (tr *BucketInventory) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketInventory -func (tr *BucketInventory) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketInventory -func (tr *BucketInventory) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketInventory -func (tr *BucketInventory) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketInventory -func (tr *BucketInventory) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketInventory -func (tr *BucketInventory) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketInventory -func (tr *BucketInventory) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketInventory -func (tr *BucketInventory) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketInventory using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketInventory) LateInitialize(attrs []byte) (bool, error) { - params := &BucketInventoryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketInventory) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketLifecycleConfiguration -func (mg *BucketLifecycleConfiguration) GetTerraformResourceType() string { - return "aws_s3_bucket_lifecycle_configuration" -} - -// GetConnectionDetailsMapping for this BucketLifecycleConfiguration -func (tr *BucketLifecycleConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketLifecycleConfiguration -func (tr *BucketLifecycleConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketLifecycleConfiguration -func (tr *BucketLifecycleConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketLifecycleConfiguration -func (tr *BucketLifecycleConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketLifecycleConfiguration -func (tr *BucketLifecycleConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketLifecycleConfiguration -func (tr *BucketLifecycleConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketLifecycleConfiguration -func (tr *BucketLifecycleConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketLifecycleConfiguration -func (tr *BucketLifecycleConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketLifecycleConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketLifecycleConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &BucketLifecycleConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketLifecycleConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketLogging -func (mg *BucketLogging) GetTerraformResourceType() string { - return "aws_s3_bucket_logging" -} - -// GetConnectionDetailsMapping for this BucketLogging -func (tr *BucketLogging) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketLogging -func (tr *BucketLogging) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketLogging -func (tr *BucketLogging) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketLogging -func (tr *BucketLogging) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketLogging -func (tr *BucketLogging) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketLogging -func (tr *BucketLogging) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketLogging -func (tr *BucketLogging) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketLogging -func (tr *BucketLogging) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketLogging using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketLogging) LateInitialize(attrs []byte) (bool, error) { - params := &BucketLoggingParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketLogging) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketMetric -func (mg *BucketMetric) GetTerraformResourceType() string { - return "aws_s3_bucket_metric" -} - -// GetConnectionDetailsMapping for this BucketMetric -func (tr *BucketMetric) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketMetric -func (tr *BucketMetric) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketMetric -func (tr *BucketMetric) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketMetric -func (tr *BucketMetric) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketMetric -func (tr *BucketMetric) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketMetric -func (tr *BucketMetric) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketMetric -func (tr *BucketMetric) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketMetric -func (tr *BucketMetric) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketMetric using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketMetric) LateInitialize(attrs []byte) (bool, error) { - params := &BucketMetricParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketMetric) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketNotification -func (mg *BucketNotification) GetTerraformResourceType() string { - return "aws_s3_bucket_notification" -} - -// GetConnectionDetailsMapping for this BucketNotification -func (tr *BucketNotification) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketNotification -func (tr *BucketNotification) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketNotification -func (tr *BucketNotification) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketNotification -func (tr *BucketNotification) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketNotification -func (tr *BucketNotification) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketNotification -func (tr *BucketNotification) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketNotification -func (tr *BucketNotification) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketNotification -func (tr *BucketNotification) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketNotification using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketNotification) LateInitialize(attrs []byte) (bool, error) { - params := &BucketNotificationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketNotification) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketObject -func (mg *BucketObject) GetTerraformResourceType() string { - return "aws_s3_bucket_object" -} - -// GetConnectionDetailsMapping for this BucketObject -func (tr *BucketObject) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketObject -func (tr *BucketObject) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketObject -func (tr *BucketObject) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketObject -func (tr *BucketObject) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketObject -func (tr *BucketObject) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketObject -func (tr *BucketObject) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketObject -func (tr *BucketObject) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketObject -func (tr *BucketObject) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketObject using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketObject) LateInitialize(attrs []byte) (bool, error) { - params := &BucketObjectParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketObject) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketObjectLockConfiguration -func (mg *BucketObjectLockConfiguration) GetTerraformResourceType() string { - return "aws_s3_bucket_object_lock_configuration" -} - -// GetConnectionDetailsMapping for this BucketObjectLockConfiguration -func (tr *BucketObjectLockConfiguration) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"token": "spec.forProvider.tokenSecretRef"} -} - -// GetObservation of this BucketObjectLockConfiguration -func (tr *BucketObjectLockConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketObjectLockConfiguration -func (tr *BucketObjectLockConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketObjectLockConfiguration -func (tr *BucketObjectLockConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketObjectLockConfiguration -func (tr *BucketObjectLockConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketObjectLockConfiguration -func (tr *BucketObjectLockConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketObjectLockConfiguration -func (tr *BucketObjectLockConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketObjectLockConfiguration -func (tr *BucketObjectLockConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketObjectLockConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketObjectLockConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &BucketObjectLockConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketObjectLockConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketOwnershipControls -func (mg *BucketOwnershipControls) GetTerraformResourceType() string { - return "aws_s3_bucket_ownership_controls" -} - -// GetConnectionDetailsMapping for this BucketOwnershipControls -func (tr *BucketOwnershipControls) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketOwnershipControls -func (tr *BucketOwnershipControls) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketOwnershipControls -func (tr *BucketOwnershipControls) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketOwnershipControls -func (tr *BucketOwnershipControls) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketOwnershipControls -func (tr *BucketOwnershipControls) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketOwnershipControls -func (tr *BucketOwnershipControls) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketOwnershipControls -func (tr *BucketOwnershipControls) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketOwnershipControls -func (tr *BucketOwnershipControls) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketOwnershipControls using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketOwnershipControls) LateInitialize(attrs []byte) (bool, error) { - params := &BucketOwnershipControlsParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketOwnershipControls) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketPolicy -func (mg *BucketPolicy) GetTerraformResourceType() string { - return "aws_s3_bucket_policy" -} - -// GetConnectionDetailsMapping for this BucketPolicy -func (tr *BucketPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketPolicy -func (tr *BucketPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketPolicy -func (tr *BucketPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketPolicy -func (tr *BucketPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketPolicy -func (tr *BucketPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketPolicy -func (tr *BucketPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketPolicy -func (tr *BucketPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketPolicy -func (tr *BucketPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &BucketPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketPublicAccessBlock -func (mg *BucketPublicAccessBlock) GetTerraformResourceType() string { - return "aws_s3_bucket_public_access_block" -} - -// GetConnectionDetailsMapping for this BucketPublicAccessBlock -func (tr *BucketPublicAccessBlock) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketPublicAccessBlock -func (tr *BucketPublicAccessBlock) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketPublicAccessBlock -func (tr *BucketPublicAccessBlock) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketPublicAccessBlock -func (tr *BucketPublicAccessBlock) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketPublicAccessBlock -func (tr *BucketPublicAccessBlock) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketPublicAccessBlock -func (tr *BucketPublicAccessBlock) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketPublicAccessBlock -func (tr *BucketPublicAccessBlock) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketPublicAccessBlock -func (tr *BucketPublicAccessBlock) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketPublicAccessBlock using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketPublicAccessBlock) LateInitialize(attrs []byte) (bool, error) { - params := &BucketPublicAccessBlockParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketPublicAccessBlock) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketReplicationConfiguration -func (mg *BucketReplicationConfiguration) GetTerraformResourceType() string { - return "aws_s3_bucket_replication_configuration" -} - -// GetConnectionDetailsMapping for this BucketReplicationConfiguration -func (tr *BucketReplicationConfiguration) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"token": "spec.forProvider.tokenSecretRef"} -} - -// GetObservation of this BucketReplicationConfiguration -func (tr *BucketReplicationConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketReplicationConfiguration -func (tr *BucketReplicationConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketReplicationConfiguration -func (tr *BucketReplicationConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketReplicationConfiguration -func (tr *BucketReplicationConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketReplicationConfiguration -func (tr *BucketReplicationConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketReplicationConfiguration -func (tr *BucketReplicationConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketReplicationConfiguration -func (tr *BucketReplicationConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketReplicationConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketReplicationConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &BucketReplicationConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketReplicationConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketRequestPaymentConfiguration -func (mg *BucketRequestPaymentConfiguration) GetTerraformResourceType() string { - return "aws_s3_bucket_request_payment_configuration" -} - -// GetConnectionDetailsMapping for this BucketRequestPaymentConfiguration -func (tr *BucketRequestPaymentConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketRequestPaymentConfiguration -func (tr *BucketRequestPaymentConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketRequestPaymentConfiguration -func (tr *BucketRequestPaymentConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketRequestPaymentConfiguration -func (tr *BucketRequestPaymentConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketRequestPaymentConfiguration -func (tr *BucketRequestPaymentConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketRequestPaymentConfiguration -func (tr *BucketRequestPaymentConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketRequestPaymentConfiguration -func (tr *BucketRequestPaymentConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketRequestPaymentConfiguration -func (tr *BucketRequestPaymentConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketRequestPaymentConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketRequestPaymentConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &BucketRequestPaymentConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketRequestPaymentConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketServerSideEncryptionConfiguration -func (mg *BucketServerSideEncryptionConfiguration) GetTerraformResourceType() string { - return "aws_s3_bucket_server_side_encryption_configuration" -} - -// GetConnectionDetailsMapping for this BucketServerSideEncryptionConfiguration -func (tr *BucketServerSideEncryptionConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketServerSideEncryptionConfiguration -func (tr *BucketServerSideEncryptionConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketServerSideEncryptionConfiguration -func (tr *BucketServerSideEncryptionConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketServerSideEncryptionConfiguration -func (tr *BucketServerSideEncryptionConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketServerSideEncryptionConfiguration -func (tr *BucketServerSideEncryptionConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketServerSideEncryptionConfiguration -func (tr *BucketServerSideEncryptionConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketServerSideEncryptionConfiguration -func (tr *BucketServerSideEncryptionConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketServerSideEncryptionConfiguration -func (tr *BucketServerSideEncryptionConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketServerSideEncryptionConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketServerSideEncryptionConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &BucketServerSideEncryptionConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketServerSideEncryptionConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketVersioning -func (mg *BucketVersioning) GetTerraformResourceType() string { - return "aws_s3_bucket_versioning" -} - -// GetConnectionDetailsMapping for this BucketVersioning -func (tr *BucketVersioning) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketVersioning -func (tr *BucketVersioning) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketVersioning -func (tr *BucketVersioning) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketVersioning -func (tr *BucketVersioning) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketVersioning -func (tr *BucketVersioning) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketVersioning -func (tr *BucketVersioning) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketVersioning -func (tr *BucketVersioning) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketVersioning -func (tr *BucketVersioning) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketVersioning using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketVersioning) LateInitialize(attrs []byte) (bool, error) { - params := &BucketVersioningParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketVersioning) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this BucketWebsiteConfiguration -func (mg *BucketWebsiteConfiguration) GetTerraformResourceType() string { - return "aws_s3_bucket_website_configuration" -} - -// GetConnectionDetailsMapping for this BucketWebsiteConfiguration -func (tr *BucketWebsiteConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BucketWebsiteConfiguration -func (tr *BucketWebsiteConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BucketWebsiteConfiguration -func (tr *BucketWebsiteConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BucketWebsiteConfiguration -func (tr *BucketWebsiteConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BucketWebsiteConfiguration -func (tr *BucketWebsiteConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BucketWebsiteConfiguration -func (tr *BucketWebsiteConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BucketWebsiteConfiguration -func (tr *BucketWebsiteConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BucketWebsiteConfiguration -func (tr *BucketWebsiteConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BucketWebsiteConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BucketWebsiteConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &BucketWebsiteConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("RoutingRule")) - opts = append(opts, resource.WithNameFilter("RoutingRules")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BucketWebsiteConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Object -func (mg *Object) GetTerraformResourceType() string { - return "aws_s3_object" -} - -// GetConnectionDetailsMapping for this Object -func (tr *Object) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Object -func (tr *Object) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Object -func (tr *Object) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Object -func (tr *Object) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Object -func (tr *Object) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Object -func (tr *Object) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Object -func (tr *Object) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Object -func (tr *Object) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Object using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Object) LateInitialize(attrs []byte) (bool, error) { - params := &ObjectParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("Etag")) - opts = append(opts, resource.WithNameFilter("KMSKeyID")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Object) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ObjectCopy -func (mg *ObjectCopy) GetTerraformResourceType() string { - return "aws_s3_object_copy" -} - -// GetConnectionDetailsMapping for this ObjectCopy -func (tr *ObjectCopy) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"customer_key": "spec.forProvider.customerKeySecretRef", "kms_encryption_context": "spec.forProvider.kmsEncryptionContextSecretRef", "kms_key_id": "spec.forProvider.kmsKeyIdSecretRef", "source_customer_key": "spec.forProvider.sourceCustomerKeySecretRef"} -} - -// GetObservation of this ObjectCopy -func (tr *ObjectCopy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ObjectCopy -func (tr *ObjectCopy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ObjectCopy -func (tr *ObjectCopy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ObjectCopy -func (tr *ObjectCopy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ObjectCopy -func (tr *ObjectCopy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ObjectCopy -func (tr *ObjectCopy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ObjectCopy -func (tr *ObjectCopy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ObjectCopy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ObjectCopy) LateInitialize(attrs []byte) (bool, error) { - params := &ObjectCopyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("ACL")) - opts = append(opts, resource.WithNameFilter("Grant")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ObjectCopy) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/s3/v1beta1/zz_object_terraformed.go b/apis/s3/v1beta1/zz_object_terraformed.go new file mode 100755 index 0000000000..e24c352443 --- /dev/null +++ b/apis/s3/v1beta1/zz_object_terraformed.go @@ -0,0 +1,135 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Object +func (mg *Object) GetTerraformResourceType() string { + return "aws_s3_object" +} + +// GetConnectionDetailsMapping for this Object +func (tr *Object) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Object +func (tr *Object) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Object +func (tr *Object) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Object +func (tr *Object) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Object +func (tr *Object) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Object +func (tr *Object) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Object +func (tr *Object) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Object +func (tr *Object) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Object using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Object) LateInitialize(attrs []byte) (bool, error) { + params := &ObjectParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("Etag")) + opts = append(opts, resource.WithNameFilter("KMSKeyID")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Object) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_object_types.go b/apis/s3/v1beta1/zz_object_types.go index 27319087d7..25b1c81a91 100755 --- a/apis/s3/v1beta1/zz_object_types.go +++ b/apis/s3/v1beta1/zz_object_types.go @@ -349,13 +349,14 @@ type ObjectStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Object is the Schema for the Objects API. Provides an S3 object resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Object struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3/v1beta1/zz_objectcopy_terraformed.go b/apis/s3/v1beta1/zz_objectcopy_terraformed.go new file mode 100755 index 0000000000..0df8f81d79 --- /dev/null +++ b/apis/s3/v1beta1/zz_objectcopy_terraformed.go @@ -0,0 +1,135 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ObjectCopy +func (mg *ObjectCopy) GetTerraformResourceType() string { + return "aws_s3_object_copy" +} + +// GetConnectionDetailsMapping for this ObjectCopy +func (tr *ObjectCopy) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"customer_key": "spec.forProvider.customerKeySecretRef", "kms_encryption_context": "spec.forProvider.kmsEncryptionContextSecretRef", "kms_key_id": "spec.forProvider.kmsKeyIdSecretRef", "source_customer_key": "spec.forProvider.sourceCustomerKeySecretRef"} +} + +// GetObservation of this ObjectCopy +func (tr *ObjectCopy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ObjectCopy +func (tr *ObjectCopy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ObjectCopy +func (tr *ObjectCopy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ObjectCopy +func (tr *ObjectCopy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ObjectCopy +func (tr *ObjectCopy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ObjectCopy +func (tr *ObjectCopy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ObjectCopy +func (tr *ObjectCopy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ObjectCopy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ObjectCopy) LateInitialize(attrs []byte) (bool, error) { + params := &ObjectCopyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("ACL")) + opts = append(opts, resource.WithNameFilter("Grant")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ObjectCopy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3/v1beta1/zz_objectcopy_types.go b/apis/s3/v1beta1/zz_objectcopy_types.go index 62689442c3..183f835b58 100755 --- a/apis/s3/v1beta1/zz_objectcopy_types.go +++ b/apis/s3/v1beta1/zz_objectcopy_types.go @@ -501,13 +501,14 @@ type ObjectCopyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ObjectCopy is the Schema for the ObjectCopys API. Provides a resource for copying an S3 object. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ObjectCopy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3control/v1beta1/zz_accesspoint_terraformed.go b/apis/s3control/v1beta1/zz_accesspoint_terraformed.go new file mode 100755 index 0000000000..2d1ea7e8ad --- /dev/null +++ b/apis/s3control/v1beta1/zz_accesspoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AccessPoint +func (mg *AccessPoint) GetTerraformResourceType() string { + return "aws_s3_access_point" +} + +// GetConnectionDetailsMapping for this AccessPoint +func (tr *AccessPoint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AccessPoint +func (tr *AccessPoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AccessPoint +func (tr *AccessPoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AccessPoint +func (tr *AccessPoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AccessPoint +func (tr *AccessPoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AccessPoint +func (tr *AccessPoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AccessPoint +func (tr *AccessPoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AccessPoint +func (tr *AccessPoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AccessPoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AccessPoint) LateInitialize(attrs []byte) (bool, error) { + params := &AccessPointParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AccessPoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3control/v1beta1/zz_accesspoint_types.go b/apis/s3control/v1beta1/zz_accesspoint_types.go index a940118d53..ac17b1a8e4 100755 --- a/apis/s3control/v1beta1/zz_accesspoint_types.go +++ b/apis/s3control/v1beta1/zz_accesspoint_types.go @@ -256,13 +256,14 @@ type AccessPointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AccessPoint is the Schema for the AccessPoints API. Manages an S3 Access Point. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AccessPoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3control/v1beta1/zz_accesspointpolicy_terraformed.go b/apis/s3control/v1beta1/zz_accesspointpolicy_terraformed.go new file mode 100755 index 0000000000..b714683f4e --- /dev/null +++ b/apis/s3control/v1beta1/zz_accesspointpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AccessPointPolicy +func (mg *AccessPointPolicy) GetTerraformResourceType() string { + return "aws_s3control_access_point_policy" +} + +// GetConnectionDetailsMapping for this AccessPointPolicy +func (tr *AccessPointPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AccessPointPolicy +func (tr *AccessPointPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AccessPointPolicy +func (tr *AccessPointPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AccessPointPolicy +func (tr *AccessPointPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AccessPointPolicy +func (tr *AccessPointPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AccessPointPolicy +func (tr *AccessPointPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AccessPointPolicy +func (tr *AccessPointPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AccessPointPolicy +func (tr *AccessPointPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AccessPointPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AccessPointPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &AccessPointPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AccessPointPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3control/v1beta1/zz_accesspointpolicy_types.go b/apis/s3control/v1beta1/zz_accesspointpolicy_types.go index b1633f2a96..7eec699dd8 100755 --- a/apis/s3control/v1beta1/zz_accesspointpolicy_types.go +++ b/apis/s3control/v1beta1/zz_accesspointpolicy_types.go @@ -101,13 +101,14 @@ type AccessPointPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AccessPointPolicy is the Schema for the AccessPointPolicys API. Provides a resource to manage an S3 Access Point resource policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AccessPointPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3control/v1beta1/zz_accountpublicaccessblock_terraformed.go b/apis/s3control/v1beta1/zz_accountpublicaccessblock_terraformed.go new file mode 100755 index 0000000000..dfbbc9b6db --- /dev/null +++ b/apis/s3control/v1beta1/zz_accountpublicaccessblock_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AccountPublicAccessBlock +func (mg *AccountPublicAccessBlock) GetTerraformResourceType() string { + return "aws_s3_account_public_access_block" +} + +// GetConnectionDetailsMapping for this AccountPublicAccessBlock +func (tr *AccountPublicAccessBlock) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AccountPublicAccessBlock +func (tr *AccountPublicAccessBlock) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AccountPublicAccessBlock +func (tr *AccountPublicAccessBlock) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AccountPublicAccessBlock +func (tr *AccountPublicAccessBlock) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AccountPublicAccessBlock +func (tr *AccountPublicAccessBlock) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AccountPublicAccessBlock +func (tr *AccountPublicAccessBlock) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AccountPublicAccessBlock +func (tr *AccountPublicAccessBlock) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AccountPublicAccessBlock +func (tr *AccountPublicAccessBlock) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AccountPublicAccessBlock using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AccountPublicAccessBlock) LateInitialize(attrs []byte) (bool, error) { + params := &AccountPublicAccessBlockParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AccountPublicAccessBlock) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3control/v1beta1/zz_accountpublicaccessblock_types.go b/apis/s3control/v1beta1/zz_accountpublicaccessblock_types.go index 17c71a89c7..4c92ae17ae 100755 --- a/apis/s3control/v1beta1/zz_accountpublicaccessblock_types.go +++ b/apis/s3control/v1beta1/zz_accountpublicaccessblock_types.go @@ -108,13 +108,14 @@ type AccountPublicAccessBlockStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AccountPublicAccessBlock is the Schema for the AccountPublicAccessBlocks API. Manages S3 account-level Public Access Block Configuration // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AccountPublicAccessBlock struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3control/v1beta1/zz_generated.conversion_hubs.go b/apis/s3control/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..bd883a07fb --- /dev/null +++ b/apis/s3control/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AccessPoint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *AccountPublicAccessBlock) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *AccessPointPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MultiRegionAccessPoint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MultiRegionAccessPointPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ObjectLambdaAccessPoint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ObjectLambdaAccessPointPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *StorageLensConfiguration) Hub() {} diff --git a/apis/s3control/v1beta1/zz_generated_terraformed.go b/apis/s3control/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 12d26a1084..0000000000 --- a/apis/s3control/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,931 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AccessPoint -func (mg *AccessPoint) GetTerraformResourceType() string { - return "aws_s3_access_point" -} - -// GetConnectionDetailsMapping for this AccessPoint -func (tr *AccessPoint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AccessPoint -func (tr *AccessPoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AccessPoint -func (tr *AccessPoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AccessPoint -func (tr *AccessPoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AccessPoint -func (tr *AccessPoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AccessPoint -func (tr *AccessPoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AccessPoint -func (tr *AccessPoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AccessPoint -func (tr *AccessPoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AccessPoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AccessPoint) LateInitialize(attrs []byte) (bool, error) { - params := &AccessPointParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AccessPoint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this AccountPublicAccessBlock -func (mg *AccountPublicAccessBlock) GetTerraformResourceType() string { - return "aws_s3_account_public_access_block" -} - -// GetConnectionDetailsMapping for this AccountPublicAccessBlock -func (tr *AccountPublicAccessBlock) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AccountPublicAccessBlock -func (tr *AccountPublicAccessBlock) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AccountPublicAccessBlock -func (tr *AccountPublicAccessBlock) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AccountPublicAccessBlock -func (tr *AccountPublicAccessBlock) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AccountPublicAccessBlock -func (tr *AccountPublicAccessBlock) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AccountPublicAccessBlock -func (tr *AccountPublicAccessBlock) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AccountPublicAccessBlock -func (tr *AccountPublicAccessBlock) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AccountPublicAccessBlock -func (tr *AccountPublicAccessBlock) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AccountPublicAccessBlock using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AccountPublicAccessBlock) LateInitialize(attrs []byte) (bool, error) { - params := &AccountPublicAccessBlockParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AccountPublicAccessBlock) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this AccessPointPolicy -func (mg *AccessPointPolicy) GetTerraformResourceType() string { - return "aws_s3control_access_point_policy" -} - -// GetConnectionDetailsMapping for this AccessPointPolicy -func (tr *AccessPointPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AccessPointPolicy -func (tr *AccessPointPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AccessPointPolicy -func (tr *AccessPointPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AccessPointPolicy -func (tr *AccessPointPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AccessPointPolicy -func (tr *AccessPointPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AccessPointPolicy -func (tr *AccessPointPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AccessPointPolicy -func (tr *AccessPointPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AccessPointPolicy -func (tr *AccessPointPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AccessPointPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AccessPointPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &AccessPointPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AccessPointPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MultiRegionAccessPoint -func (mg *MultiRegionAccessPoint) GetTerraformResourceType() string { - return "aws_s3control_multi_region_access_point" -} - -// GetConnectionDetailsMapping for this MultiRegionAccessPoint -func (tr *MultiRegionAccessPoint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MultiRegionAccessPoint -func (tr *MultiRegionAccessPoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MultiRegionAccessPoint -func (tr *MultiRegionAccessPoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MultiRegionAccessPoint -func (tr *MultiRegionAccessPoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MultiRegionAccessPoint -func (tr *MultiRegionAccessPoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MultiRegionAccessPoint -func (tr *MultiRegionAccessPoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MultiRegionAccessPoint -func (tr *MultiRegionAccessPoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MultiRegionAccessPoint -func (tr *MultiRegionAccessPoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MultiRegionAccessPoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MultiRegionAccessPoint) LateInitialize(attrs []byte) (bool, error) { - params := &MultiRegionAccessPointParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MultiRegionAccessPoint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MultiRegionAccessPointPolicy -func (mg *MultiRegionAccessPointPolicy) GetTerraformResourceType() string { - return "aws_s3control_multi_region_access_point_policy" -} - -// GetConnectionDetailsMapping for this MultiRegionAccessPointPolicy -func (tr *MultiRegionAccessPointPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MultiRegionAccessPointPolicy -func (tr *MultiRegionAccessPointPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MultiRegionAccessPointPolicy -func (tr *MultiRegionAccessPointPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MultiRegionAccessPointPolicy -func (tr *MultiRegionAccessPointPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MultiRegionAccessPointPolicy -func (tr *MultiRegionAccessPointPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MultiRegionAccessPointPolicy -func (tr *MultiRegionAccessPointPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MultiRegionAccessPointPolicy -func (tr *MultiRegionAccessPointPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MultiRegionAccessPointPolicy -func (tr *MultiRegionAccessPointPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MultiRegionAccessPointPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MultiRegionAccessPointPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &MultiRegionAccessPointPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MultiRegionAccessPointPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ObjectLambdaAccessPoint -func (mg *ObjectLambdaAccessPoint) GetTerraformResourceType() string { - return "aws_s3control_object_lambda_access_point" -} - -// GetConnectionDetailsMapping for this ObjectLambdaAccessPoint -func (tr *ObjectLambdaAccessPoint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ObjectLambdaAccessPoint -func (tr *ObjectLambdaAccessPoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ObjectLambdaAccessPoint -func (tr *ObjectLambdaAccessPoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ObjectLambdaAccessPoint -func (tr *ObjectLambdaAccessPoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ObjectLambdaAccessPoint -func (tr *ObjectLambdaAccessPoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ObjectLambdaAccessPoint -func (tr *ObjectLambdaAccessPoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ObjectLambdaAccessPoint -func (tr *ObjectLambdaAccessPoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ObjectLambdaAccessPoint -func (tr *ObjectLambdaAccessPoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ObjectLambdaAccessPoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ObjectLambdaAccessPoint) LateInitialize(attrs []byte) (bool, error) { - params := &ObjectLambdaAccessPointParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ObjectLambdaAccessPoint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ObjectLambdaAccessPointPolicy -func (mg *ObjectLambdaAccessPointPolicy) GetTerraformResourceType() string { - return "aws_s3control_object_lambda_access_point_policy" -} - -// GetConnectionDetailsMapping for this ObjectLambdaAccessPointPolicy -func (tr *ObjectLambdaAccessPointPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ObjectLambdaAccessPointPolicy -func (tr *ObjectLambdaAccessPointPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ObjectLambdaAccessPointPolicy -func (tr *ObjectLambdaAccessPointPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ObjectLambdaAccessPointPolicy -func (tr *ObjectLambdaAccessPointPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ObjectLambdaAccessPointPolicy -func (tr *ObjectLambdaAccessPointPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ObjectLambdaAccessPointPolicy -func (tr *ObjectLambdaAccessPointPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ObjectLambdaAccessPointPolicy -func (tr *ObjectLambdaAccessPointPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ObjectLambdaAccessPointPolicy -func (tr *ObjectLambdaAccessPointPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ObjectLambdaAccessPointPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ObjectLambdaAccessPointPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &ObjectLambdaAccessPointPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ObjectLambdaAccessPointPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this StorageLensConfiguration -func (mg *StorageLensConfiguration) GetTerraformResourceType() string { - return "aws_s3control_storage_lens_configuration" -} - -// GetConnectionDetailsMapping for this StorageLensConfiguration -func (tr *StorageLensConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this StorageLensConfiguration -func (tr *StorageLensConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this StorageLensConfiguration -func (tr *StorageLensConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this StorageLensConfiguration -func (tr *StorageLensConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this StorageLensConfiguration -func (tr *StorageLensConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this StorageLensConfiguration -func (tr *StorageLensConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this StorageLensConfiguration -func (tr *StorageLensConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this StorageLensConfiguration -func (tr *StorageLensConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this StorageLensConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *StorageLensConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &StorageLensConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *StorageLensConfiguration) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/s3control/v1beta1/zz_multiregionaccesspoint_terraformed.go b/apis/s3control/v1beta1/zz_multiregionaccesspoint_terraformed.go new file mode 100755 index 0000000000..819bd794fc --- /dev/null +++ b/apis/s3control/v1beta1/zz_multiregionaccesspoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MultiRegionAccessPoint +func (mg *MultiRegionAccessPoint) GetTerraformResourceType() string { + return "aws_s3control_multi_region_access_point" +} + +// GetConnectionDetailsMapping for this MultiRegionAccessPoint +func (tr *MultiRegionAccessPoint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MultiRegionAccessPoint +func (tr *MultiRegionAccessPoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MultiRegionAccessPoint +func (tr *MultiRegionAccessPoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MultiRegionAccessPoint +func (tr *MultiRegionAccessPoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MultiRegionAccessPoint +func (tr *MultiRegionAccessPoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MultiRegionAccessPoint +func (tr *MultiRegionAccessPoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MultiRegionAccessPoint +func (tr *MultiRegionAccessPoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MultiRegionAccessPoint +func (tr *MultiRegionAccessPoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MultiRegionAccessPoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MultiRegionAccessPoint) LateInitialize(attrs []byte) (bool, error) { + params := &MultiRegionAccessPointParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MultiRegionAccessPoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3control/v1beta1/zz_multiregionaccesspoint_types.go b/apis/s3control/v1beta1/zz_multiregionaccesspoint_types.go index 2285ff58fb..d3b35a7155 100755 --- a/apis/s3control/v1beta1/zz_multiregionaccesspoint_types.go +++ b/apis/s3control/v1beta1/zz_multiregionaccesspoint_types.go @@ -215,13 +215,14 @@ type MultiRegionAccessPointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MultiRegionAccessPoint is the Schema for the MultiRegionAccessPoints API. Provides a resource to manage an S3 Multi-Region Access Point associated with specified buckets. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MultiRegionAccessPoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3control/v1beta1/zz_multiregionaccesspointpolicy_terraformed.go b/apis/s3control/v1beta1/zz_multiregionaccesspointpolicy_terraformed.go new file mode 100755 index 0000000000..1d8b5747d7 --- /dev/null +++ b/apis/s3control/v1beta1/zz_multiregionaccesspointpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MultiRegionAccessPointPolicy +func (mg *MultiRegionAccessPointPolicy) GetTerraformResourceType() string { + return "aws_s3control_multi_region_access_point_policy" +} + +// GetConnectionDetailsMapping for this MultiRegionAccessPointPolicy +func (tr *MultiRegionAccessPointPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MultiRegionAccessPointPolicy +func (tr *MultiRegionAccessPointPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MultiRegionAccessPointPolicy +func (tr *MultiRegionAccessPointPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MultiRegionAccessPointPolicy +func (tr *MultiRegionAccessPointPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MultiRegionAccessPointPolicy +func (tr *MultiRegionAccessPointPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MultiRegionAccessPointPolicy +func (tr *MultiRegionAccessPointPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MultiRegionAccessPointPolicy +func (tr *MultiRegionAccessPointPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MultiRegionAccessPointPolicy +func (tr *MultiRegionAccessPointPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MultiRegionAccessPointPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MultiRegionAccessPointPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &MultiRegionAccessPointPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MultiRegionAccessPointPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3control/v1beta1/zz_multiregionaccesspointpolicy_types.go b/apis/s3control/v1beta1/zz_multiregionaccesspointpolicy_types.go index e2342e86fe..1e3501ed7a 100755 --- a/apis/s3control/v1beta1/zz_multiregionaccesspointpolicy_types.go +++ b/apis/s3control/v1beta1/zz_multiregionaccesspointpolicy_types.go @@ -113,13 +113,14 @@ type MultiRegionAccessPointPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MultiRegionAccessPointPolicy is the Schema for the MultiRegionAccessPointPolicys API. Provides a resource to manage an S3 Multi-Region Access Point access control policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MultiRegionAccessPointPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3control/v1beta1/zz_objectlambdaaccesspoint_terraformed.go b/apis/s3control/v1beta1/zz_objectlambdaaccesspoint_terraformed.go new file mode 100755 index 0000000000..4a868e8848 --- /dev/null +++ b/apis/s3control/v1beta1/zz_objectlambdaaccesspoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ObjectLambdaAccessPoint +func (mg *ObjectLambdaAccessPoint) GetTerraformResourceType() string { + return "aws_s3control_object_lambda_access_point" +} + +// GetConnectionDetailsMapping for this ObjectLambdaAccessPoint +func (tr *ObjectLambdaAccessPoint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ObjectLambdaAccessPoint +func (tr *ObjectLambdaAccessPoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ObjectLambdaAccessPoint +func (tr *ObjectLambdaAccessPoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ObjectLambdaAccessPoint +func (tr *ObjectLambdaAccessPoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ObjectLambdaAccessPoint +func (tr *ObjectLambdaAccessPoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ObjectLambdaAccessPoint +func (tr *ObjectLambdaAccessPoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ObjectLambdaAccessPoint +func (tr *ObjectLambdaAccessPoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ObjectLambdaAccessPoint +func (tr *ObjectLambdaAccessPoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ObjectLambdaAccessPoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ObjectLambdaAccessPoint) LateInitialize(attrs []byte) (bool, error) { + params := &ObjectLambdaAccessPointParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ObjectLambdaAccessPoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3control/v1beta1/zz_objectlambdaaccesspoint_types.go b/apis/s3control/v1beta1/zz_objectlambdaaccesspoint_types.go index 628c8b0341..539ade1f02 100755 --- a/apis/s3control/v1beta1/zz_objectlambdaaccesspoint_types.go +++ b/apis/s3control/v1beta1/zz_objectlambdaaccesspoint_types.go @@ -263,13 +263,14 @@ type ObjectLambdaAccessPointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ObjectLambdaAccessPoint is the Schema for the ObjectLambdaAccessPoints API. Provides a resource to manage an S3 Object Lambda Access Point. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ObjectLambdaAccessPoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3control/v1beta1/zz_objectlambdaaccesspointpolicy_terraformed.go b/apis/s3control/v1beta1/zz_objectlambdaaccesspointpolicy_terraformed.go new file mode 100755 index 0000000000..29ceb2cdb4 --- /dev/null +++ b/apis/s3control/v1beta1/zz_objectlambdaaccesspointpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ObjectLambdaAccessPointPolicy +func (mg *ObjectLambdaAccessPointPolicy) GetTerraformResourceType() string { + return "aws_s3control_object_lambda_access_point_policy" +} + +// GetConnectionDetailsMapping for this ObjectLambdaAccessPointPolicy +func (tr *ObjectLambdaAccessPointPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ObjectLambdaAccessPointPolicy +func (tr *ObjectLambdaAccessPointPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ObjectLambdaAccessPointPolicy +func (tr *ObjectLambdaAccessPointPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ObjectLambdaAccessPointPolicy +func (tr *ObjectLambdaAccessPointPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ObjectLambdaAccessPointPolicy +func (tr *ObjectLambdaAccessPointPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ObjectLambdaAccessPointPolicy +func (tr *ObjectLambdaAccessPointPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ObjectLambdaAccessPointPolicy +func (tr *ObjectLambdaAccessPointPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ObjectLambdaAccessPointPolicy +func (tr *ObjectLambdaAccessPointPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ObjectLambdaAccessPointPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ObjectLambdaAccessPointPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &ObjectLambdaAccessPointPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ObjectLambdaAccessPointPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3control/v1beta1/zz_objectlambdaaccesspointpolicy_types.go b/apis/s3control/v1beta1/zz_objectlambdaaccesspointpolicy_types.go index bb246f4ec0..7192406a74 100755 --- a/apis/s3control/v1beta1/zz_objectlambdaaccesspointpolicy_types.go +++ b/apis/s3control/v1beta1/zz_objectlambdaaccesspointpolicy_types.go @@ -111,13 +111,14 @@ type ObjectLambdaAccessPointPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ObjectLambdaAccessPointPolicy is the Schema for the ObjectLambdaAccessPointPolicys API. Provides a resource to manage an S3 Object Lambda Access Point resource policy. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ObjectLambdaAccessPointPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/s3control/v1beta1/zz_storagelensconfiguration_terraformed.go b/apis/s3control/v1beta1/zz_storagelensconfiguration_terraformed.go new file mode 100755 index 0000000000..84b65a42eb --- /dev/null +++ b/apis/s3control/v1beta1/zz_storagelensconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this StorageLensConfiguration +func (mg *StorageLensConfiguration) GetTerraformResourceType() string { + return "aws_s3control_storage_lens_configuration" +} + +// GetConnectionDetailsMapping for this StorageLensConfiguration +func (tr *StorageLensConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this StorageLensConfiguration +func (tr *StorageLensConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this StorageLensConfiguration +func (tr *StorageLensConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this StorageLensConfiguration +func (tr *StorageLensConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this StorageLensConfiguration +func (tr *StorageLensConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this StorageLensConfiguration +func (tr *StorageLensConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this StorageLensConfiguration +func (tr *StorageLensConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this StorageLensConfiguration +func (tr *StorageLensConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this StorageLensConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *StorageLensConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &StorageLensConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *StorageLensConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/s3control/v1beta1/zz_storagelensconfiguration_types.go b/apis/s3control/v1beta1/zz_storagelensconfiguration_types.go index 82488e4eb7..586efae0a5 100755 --- a/apis/s3control/v1beta1/zz_storagelensconfiguration_types.go +++ b/apis/s3control/v1beta1/zz_storagelensconfiguration_types.go @@ -816,13 +816,14 @@ type StorageLensConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // StorageLensConfiguration is the Schema for the StorageLensConfigurations API. Provides a resource to manage an S3 Storage Lens configuration. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type StorageLensConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_app_terraformed.go b/apis/sagemaker/v1beta1/zz_app_terraformed.go new file mode 100755 index 0000000000..6e022faded --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_app_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this App +func (mg *App) GetTerraformResourceType() string { + return "aws_sagemaker_app" +} + +// GetConnectionDetailsMapping for this App +func (tr *App) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this App +func (tr *App) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this App +func (tr *App) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this App +func (tr *App) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this App +func (tr *App) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this App +func (tr *App) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this App +func (tr *App) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this App +func (tr *App) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this App using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *App) LateInitialize(attrs []byte) (bool, error) { + params := &AppParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *App) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_app_types.go b/apis/sagemaker/v1beta1/zz_app_types.go index 2e554c3e41..470938dd71 100755 --- a/apis/sagemaker/v1beta1/zz_app_types.go +++ b/apis/sagemaker/v1beta1/zz_app_types.go @@ -227,13 +227,14 @@ type AppStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // App is the Schema for the Apps API. Provides a SageMaker App resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type App struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_appimageconfig_terraformed.go b/apis/sagemaker/v1beta1/zz_appimageconfig_terraformed.go new file mode 100755 index 0000000000..7f8a5fcd44 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_appimageconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AppImageConfig +func (mg *AppImageConfig) GetTerraformResourceType() string { + return "aws_sagemaker_app_image_config" +} + +// GetConnectionDetailsMapping for this AppImageConfig +func (tr *AppImageConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AppImageConfig +func (tr *AppImageConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AppImageConfig +func (tr *AppImageConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AppImageConfig +func (tr *AppImageConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AppImageConfig +func (tr *AppImageConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AppImageConfig +func (tr *AppImageConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AppImageConfig +func (tr *AppImageConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AppImageConfig +func (tr *AppImageConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AppImageConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AppImageConfig) LateInitialize(attrs []byte) (bool, error) { + params := &AppImageConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AppImageConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_appimageconfig_types.go b/apis/sagemaker/v1beta1/zz_appimageconfig_types.go index 8547b35e4d..3d93985a4e 100755 --- a/apis/sagemaker/v1beta1/zz_appimageconfig_types.go +++ b/apis/sagemaker/v1beta1/zz_appimageconfig_types.go @@ -185,13 +185,14 @@ type AppImageConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AppImageConfig is the Schema for the AppImageConfigs API. Provides a SageMaker App Image Config resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AppImageConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_coderepository_terraformed.go b/apis/sagemaker/v1beta1/zz_coderepository_terraformed.go new file mode 100755 index 0000000000..0b629965a7 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_coderepository_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CodeRepository +func (mg *CodeRepository) GetTerraformResourceType() string { + return "aws_sagemaker_code_repository" +} + +// GetConnectionDetailsMapping for this CodeRepository +func (tr *CodeRepository) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CodeRepository +func (tr *CodeRepository) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CodeRepository +func (tr *CodeRepository) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CodeRepository +func (tr *CodeRepository) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CodeRepository +func (tr *CodeRepository) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CodeRepository +func (tr *CodeRepository) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CodeRepository +func (tr *CodeRepository) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CodeRepository +func (tr *CodeRepository) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CodeRepository using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CodeRepository) LateInitialize(attrs []byte) (bool, error) { + params := &CodeRepositoryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CodeRepository) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_coderepository_types.go b/apis/sagemaker/v1beta1/zz_coderepository_types.go index 25dfba541f..e8fb3e5aa5 100755 --- a/apis/sagemaker/v1beta1/zz_coderepository_types.go +++ b/apis/sagemaker/v1beta1/zz_coderepository_types.go @@ -147,13 +147,14 @@ type CodeRepositoryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CodeRepository is the Schema for the CodeRepositorys API. Provides a SageMaker Code Repository resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CodeRepository struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_device_terraformed.go b/apis/sagemaker/v1beta1/zz_device_terraformed.go new file mode 100755 index 0000000000..36e5676661 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_device_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Device +func (mg *Device) GetTerraformResourceType() string { + return "aws_sagemaker_device" +} + +// GetConnectionDetailsMapping for this Device +func (tr *Device) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Device +func (tr *Device) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Device +func (tr *Device) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Device +func (tr *Device) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Device +func (tr *Device) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Device +func (tr *Device) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Device +func (tr *Device) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Device +func (tr *Device) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Device using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Device) LateInitialize(attrs []byte) (bool, error) { + params := &DeviceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Device) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_device_types.go b/apis/sagemaker/v1beta1/zz_device_types.go index a5faf69424..6a0a6a71db 100755 --- a/apis/sagemaker/v1beta1/zz_device_types.go +++ b/apis/sagemaker/v1beta1/zz_device_types.go @@ -139,13 +139,14 @@ type DeviceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Device is the Schema for the Devices API. Provides a SageMaker Device resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Device struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_devicefleet_terraformed.go b/apis/sagemaker/v1beta1/zz_devicefleet_terraformed.go new file mode 100755 index 0000000000..cf816ce772 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_devicefleet_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DeviceFleet +func (mg *DeviceFleet) GetTerraformResourceType() string { + return "aws_sagemaker_device_fleet" +} + +// GetConnectionDetailsMapping for this DeviceFleet +func (tr *DeviceFleet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DeviceFleet +func (tr *DeviceFleet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DeviceFleet +func (tr *DeviceFleet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DeviceFleet +func (tr *DeviceFleet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DeviceFleet +func (tr *DeviceFleet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DeviceFleet +func (tr *DeviceFleet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DeviceFleet +func (tr *DeviceFleet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DeviceFleet +func (tr *DeviceFleet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DeviceFleet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DeviceFleet) LateInitialize(attrs []byte) (bool, error) { + params := &DeviceFleetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DeviceFleet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_devicefleet_types.go b/apis/sagemaker/v1beta1/zz_devicefleet_types.go index 23cd1ddb5a..a823c73730 100755 --- a/apis/sagemaker/v1beta1/zz_devicefleet_types.go +++ b/apis/sagemaker/v1beta1/zz_devicefleet_types.go @@ -169,13 +169,14 @@ type DeviceFleetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DeviceFleet is the Schema for the DeviceFleets API. Provides a SageMaker Device Fleet resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws},path=devicefleet type DeviceFleet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_domain_terraformed.go b/apis/sagemaker/v1beta1/zz_domain_terraformed.go new file mode 100755 index 0000000000..8fb2af66eb --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_domain_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Domain +func (mg *Domain) GetTerraformResourceType() string { + return "aws_sagemaker_domain" +} + +// GetConnectionDetailsMapping for this Domain +func (tr *Domain) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Domain +func (tr *Domain) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Domain +func (tr *Domain) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Domain +func (tr *Domain) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Domain +func (tr *Domain) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Domain +func (tr *Domain) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Domain +func (tr *Domain) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Domain +func (tr *Domain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Domain using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Domain) LateInitialize(attrs []byte) (bool, error) { + params := &DomainParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Domain) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_domain_types.go b/apis/sagemaker/v1beta1/zz_domain_types.go index 4d11ed6165..0b33922786 100755 --- a/apis/sagemaker/v1beta1/zz_domain_types.go +++ b/apis/sagemaker/v1beta1/zz_domain_types.go @@ -1449,13 +1449,14 @@ type DomainStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Domain is the Schema for the Domains API. Provides a SageMaker Domain resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Domain struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_endpoint_terraformed.go b/apis/sagemaker/v1beta1/zz_endpoint_terraformed.go new file mode 100755 index 0000000000..36e4b7854b --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_endpoint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Endpoint +func (mg *Endpoint) GetTerraformResourceType() string { + return "aws_sagemaker_endpoint" +} + +// GetConnectionDetailsMapping for this Endpoint +func (tr *Endpoint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Endpoint +func (tr *Endpoint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Endpoint +func (tr *Endpoint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Endpoint +func (tr *Endpoint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Endpoint +func (tr *Endpoint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Endpoint +func (tr *Endpoint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Endpoint +func (tr *Endpoint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Endpoint +func (tr *Endpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Endpoint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Endpoint) LateInitialize(attrs []byte) (bool, error) { + params := &EndpointParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Endpoint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_endpoint_types.go b/apis/sagemaker/v1beta1/zz_endpoint_types.go index 7cef77e01c..c873781b15 100755 --- a/apis/sagemaker/v1beta1/zz_endpoint_types.go +++ b/apis/sagemaker/v1beta1/zz_endpoint_types.go @@ -328,13 +328,14 @@ type EndpointStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Endpoint is the Schema for the Endpoints API. Provides a SageMaker Endpoint resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Endpoint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_endpointconfiguration_terraformed.go b/apis/sagemaker/v1beta1/zz_endpointconfiguration_terraformed.go new file mode 100755 index 0000000000..b1443da57d --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_endpointconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EndpointConfiguration +func (mg *EndpointConfiguration) GetTerraformResourceType() string { + return "aws_sagemaker_endpoint_configuration" +} + +// GetConnectionDetailsMapping for this EndpointConfiguration +func (tr *EndpointConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EndpointConfiguration +func (tr *EndpointConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EndpointConfiguration +func (tr *EndpointConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EndpointConfiguration +func (tr *EndpointConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EndpointConfiguration +func (tr *EndpointConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EndpointConfiguration +func (tr *EndpointConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EndpointConfiguration +func (tr *EndpointConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EndpointConfiguration +func (tr *EndpointConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EndpointConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EndpointConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &EndpointConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EndpointConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_endpointconfiguration_types.go b/apis/sagemaker/v1beta1/zz_endpointconfiguration_types.go index e6d5124105..d02dc3431e 100755 --- a/apis/sagemaker/v1beta1/zz_endpointconfiguration_types.go +++ b/apis/sagemaker/v1beta1/zz_endpointconfiguration_types.go @@ -799,13 +799,14 @@ type EndpointConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EndpointConfiguration is the Schema for the EndpointConfigurations API. Provides a SageMaker Endpoint Configuration resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EndpointConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_featuregroup_terraformed.go b/apis/sagemaker/v1beta1/zz_featuregroup_terraformed.go new file mode 100755 index 0000000000..f43e85ebc3 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_featuregroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FeatureGroup +func (mg *FeatureGroup) GetTerraformResourceType() string { + return "aws_sagemaker_feature_group" +} + +// GetConnectionDetailsMapping for this FeatureGroup +func (tr *FeatureGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FeatureGroup +func (tr *FeatureGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FeatureGroup +func (tr *FeatureGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FeatureGroup +func (tr *FeatureGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FeatureGroup +func (tr *FeatureGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FeatureGroup +func (tr *FeatureGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FeatureGroup +func (tr *FeatureGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FeatureGroup +func (tr *FeatureGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FeatureGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FeatureGroup) LateInitialize(attrs []byte) (bool, error) { + params := &FeatureGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FeatureGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_featuregroup_types.go b/apis/sagemaker/v1beta1/zz_featuregroup_types.go index ed1487749d..4728181b58 100755 --- a/apis/sagemaker/v1beta1/zz_featuregroup_types.go +++ b/apis/sagemaker/v1beta1/zz_featuregroup_types.go @@ -361,13 +361,14 @@ type FeatureGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FeatureGroup is the Schema for the FeatureGroups API. Provides a SageMaker Feature Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FeatureGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_generated.conversion_hubs.go b/apis/sagemaker/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..6449236cb6 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *App) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *AppImageConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CodeRepository) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Device) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DeviceFleet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Domain) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Endpoint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EndpointConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FeatureGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Image) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ImageVersion) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Model) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ModelPackageGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ModelPackageGroupPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NotebookInstance) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *NotebookInstanceLifecycleConfiguration) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ServicecatalogPortfolioStatus) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Space) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *StudioLifecycleConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *UserProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Workforce) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Workteam) Hub() {} diff --git a/apis/sagemaker/v1beta1/zz_generated_terraformed.go b/apis/sagemaker/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 2aed4d2c53..0000000000 --- a/apis/sagemaker/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,2528 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this App -func (mg *App) GetTerraformResourceType() string { - return "aws_sagemaker_app" -} - -// GetConnectionDetailsMapping for this App -func (tr *App) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this App -func (tr *App) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this App -func (tr *App) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this App -func (tr *App) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this App -func (tr *App) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this App -func (tr *App) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this App -func (tr *App) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this App -func (tr *App) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this App using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *App) LateInitialize(attrs []byte) (bool, error) { - params := &AppParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *App) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this AppImageConfig -func (mg *AppImageConfig) GetTerraformResourceType() string { - return "aws_sagemaker_app_image_config" -} - -// GetConnectionDetailsMapping for this AppImageConfig -func (tr *AppImageConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AppImageConfig -func (tr *AppImageConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AppImageConfig -func (tr *AppImageConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AppImageConfig -func (tr *AppImageConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AppImageConfig -func (tr *AppImageConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AppImageConfig -func (tr *AppImageConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AppImageConfig -func (tr *AppImageConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AppImageConfig -func (tr *AppImageConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AppImageConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AppImageConfig) LateInitialize(attrs []byte) (bool, error) { - params := &AppImageConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AppImageConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CodeRepository -func (mg *CodeRepository) GetTerraformResourceType() string { - return "aws_sagemaker_code_repository" -} - -// GetConnectionDetailsMapping for this CodeRepository -func (tr *CodeRepository) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CodeRepository -func (tr *CodeRepository) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CodeRepository -func (tr *CodeRepository) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CodeRepository -func (tr *CodeRepository) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CodeRepository -func (tr *CodeRepository) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CodeRepository -func (tr *CodeRepository) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CodeRepository -func (tr *CodeRepository) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CodeRepository -func (tr *CodeRepository) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CodeRepository using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CodeRepository) LateInitialize(attrs []byte) (bool, error) { - params := &CodeRepositoryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CodeRepository) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Device -func (mg *Device) GetTerraformResourceType() string { - return "aws_sagemaker_device" -} - -// GetConnectionDetailsMapping for this Device -func (tr *Device) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Device -func (tr *Device) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Device -func (tr *Device) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Device -func (tr *Device) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Device -func (tr *Device) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Device -func (tr *Device) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Device -func (tr *Device) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Device -func (tr *Device) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Device using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Device) LateInitialize(attrs []byte) (bool, error) { - params := &DeviceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Device) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DeviceFleet -func (mg *DeviceFleet) GetTerraformResourceType() string { - return "aws_sagemaker_device_fleet" -} - -// GetConnectionDetailsMapping for this DeviceFleet -func (tr *DeviceFleet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DeviceFleet -func (tr *DeviceFleet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DeviceFleet -func (tr *DeviceFleet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DeviceFleet -func (tr *DeviceFleet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DeviceFleet -func (tr *DeviceFleet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DeviceFleet -func (tr *DeviceFleet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DeviceFleet -func (tr *DeviceFleet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DeviceFleet -func (tr *DeviceFleet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DeviceFleet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DeviceFleet) LateInitialize(attrs []byte) (bool, error) { - params := &DeviceFleetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DeviceFleet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Domain -func (mg *Domain) GetTerraformResourceType() string { - return "aws_sagemaker_domain" -} - -// GetConnectionDetailsMapping for this Domain -func (tr *Domain) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Domain -func (tr *Domain) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Domain -func (tr *Domain) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Domain -func (tr *Domain) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Domain -func (tr *Domain) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Domain -func (tr *Domain) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Domain -func (tr *Domain) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Domain -func (tr *Domain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Domain using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Domain) LateInitialize(attrs []byte) (bool, error) { - params := &DomainParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Domain) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Endpoint -func (mg *Endpoint) GetTerraformResourceType() string { - return "aws_sagemaker_endpoint" -} - -// GetConnectionDetailsMapping for this Endpoint -func (tr *Endpoint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Endpoint -func (tr *Endpoint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Endpoint -func (tr *Endpoint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Endpoint -func (tr *Endpoint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Endpoint -func (tr *Endpoint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Endpoint -func (tr *Endpoint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Endpoint -func (tr *Endpoint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Endpoint -func (tr *Endpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Endpoint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Endpoint) LateInitialize(attrs []byte) (bool, error) { - params := &EndpointParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Endpoint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EndpointConfiguration -func (mg *EndpointConfiguration) GetTerraformResourceType() string { - return "aws_sagemaker_endpoint_configuration" -} - -// GetConnectionDetailsMapping for this EndpointConfiguration -func (tr *EndpointConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EndpointConfiguration -func (tr *EndpointConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EndpointConfiguration -func (tr *EndpointConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EndpointConfiguration -func (tr *EndpointConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EndpointConfiguration -func (tr *EndpointConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EndpointConfiguration -func (tr *EndpointConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EndpointConfiguration -func (tr *EndpointConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EndpointConfiguration -func (tr *EndpointConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EndpointConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EndpointConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &EndpointConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EndpointConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FeatureGroup -func (mg *FeatureGroup) GetTerraformResourceType() string { - return "aws_sagemaker_feature_group" -} - -// GetConnectionDetailsMapping for this FeatureGroup -func (tr *FeatureGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FeatureGroup -func (tr *FeatureGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FeatureGroup -func (tr *FeatureGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FeatureGroup -func (tr *FeatureGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FeatureGroup -func (tr *FeatureGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FeatureGroup -func (tr *FeatureGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FeatureGroup -func (tr *FeatureGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FeatureGroup -func (tr *FeatureGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FeatureGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FeatureGroup) LateInitialize(attrs []byte) (bool, error) { - params := &FeatureGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FeatureGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Image -func (mg *Image) GetTerraformResourceType() string { - return "aws_sagemaker_image" -} - -// GetConnectionDetailsMapping for this Image -func (tr *Image) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Image -func (tr *Image) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Image -func (tr *Image) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Image -func (tr *Image) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Image -func (tr *Image) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Image -func (tr *Image) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Image -func (tr *Image) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Image -func (tr *Image) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Image using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Image) LateInitialize(attrs []byte) (bool, error) { - params := &ImageParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Image) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ImageVersion -func (mg *ImageVersion) GetTerraformResourceType() string { - return "aws_sagemaker_image_version" -} - -// GetConnectionDetailsMapping for this ImageVersion -func (tr *ImageVersion) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ImageVersion -func (tr *ImageVersion) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ImageVersion -func (tr *ImageVersion) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ImageVersion -func (tr *ImageVersion) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ImageVersion -func (tr *ImageVersion) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ImageVersion -func (tr *ImageVersion) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ImageVersion -func (tr *ImageVersion) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ImageVersion -func (tr *ImageVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ImageVersion using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ImageVersion) LateInitialize(attrs []byte) (bool, error) { - params := &ImageVersionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ImageVersion) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Model -func (mg *Model) GetTerraformResourceType() string { - return "aws_sagemaker_model" -} - -// GetConnectionDetailsMapping for this Model -func (tr *Model) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Model -func (tr *Model) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Model -func (tr *Model) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Model -func (tr *Model) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Model -func (tr *Model) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Model -func (tr *Model) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Model -func (tr *Model) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Model -func (tr *Model) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Model using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Model) LateInitialize(attrs []byte) (bool, error) { - params := &ModelParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Model) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ModelPackageGroup -func (mg *ModelPackageGroup) GetTerraformResourceType() string { - return "aws_sagemaker_model_package_group" -} - -// GetConnectionDetailsMapping for this ModelPackageGroup -func (tr *ModelPackageGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ModelPackageGroup -func (tr *ModelPackageGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ModelPackageGroup -func (tr *ModelPackageGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ModelPackageGroup -func (tr *ModelPackageGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ModelPackageGroup -func (tr *ModelPackageGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ModelPackageGroup -func (tr *ModelPackageGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ModelPackageGroup -func (tr *ModelPackageGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ModelPackageGroup -func (tr *ModelPackageGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ModelPackageGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ModelPackageGroup) LateInitialize(attrs []byte) (bool, error) { - params := &ModelPackageGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ModelPackageGroup) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ModelPackageGroupPolicy -func (mg *ModelPackageGroupPolicy) GetTerraformResourceType() string { - return "aws_sagemaker_model_package_group_policy" -} - -// GetConnectionDetailsMapping for this ModelPackageGroupPolicy -func (tr *ModelPackageGroupPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ModelPackageGroupPolicy -func (tr *ModelPackageGroupPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ModelPackageGroupPolicy -func (tr *ModelPackageGroupPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ModelPackageGroupPolicy -func (tr *ModelPackageGroupPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ModelPackageGroupPolicy -func (tr *ModelPackageGroupPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ModelPackageGroupPolicy -func (tr *ModelPackageGroupPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ModelPackageGroupPolicy -func (tr *ModelPackageGroupPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ModelPackageGroupPolicy -func (tr *ModelPackageGroupPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ModelPackageGroupPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ModelPackageGroupPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &ModelPackageGroupPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ModelPackageGroupPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NotebookInstance -func (mg *NotebookInstance) GetTerraformResourceType() string { - return "aws_sagemaker_notebook_instance" -} - -// GetConnectionDetailsMapping for this NotebookInstance -func (tr *NotebookInstance) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NotebookInstance -func (tr *NotebookInstance) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NotebookInstance -func (tr *NotebookInstance) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NotebookInstance -func (tr *NotebookInstance) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NotebookInstance -func (tr *NotebookInstance) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NotebookInstance -func (tr *NotebookInstance) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NotebookInstance -func (tr *NotebookInstance) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NotebookInstance -func (tr *NotebookInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NotebookInstance using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NotebookInstance) LateInitialize(attrs []byte) (bool, error) { - params := &NotebookInstanceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NotebookInstance) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this NotebookInstanceLifecycleConfiguration -func (mg *NotebookInstanceLifecycleConfiguration) GetTerraformResourceType() string { - return "aws_sagemaker_notebook_instance_lifecycle_configuration" -} - -// GetConnectionDetailsMapping for this NotebookInstanceLifecycleConfiguration -func (tr *NotebookInstanceLifecycleConfiguration) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this NotebookInstanceLifecycleConfiguration -func (tr *NotebookInstanceLifecycleConfiguration) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this NotebookInstanceLifecycleConfiguration -func (tr *NotebookInstanceLifecycleConfiguration) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this NotebookInstanceLifecycleConfiguration -func (tr *NotebookInstanceLifecycleConfiguration) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this NotebookInstanceLifecycleConfiguration -func (tr *NotebookInstanceLifecycleConfiguration) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this NotebookInstanceLifecycleConfiguration -func (tr *NotebookInstanceLifecycleConfiguration) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this NotebookInstanceLifecycleConfiguration -func (tr *NotebookInstanceLifecycleConfiguration) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this NotebookInstanceLifecycleConfiguration -func (tr *NotebookInstanceLifecycleConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this NotebookInstanceLifecycleConfiguration using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NotebookInstanceLifecycleConfiguration) LateInitialize(attrs []byte) (bool, error) { - params := &NotebookInstanceLifecycleConfigurationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *NotebookInstanceLifecycleConfiguration) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ServicecatalogPortfolioStatus -func (mg *ServicecatalogPortfolioStatus) GetTerraformResourceType() string { - return "aws_sagemaker_servicecatalog_portfolio_status" -} - -// GetConnectionDetailsMapping for this ServicecatalogPortfolioStatus -func (tr *ServicecatalogPortfolioStatus) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ServicecatalogPortfolioStatus -func (tr *ServicecatalogPortfolioStatus) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ServicecatalogPortfolioStatus -func (tr *ServicecatalogPortfolioStatus) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ServicecatalogPortfolioStatus -func (tr *ServicecatalogPortfolioStatus) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ServicecatalogPortfolioStatus -func (tr *ServicecatalogPortfolioStatus) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ServicecatalogPortfolioStatus -func (tr *ServicecatalogPortfolioStatus) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ServicecatalogPortfolioStatus -func (tr *ServicecatalogPortfolioStatus) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ServicecatalogPortfolioStatus -func (tr *ServicecatalogPortfolioStatus) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ServicecatalogPortfolioStatus using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ServicecatalogPortfolioStatus) LateInitialize(attrs []byte) (bool, error) { - params := &ServicecatalogPortfolioStatusParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ServicecatalogPortfolioStatus) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Space -func (mg *Space) GetTerraformResourceType() string { - return "aws_sagemaker_space" -} - -// GetConnectionDetailsMapping for this Space -func (tr *Space) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Space -func (tr *Space) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Space -func (tr *Space) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Space -func (tr *Space) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Space -func (tr *Space) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Space -func (tr *Space) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Space -func (tr *Space) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Space -func (tr *Space) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Space using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Space) LateInitialize(attrs []byte) (bool, error) { - params := &SpaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Space) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this StudioLifecycleConfig -func (mg *StudioLifecycleConfig) GetTerraformResourceType() string { - return "aws_sagemaker_studio_lifecycle_config" -} - -// GetConnectionDetailsMapping for this StudioLifecycleConfig -func (tr *StudioLifecycleConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this StudioLifecycleConfig -func (tr *StudioLifecycleConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this StudioLifecycleConfig -func (tr *StudioLifecycleConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this StudioLifecycleConfig -func (tr *StudioLifecycleConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this StudioLifecycleConfig -func (tr *StudioLifecycleConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this StudioLifecycleConfig -func (tr *StudioLifecycleConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this StudioLifecycleConfig -func (tr *StudioLifecycleConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this StudioLifecycleConfig -func (tr *StudioLifecycleConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this StudioLifecycleConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *StudioLifecycleConfig) LateInitialize(attrs []byte) (bool, error) { - params := &StudioLifecycleConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *StudioLifecycleConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this UserProfile -func (mg *UserProfile) GetTerraformResourceType() string { - return "aws_sagemaker_user_profile" -} - -// GetConnectionDetailsMapping for this UserProfile -func (tr *UserProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this UserProfile -func (tr *UserProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this UserProfile -func (tr *UserProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this UserProfile -func (tr *UserProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this UserProfile -func (tr *UserProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this UserProfile -func (tr *UserProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this UserProfile -func (tr *UserProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this UserProfile -func (tr *UserProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this UserProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *UserProfile) LateInitialize(attrs []byte) (bool, error) { - params := &UserProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *UserProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Workforce -func (mg *Workforce) GetTerraformResourceType() string { - return "aws_sagemaker_workforce" -} - -// GetConnectionDetailsMapping for this Workforce -func (tr *Workforce) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"oidc_config[*].client_secret": "spec.forProvider.oidcConfig[*].clientSecretSecretRef"} -} - -// GetObservation of this Workforce -func (tr *Workforce) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Workforce -func (tr *Workforce) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Workforce -func (tr *Workforce) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Workforce -func (tr *Workforce) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Workforce -func (tr *Workforce) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Workforce -func (tr *Workforce) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Workforce -func (tr *Workforce) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Workforce using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Workforce) LateInitialize(attrs []byte) (bool, error) { - params := &WorkforceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - opts = append(opts, resource.WithNameFilter("SourceIPConfig")) - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Workforce) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Workteam -func (mg *Workteam) GetTerraformResourceType() string { - return "aws_sagemaker_workteam" -} - -// GetConnectionDetailsMapping for this Workteam -func (tr *Workteam) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Workteam -func (tr *Workteam) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Workteam -func (tr *Workteam) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Workteam -func (tr *Workteam) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Workteam -func (tr *Workteam) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Workteam -func (tr *Workteam) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Workteam -func (tr *Workteam) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Workteam -func (tr *Workteam) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Workteam using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Workteam) LateInitialize(attrs []byte) (bool, error) { - params := &WorkteamParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Workteam) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/sagemaker/v1beta1/zz_image_terraformed.go b/apis/sagemaker/v1beta1/zz_image_terraformed.go new file mode 100755 index 0000000000..9a6a9e34c1 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_image_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Image +func (mg *Image) GetTerraformResourceType() string { + return "aws_sagemaker_image" +} + +// GetConnectionDetailsMapping for this Image +func (tr *Image) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Image +func (tr *Image) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Image +func (tr *Image) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Image +func (tr *Image) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Image +func (tr *Image) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Image +func (tr *Image) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Image +func (tr *Image) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Image +func (tr *Image) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Image using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Image) LateInitialize(attrs []byte) (bool, error) { + params := &ImageParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Image) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_image_types.go b/apis/sagemaker/v1beta1/zz_image_types.go index 586e5495e4..b2be7cfcf2 100755 --- a/apis/sagemaker/v1beta1/zz_image_types.go +++ b/apis/sagemaker/v1beta1/zz_image_types.go @@ -128,13 +128,14 @@ type ImageStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Image is the Schema for the Images API. Provides a SageMaker Image resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Image struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_imageversion_terraformed.go b/apis/sagemaker/v1beta1/zz_imageversion_terraformed.go new file mode 100755 index 0000000000..8d777e5c60 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_imageversion_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ImageVersion +func (mg *ImageVersion) GetTerraformResourceType() string { + return "aws_sagemaker_image_version" +} + +// GetConnectionDetailsMapping for this ImageVersion +func (tr *ImageVersion) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ImageVersion +func (tr *ImageVersion) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ImageVersion +func (tr *ImageVersion) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ImageVersion +func (tr *ImageVersion) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ImageVersion +func (tr *ImageVersion) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ImageVersion +func (tr *ImageVersion) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ImageVersion +func (tr *ImageVersion) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ImageVersion +func (tr *ImageVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ImageVersion using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ImageVersion) LateInitialize(attrs []byte) (bool, error) { + params := &ImageVersionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ImageVersion) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_imageversion_types.go b/apis/sagemaker/v1beta1/zz_imageversion_types.go index 82b1ebc03e..4a1433494b 100755 --- a/apis/sagemaker/v1beta1/zz_imageversion_types.go +++ b/apis/sagemaker/v1beta1/zz_imageversion_types.go @@ -109,13 +109,14 @@ type ImageVersionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ImageVersion is the Schema for the ImageVersions API. Provides a SageMaker Image Version resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ImageVersion struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_model_terraformed.go b/apis/sagemaker/v1beta1/zz_model_terraformed.go new file mode 100755 index 0000000000..651a24ae4a --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_model_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Model +func (mg *Model) GetTerraformResourceType() string { + return "aws_sagemaker_model" +} + +// GetConnectionDetailsMapping for this Model +func (tr *Model) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Model +func (tr *Model) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Model +func (tr *Model) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Model +func (tr *Model) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Model +func (tr *Model) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Model +func (tr *Model) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Model +func (tr *Model) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Model +func (tr *Model) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Model using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Model) LateInitialize(attrs []byte) (bool, error) { + params := &ModelParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Model) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_model_types.go b/apis/sagemaker/v1beta1/zz_model_types.go index 92269bd3d5..2f2e78ed51 100755 --- a/apis/sagemaker/v1beta1/zz_model_types.go +++ b/apis/sagemaker/v1beta1/zz_model_types.go @@ -451,13 +451,14 @@ type ModelStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Model is the Schema for the Models API. Provides a SageMaker model resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Model struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_modelpackagegroup_terraformed.go b/apis/sagemaker/v1beta1/zz_modelpackagegroup_terraformed.go new file mode 100755 index 0000000000..2f7b2a4763 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_modelpackagegroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ModelPackageGroup +func (mg *ModelPackageGroup) GetTerraformResourceType() string { + return "aws_sagemaker_model_package_group" +} + +// GetConnectionDetailsMapping for this ModelPackageGroup +func (tr *ModelPackageGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ModelPackageGroup +func (tr *ModelPackageGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ModelPackageGroup +func (tr *ModelPackageGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ModelPackageGroup +func (tr *ModelPackageGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ModelPackageGroup +func (tr *ModelPackageGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ModelPackageGroup +func (tr *ModelPackageGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ModelPackageGroup +func (tr *ModelPackageGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ModelPackageGroup +func (tr *ModelPackageGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ModelPackageGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ModelPackageGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ModelPackageGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ModelPackageGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_modelpackagegroup_types.go b/apis/sagemaker/v1beta1/zz_modelpackagegroup_types.go index 70d9d4c467..856ccf5bf3 100755 --- a/apis/sagemaker/v1beta1/zz_modelpackagegroup_types.go +++ b/apis/sagemaker/v1beta1/zz_modelpackagegroup_types.go @@ -88,13 +88,14 @@ type ModelPackageGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ModelPackageGroup is the Schema for the ModelPackageGroups API. Provides a SageMaker Model Package Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ModelPackageGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_modelpackagegrouppolicy_terraformed.go b/apis/sagemaker/v1beta1/zz_modelpackagegrouppolicy_terraformed.go new file mode 100755 index 0000000000..fbb64898eb --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_modelpackagegrouppolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ModelPackageGroupPolicy +func (mg *ModelPackageGroupPolicy) GetTerraformResourceType() string { + return "aws_sagemaker_model_package_group_policy" +} + +// GetConnectionDetailsMapping for this ModelPackageGroupPolicy +func (tr *ModelPackageGroupPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ModelPackageGroupPolicy +func (tr *ModelPackageGroupPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ModelPackageGroupPolicy +func (tr *ModelPackageGroupPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ModelPackageGroupPolicy +func (tr *ModelPackageGroupPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ModelPackageGroupPolicy +func (tr *ModelPackageGroupPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ModelPackageGroupPolicy +func (tr *ModelPackageGroupPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ModelPackageGroupPolicy +func (tr *ModelPackageGroupPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ModelPackageGroupPolicy +func (tr *ModelPackageGroupPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ModelPackageGroupPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ModelPackageGroupPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &ModelPackageGroupPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ModelPackageGroupPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_modelpackagegrouppolicy_types.go b/apis/sagemaker/v1beta1/zz_modelpackagegrouppolicy_types.go index e8908dffe7..9aee5e8e1a 100755 --- a/apis/sagemaker/v1beta1/zz_modelpackagegrouppolicy_types.go +++ b/apis/sagemaker/v1beta1/zz_modelpackagegrouppolicy_types.go @@ -93,13 +93,14 @@ type ModelPackageGroupPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ModelPackageGroupPolicy is the Schema for the ModelPackageGroupPolicys API. Provides a SageMaker Model Package Group Policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ModelPackageGroupPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_notebookinstance_terraformed.go b/apis/sagemaker/v1beta1/zz_notebookinstance_terraformed.go new file mode 100755 index 0000000000..83279b809f --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_notebookinstance_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NotebookInstance +func (mg *NotebookInstance) GetTerraformResourceType() string { + return "aws_sagemaker_notebook_instance" +} + +// GetConnectionDetailsMapping for this NotebookInstance +func (tr *NotebookInstance) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NotebookInstance +func (tr *NotebookInstance) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NotebookInstance +func (tr *NotebookInstance) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NotebookInstance +func (tr *NotebookInstance) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NotebookInstance +func (tr *NotebookInstance) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NotebookInstance +func (tr *NotebookInstance) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NotebookInstance +func (tr *NotebookInstance) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NotebookInstance +func (tr *NotebookInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NotebookInstance using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NotebookInstance) LateInitialize(attrs []byte) (bool, error) { + params := &NotebookInstanceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NotebookInstance) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_notebookinstance_types.go b/apis/sagemaker/v1beta1/zz_notebookinstance_types.go index e4376cbbe5..b863f1eb39 100755 --- a/apis/sagemaker/v1beta1/zz_notebookinstance_types.go +++ b/apis/sagemaker/v1beta1/zz_notebookinstance_types.go @@ -329,13 +329,14 @@ type NotebookInstanceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NotebookInstance is the Schema for the NotebookInstances API. Provides a SageMaker Notebook Instance resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NotebookInstance struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_notebookinstancelifecycleconfiguration_terraformed.go b/apis/sagemaker/v1beta1/zz_notebookinstancelifecycleconfiguration_terraformed.go new file mode 100755 index 0000000000..2ac10f9fce --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_notebookinstancelifecycleconfiguration_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this NotebookInstanceLifecycleConfiguration +func (mg *NotebookInstanceLifecycleConfiguration) GetTerraformResourceType() string { + return "aws_sagemaker_notebook_instance_lifecycle_configuration" +} + +// GetConnectionDetailsMapping for this NotebookInstanceLifecycleConfiguration +func (tr *NotebookInstanceLifecycleConfiguration) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this NotebookInstanceLifecycleConfiguration +func (tr *NotebookInstanceLifecycleConfiguration) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this NotebookInstanceLifecycleConfiguration +func (tr *NotebookInstanceLifecycleConfiguration) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this NotebookInstanceLifecycleConfiguration +func (tr *NotebookInstanceLifecycleConfiguration) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this NotebookInstanceLifecycleConfiguration +func (tr *NotebookInstanceLifecycleConfiguration) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this NotebookInstanceLifecycleConfiguration +func (tr *NotebookInstanceLifecycleConfiguration) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this NotebookInstanceLifecycleConfiguration +func (tr *NotebookInstanceLifecycleConfiguration) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this NotebookInstanceLifecycleConfiguration +func (tr *NotebookInstanceLifecycleConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NotebookInstanceLifecycleConfiguration using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NotebookInstanceLifecycleConfiguration) LateInitialize(attrs []byte) (bool, error) { + params := &NotebookInstanceLifecycleConfigurationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *NotebookInstanceLifecycleConfiguration) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_notebookinstancelifecycleconfiguration_types.go b/apis/sagemaker/v1beta1/zz_notebookinstancelifecycleconfiguration_types.go index 73ba7f192e..7944251d29 100755 --- a/apis/sagemaker/v1beta1/zz_notebookinstancelifecycleconfiguration_types.go +++ b/apis/sagemaker/v1beta1/zz_notebookinstancelifecycleconfiguration_types.go @@ -80,13 +80,14 @@ type NotebookInstanceLifecycleConfigurationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NotebookInstanceLifecycleConfiguration is the Schema for the NotebookInstanceLifecycleConfigurations API. Provides a lifecycle configuration for SageMaker Notebook Instances. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NotebookInstanceLifecycleConfiguration struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_servicecatalogportfoliostatus_terraformed.go b/apis/sagemaker/v1beta1/zz_servicecatalogportfoliostatus_terraformed.go new file mode 100755 index 0000000000..81fc87df8d --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_servicecatalogportfoliostatus_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ServicecatalogPortfolioStatus +func (mg *ServicecatalogPortfolioStatus) GetTerraformResourceType() string { + return "aws_sagemaker_servicecatalog_portfolio_status" +} + +// GetConnectionDetailsMapping for this ServicecatalogPortfolioStatus +func (tr *ServicecatalogPortfolioStatus) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ServicecatalogPortfolioStatus +func (tr *ServicecatalogPortfolioStatus) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ServicecatalogPortfolioStatus +func (tr *ServicecatalogPortfolioStatus) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ServicecatalogPortfolioStatus +func (tr *ServicecatalogPortfolioStatus) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ServicecatalogPortfolioStatus +func (tr *ServicecatalogPortfolioStatus) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ServicecatalogPortfolioStatus +func (tr *ServicecatalogPortfolioStatus) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ServicecatalogPortfolioStatus +func (tr *ServicecatalogPortfolioStatus) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ServicecatalogPortfolioStatus +func (tr *ServicecatalogPortfolioStatus) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ServicecatalogPortfolioStatus using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ServicecatalogPortfolioStatus) LateInitialize(attrs []byte) (bool, error) { + params := &ServicecatalogPortfolioStatusParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ServicecatalogPortfolioStatus) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_servicecatalogportfoliostatus_types.go b/apis/sagemaker/v1beta1/zz_servicecatalogportfoliostatus_types.go index 7aac337ec2..ad02d36e1f 100755 --- a/apis/sagemaker/v1beta1/zz_servicecatalogportfoliostatus_types.go +++ b/apis/sagemaker/v1beta1/zz_servicecatalogportfoliostatus_types.go @@ -68,13 +68,14 @@ type ServicecatalogPortfolioStatusStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ServicecatalogPortfolioStatus is the Schema for the ServicecatalogPortfolioStatuss API. Manages status of Service Catalog in SageMaker. Service Catalog is used to create SageMaker projects. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ServicecatalogPortfolioStatus struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_space_terraformed.go b/apis/sagemaker/v1beta1/zz_space_terraformed.go new file mode 100755 index 0000000000..98e7bfc837 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_space_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Space +func (mg *Space) GetTerraformResourceType() string { + return "aws_sagemaker_space" +} + +// GetConnectionDetailsMapping for this Space +func (tr *Space) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Space +func (tr *Space) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Space +func (tr *Space) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Space +func (tr *Space) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Space +func (tr *Space) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Space +func (tr *Space) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Space +func (tr *Space) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Space +func (tr *Space) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Space using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Space) LateInitialize(attrs []byte) (bool, error) { + params := &SpaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Space) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_space_types.go b/apis/sagemaker/v1beta1/zz_space_types.go index 66b81b0fd0..c2b26fa13d 100755 --- a/apis/sagemaker/v1beta1/zz_space_types.go +++ b/apis/sagemaker/v1beta1/zz_space_types.go @@ -400,13 +400,14 @@ type SpaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Space is the Schema for the Spaces API. Provides a SageMaker Space resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Space struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_studiolifecycleconfig_terraformed.go b/apis/sagemaker/v1beta1/zz_studiolifecycleconfig_terraformed.go new file mode 100755 index 0000000000..b2b504776d --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_studiolifecycleconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this StudioLifecycleConfig +func (mg *StudioLifecycleConfig) GetTerraformResourceType() string { + return "aws_sagemaker_studio_lifecycle_config" +} + +// GetConnectionDetailsMapping for this StudioLifecycleConfig +func (tr *StudioLifecycleConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this StudioLifecycleConfig +func (tr *StudioLifecycleConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this StudioLifecycleConfig +func (tr *StudioLifecycleConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this StudioLifecycleConfig +func (tr *StudioLifecycleConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this StudioLifecycleConfig +func (tr *StudioLifecycleConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this StudioLifecycleConfig +func (tr *StudioLifecycleConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this StudioLifecycleConfig +func (tr *StudioLifecycleConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this StudioLifecycleConfig +func (tr *StudioLifecycleConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this StudioLifecycleConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *StudioLifecycleConfig) LateInitialize(attrs []byte) (bool, error) { + params := &StudioLifecycleConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *StudioLifecycleConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_studiolifecycleconfig_types.go b/apis/sagemaker/v1beta1/zz_studiolifecycleconfig_types.go index 835d29f1d9..a95e2f91d4 100755 --- a/apis/sagemaker/v1beta1/zz_studiolifecycleconfig_types.go +++ b/apis/sagemaker/v1beta1/zz_studiolifecycleconfig_types.go @@ -98,13 +98,14 @@ type StudioLifecycleConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // StudioLifecycleConfig is the Schema for the StudioLifecycleConfigs API. Provides a SageMaker Studio Lifecycle Config resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type StudioLifecycleConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_userprofile_terraformed.go b/apis/sagemaker/v1beta1/zz_userprofile_terraformed.go new file mode 100755 index 0000000000..73db194475 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_userprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this UserProfile +func (mg *UserProfile) GetTerraformResourceType() string { + return "aws_sagemaker_user_profile" +} + +// GetConnectionDetailsMapping for this UserProfile +func (tr *UserProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this UserProfile +func (tr *UserProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this UserProfile +func (tr *UserProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this UserProfile +func (tr *UserProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this UserProfile +func (tr *UserProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this UserProfile +func (tr *UserProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this UserProfile +func (tr *UserProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this UserProfile +func (tr *UserProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this UserProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *UserProfile) LateInitialize(attrs []byte) (bool, error) { + params := &UserProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *UserProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_userprofile_types.go b/apis/sagemaker/v1beta1/zz_userprofile_types.go index e945923dc8..3ab7cd3f34 100755 --- a/apis/sagemaker/v1beta1/zz_userprofile_types.go +++ b/apis/sagemaker/v1beta1/zz_userprofile_types.go @@ -833,13 +833,14 @@ type UserProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // UserProfile is the Schema for the UserProfiles API. Provides a SageMaker User Profile resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type UserProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_workforce_terraformed.go b/apis/sagemaker/v1beta1/zz_workforce_terraformed.go new file mode 100755 index 0000000000..5264f5c9fc --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_workforce_terraformed.go @@ -0,0 +1,134 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Workforce +func (mg *Workforce) GetTerraformResourceType() string { + return "aws_sagemaker_workforce" +} + +// GetConnectionDetailsMapping for this Workforce +func (tr *Workforce) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"oidc_config[*].client_secret": "spec.forProvider.oidcConfig[*].clientSecretSecretRef"} +} + +// GetObservation of this Workforce +func (tr *Workforce) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Workforce +func (tr *Workforce) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Workforce +func (tr *Workforce) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Workforce +func (tr *Workforce) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Workforce +func (tr *Workforce) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Workforce +func (tr *Workforce) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Workforce +func (tr *Workforce) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Workforce using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Workforce) LateInitialize(attrs []byte) (bool, error) { + params := &WorkforceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("SourceIPConfig")) + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Workforce) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_workforce_types.go b/apis/sagemaker/v1beta1/zz_workforce_types.go index 9c01f7cac2..af12c02a1c 100755 --- a/apis/sagemaker/v1beta1/zz_workforce_types.go +++ b/apis/sagemaker/v1beta1/zz_workforce_types.go @@ -326,13 +326,14 @@ type WorkforceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Workforce is the Schema for the Workforces API. Provides a SageMaker Workforce resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Workforce struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sagemaker/v1beta1/zz_workteam_terraformed.go b/apis/sagemaker/v1beta1/zz_workteam_terraformed.go new file mode 100755 index 0000000000..6ba187f140 --- /dev/null +++ b/apis/sagemaker/v1beta1/zz_workteam_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Workteam +func (mg *Workteam) GetTerraformResourceType() string { + return "aws_sagemaker_workteam" +} + +// GetConnectionDetailsMapping for this Workteam +func (tr *Workteam) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Workteam +func (tr *Workteam) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Workteam +func (tr *Workteam) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Workteam +func (tr *Workteam) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Workteam +func (tr *Workteam) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Workteam +func (tr *Workteam) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Workteam +func (tr *Workteam) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Workteam +func (tr *Workteam) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Workteam using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Workteam) LateInitialize(attrs []byte) (bool, error) { + params := &WorkteamParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Workteam) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sagemaker/v1beta1/zz_workteam_types.go b/apis/sagemaker/v1beta1/zz_workteam_types.go index 886956d7cd..7893cf708c 100755 --- a/apis/sagemaker/v1beta1/zz_workteam_types.go +++ b/apis/sagemaker/v1beta1/zz_workteam_types.go @@ -310,13 +310,14 @@ type WorkteamStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Workteam is the Schema for the Workteams API. Provides a SageMaker Workteam resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Workteam struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/scheduler/v1beta1/zz_generated.conversion_hubs.go b/apis/scheduler/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..f3281a76ad --- /dev/null +++ b/apis/scheduler/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Schedule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ScheduleGroup) Hub() {} diff --git a/apis/scheduler/v1beta1/zz_schedule_terraformed.go b/apis/scheduler/v1beta1/zz_schedule_terraformed.go new file mode 100755 index 0000000000..abcf34d896 --- /dev/null +++ b/apis/scheduler/v1beta1/zz_schedule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Schedule +func (mg *Schedule) GetTerraformResourceType() string { + return "aws_scheduler_schedule" +} + +// GetConnectionDetailsMapping for this Schedule +func (tr *Schedule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Schedule +func (tr *Schedule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Schedule +func (tr *Schedule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Schedule +func (tr *Schedule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Schedule +func (tr *Schedule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Schedule +func (tr *Schedule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Schedule +func (tr *Schedule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Schedule +func (tr *Schedule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Schedule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Schedule) LateInitialize(attrs []byte) (bool, error) { + params := &ScheduleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Schedule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/scheduler/v1beta1/zz_schedule_types.go b/apis/scheduler/v1beta1/zz_schedule_types.go index fd2ade3a72..8a08e301e3 100755 --- a/apis/scheduler/v1beta1/zz_schedule_types.go +++ b/apis/scheduler/v1beta1/zz_schedule_types.go @@ -824,13 +824,14 @@ type ScheduleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Schedule is the Schema for the Schedules API. Provides an EventBridge Scheduler Schedule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Schedule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/scheduler/v1beta1/zz_generated_terraformed.go b/apis/scheduler/v1beta1/zz_schedulegroup_terraformed.go similarity index 53% rename from apis/scheduler/v1beta1/zz_generated_terraformed.go rename to apis/scheduler/v1beta1/zz_schedulegroup_terraformed.go index b2bafee4ce..257ccd7365 100755 --- a/apis/scheduler/v1beta1/zz_generated_terraformed.go +++ b/apis/scheduler/v1beta1/zz_schedulegroup_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Schedule -func (mg *Schedule) GetTerraformResourceType() string { - return "aws_scheduler_schedule" -} - -// GetConnectionDetailsMapping for this Schedule -func (tr *Schedule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Schedule -func (tr *Schedule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Schedule -func (tr *Schedule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Schedule -func (tr *Schedule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Schedule -func (tr *Schedule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Schedule -func (tr *Schedule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Schedule -func (tr *Schedule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Schedule -func (tr *Schedule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Schedule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Schedule) LateInitialize(attrs []byte) (bool, error) { - params := &ScheduleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Schedule) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this ScheduleGroup func (mg *ScheduleGroup) GetTerraformResourceType() string { return "aws_scheduler_schedule_group" diff --git a/apis/scheduler/v1beta1/zz_schedulegroup_types.go b/apis/scheduler/v1beta1/zz_schedulegroup_types.go index b962a89d5b..2019cd327d 100755 --- a/apis/scheduler/v1beta1/zz_schedulegroup_types.go +++ b/apis/scheduler/v1beta1/zz_schedulegroup_types.go @@ -97,13 +97,14 @@ type ScheduleGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ScheduleGroup is the Schema for the ScheduleGroups API. Provides an EventBridge Scheduler Schedule Group resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ScheduleGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/schemas/v1beta1/zz_discoverer_terraformed.go b/apis/schemas/v1beta1/zz_discoverer_terraformed.go new file mode 100755 index 0000000000..b613538b14 --- /dev/null +++ b/apis/schemas/v1beta1/zz_discoverer_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Discoverer +func (mg *Discoverer) GetTerraformResourceType() string { + return "aws_schemas_discoverer" +} + +// GetConnectionDetailsMapping for this Discoverer +func (tr *Discoverer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Discoverer +func (tr *Discoverer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Discoverer +func (tr *Discoverer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Discoverer +func (tr *Discoverer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Discoverer +func (tr *Discoverer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Discoverer +func (tr *Discoverer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Discoverer +func (tr *Discoverer) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Discoverer +func (tr *Discoverer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Discoverer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Discoverer) LateInitialize(attrs []byte) (bool, error) { + params := &DiscovererParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Discoverer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/schemas/v1beta1/zz_discoverer_types.go b/apis/schemas/v1beta1/zz_discoverer_types.go index 22c3ace0f8..f8f8255081 100755 --- a/apis/schemas/v1beta1/zz_discoverer_types.go +++ b/apis/schemas/v1beta1/zz_discoverer_types.go @@ -118,13 +118,14 @@ type DiscovererStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Discoverer is the Schema for the Discoverers API. Provides an EventBridge Schema Discoverer resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Discoverer struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/schemas/v1beta1/zz_generated.conversion_hubs.go b/apis/schemas/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..6fad058bdd --- /dev/null +++ b/apis/schemas/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Discoverer) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Registry) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Schema) Hub() {} diff --git a/apis/schemas/v1beta1/zz_generated_terraformed.go b/apis/schemas/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index edf8f7742d..0000000000 --- a/apis/schemas/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Discoverer -func (mg *Discoverer) GetTerraformResourceType() string { - return "aws_schemas_discoverer" -} - -// GetConnectionDetailsMapping for this Discoverer -func (tr *Discoverer) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Discoverer -func (tr *Discoverer) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Discoverer -func (tr *Discoverer) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Discoverer -func (tr *Discoverer) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Discoverer -func (tr *Discoverer) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Discoverer -func (tr *Discoverer) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Discoverer -func (tr *Discoverer) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Discoverer -func (tr *Discoverer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Discoverer using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Discoverer) LateInitialize(attrs []byte) (bool, error) { - params := &DiscovererParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Discoverer) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Registry -func (mg *Registry) GetTerraformResourceType() string { - return "aws_schemas_registry" -} - -// GetConnectionDetailsMapping for this Registry -func (tr *Registry) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Registry -func (tr *Registry) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Registry -func (tr *Registry) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Registry -func (tr *Registry) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Registry -func (tr *Registry) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Registry -func (tr *Registry) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Registry -func (tr *Registry) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Registry -func (tr *Registry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Registry using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Registry) LateInitialize(attrs []byte) (bool, error) { - params := &RegistryParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Registry) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Schema -func (mg *Schema) GetTerraformResourceType() string { - return "aws_schemas_schema" -} - -// GetConnectionDetailsMapping for this Schema -func (tr *Schema) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Schema -func (tr *Schema) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Schema -func (tr *Schema) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Schema -func (tr *Schema) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Schema -func (tr *Schema) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Schema -func (tr *Schema) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Schema -func (tr *Schema) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Schema -func (tr *Schema) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Schema using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Schema) LateInitialize(attrs []byte) (bool, error) { - params := &SchemaParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Schema) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/schemas/v1beta1/zz_registry_terraformed.go b/apis/schemas/v1beta1/zz_registry_terraformed.go new file mode 100755 index 0000000000..b97abb2e78 --- /dev/null +++ b/apis/schemas/v1beta1/zz_registry_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Registry +func (mg *Registry) GetTerraformResourceType() string { + return "aws_schemas_registry" +} + +// GetConnectionDetailsMapping for this Registry +func (tr *Registry) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Registry +func (tr *Registry) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Registry +func (tr *Registry) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Registry +func (tr *Registry) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Registry +func (tr *Registry) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Registry +func (tr *Registry) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Registry +func (tr *Registry) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Registry +func (tr *Registry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Registry using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Registry) LateInitialize(attrs []byte) (bool, error) { + params := &RegistryParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Registry) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/schemas/v1beta1/zz_registry_types.go b/apis/schemas/v1beta1/zz_registry_types.go index ef1ceeb31d..7d860fa815 100755 --- a/apis/schemas/v1beta1/zz_registry_types.go +++ b/apis/schemas/v1beta1/zz_registry_types.go @@ -87,13 +87,14 @@ type RegistryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Registry is the Schema for the Registrys API. Provides an EventBridge Custom Schema Registry resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Registry struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/schemas/v1beta1/zz_schema_terraformed.go b/apis/schemas/v1beta1/zz_schema_terraformed.go new file mode 100755 index 0000000000..c3c28ba06d --- /dev/null +++ b/apis/schemas/v1beta1/zz_schema_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Schema +func (mg *Schema) GetTerraformResourceType() string { + return "aws_schemas_schema" +} + +// GetConnectionDetailsMapping for this Schema +func (tr *Schema) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Schema +func (tr *Schema) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Schema +func (tr *Schema) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Schema +func (tr *Schema) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Schema +func (tr *Schema) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Schema +func (tr *Schema) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Schema +func (tr *Schema) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Schema +func (tr *Schema) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Schema using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Schema) LateInitialize(attrs []byte) (bool, error) { + params := &SchemaParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Schema) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/schemas/v1beta1/zz_schema_types.go b/apis/schemas/v1beta1/zz_schema_types.go index bd0d209b24..a828f8da29 100755 --- a/apis/schemas/v1beta1/zz_schema_types.go +++ b/apis/schemas/v1beta1/zz_schema_types.go @@ -154,13 +154,14 @@ type SchemaStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Schema is the Schema for the Schemas API. Provides an EventBridge Schema resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Schema struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/secretsmanager/v1beta1/zz_generated.conversion_hubs.go b/apis/secretsmanager/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..117512f4b5 --- /dev/null +++ b/apis/secretsmanager/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Secret) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SecretPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SecretRotation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SecretVersion) Hub() {} diff --git a/apis/secretsmanager/v1beta1/zz_generated_terraformed.go b/apis/secretsmanager/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 9d671e943f..0000000000 --- a/apis/secretsmanager/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Secret -func (mg *Secret) GetTerraformResourceType() string { - return "aws_secretsmanager_secret" -} - -// GetConnectionDetailsMapping for this Secret -func (tr *Secret) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Secret -func (tr *Secret) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Secret -func (tr *Secret) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Secret -func (tr *Secret) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Secret -func (tr *Secret) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Secret -func (tr *Secret) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Secret -func (tr *Secret) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Secret -func (tr *Secret) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Secret using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Secret) LateInitialize(attrs []byte) (bool, error) { - params := &SecretParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Secret) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SecretPolicy -func (mg *SecretPolicy) GetTerraformResourceType() string { - return "aws_secretsmanager_secret_policy" -} - -// GetConnectionDetailsMapping for this SecretPolicy -func (tr *SecretPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SecretPolicy -func (tr *SecretPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SecretPolicy -func (tr *SecretPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SecretPolicy -func (tr *SecretPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SecretPolicy -func (tr *SecretPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SecretPolicy -func (tr *SecretPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SecretPolicy -func (tr *SecretPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SecretPolicy -func (tr *SecretPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SecretPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SecretPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &SecretPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SecretPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SecretRotation -func (mg *SecretRotation) GetTerraformResourceType() string { - return "aws_secretsmanager_secret_rotation" -} - -// GetConnectionDetailsMapping for this SecretRotation -func (tr *SecretRotation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SecretRotation -func (tr *SecretRotation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SecretRotation -func (tr *SecretRotation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SecretRotation -func (tr *SecretRotation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SecretRotation -func (tr *SecretRotation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SecretRotation -func (tr *SecretRotation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SecretRotation -func (tr *SecretRotation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SecretRotation -func (tr *SecretRotation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SecretRotation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SecretRotation) LateInitialize(attrs []byte) (bool, error) { - params := &SecretRotationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SecretRotation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SecretVersion -func (mg *SecretVersion) GetTerraformResourceType() string { - return "aws_secretsmanager_secret_version" -} - -// GetConnectionDetailsMapping for this SecretVersion -func (tr *SecretVersion) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"secret_binary": "spec.forProvider.secretBinarySecretRef", "secret_string": "spec.forProvider.secretStringSecretRef"} -} - -// GetObservation of this SecretVersion -func (tr *SecretVersion) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SecretVersion -func (tr *SecretVersion) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SecretVersion -func (tr *SecretVersion) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SecretVersion -func (tr *SecretVersion) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SecretVersion -func (tr *SecretVersion) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SecretVersion -func (tr *SecretVersion) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SecretVersion -func (tr *SecretVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SecretVersion using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SecretVersion) LateInitialize(attrs []byte) (bool, error) { - params := &SecretVersionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SecretVersion) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/secretsmanager/v1beta1/zz_secret_terraformed.go b/apis/secretsmanager/v1beta1/zz_secret_terraformed.go new file mode 100755 index 0000000000..7318f656b6 --- /dev/null +++ b/apis/secretsmanager/v1beta1/zz_secret_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Secret +func (mg *Secret) GetTerraformResourceType() string { + return "aws_secretsmanager_secret" +} + +// GetConnectionDetailsMapping for this Secret +func (tr *Secret) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Secret +func (tr *Secret) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Secret +func (tr *Secret) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Secret +func (tr *Secret) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Secret +func (tr *Secret) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Secret +func (tr *Secret) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Secret +func (tr *Secret) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Secret +func (tr *Secret) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Secret using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Secret) LateInitialize(attrs []byte) (bool, error) { + params := &SecretParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Secret) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/secretsmanager/v1beta1/zz_secret_types.go b/apis/secretsmanager/v1beta1/zz_secret_types.go index de06c1f5cb..587a295833 100755 --- a/apis/secretsmanager/v1beta1/zz_secret_types.go +++ b/apis/secretsmanager/v1beta1/zz_secret_types.go @@ -220,13 +220,14 @@ type SecretStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Secret is the Schema for the Secrets API. Provides a resource to manage AWS Secrets Manager secret metadata // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Secret struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/secretsmanager/v1beta1/zz_secretpolicy_terraformed.go b/apis/secretsmanager/v1beta1/zz_secretpolicy_terraformed.go new file mode 100755 index 0000000000..a393ef349e --- /dev/null +++ b/apis/secretsmanager/v1beta1/zz_secretpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SecretPolicy +func (mg *SecretPolicy) GetTerraformResourceType() string { + return "aws_secretsmanager_secret_policy" +} + +// GetConnectionDetailsMapping for this SecretPolicy +func (tr *SecretPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SecretPolicy +func (tr *SecretPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SecretPolicy +func (tr *SecretPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SecretPolicy +func (tr *SecretPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SecretPolicy +func (tr *SecretPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SecretPolicy +func (tr *SecretPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SecretPolicy +func (tr *SecretPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SecretPolicy +func (tr *SecretPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SecretPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SecretPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &SecretPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SecretPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/secretsmanager/v1beta1/zz_secretpolicy_types.go b/apis/secretsmanager/v1beta1/zz_secretpolicy_types.go index 8228a09f45..460a3ea1fb 100755 --- a/apis/secretsmanager/v1beta1/zz_secretpolicy_types.go +++ b/apis/secretsmanager/v1beta1/zz_secretpolicy_types.go @@ -108,13 +108,14 @@ type SecretPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SecretPolicy is the Schema for the SecretPolicys API. Provides a resource to manage AWS Secrets Manager secret policy // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SecretPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/secretsmanager/v1beta1/zz_secretrotation_terraformed.go b/apis/secretsmanager/v1beta1/zz_secretrotation_terraformed.go new file mode 100755 index 0000000000..fd7e38e1aa --- /dev/null +++ b/apis/secretsmanager/v1beta1/zz_secretrotation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SecretRotation +func (mg *SecretRotation) GetTerraformResourceType() string { + return "aws_secretsmanager_secret_rotation" +} + +// GetConnectionDetailsMapping for this SecretRotation +func (tr *SecretRotation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SecretRotation +func (tr *SecretRotation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SecretRotation +func (tr *SecretRotation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SecretRotation +func (tr *SecretRotation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SecretRotation +func (tr *SecretRotation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SecretRotation +func (tr *SecretRotation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SecretRotation +func (tr *SecretRotation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SecretRotation +func (tr *SecretRotation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SecretRotation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SecretRotation) LateInitialize(attrs []byte) (bool, error) { + params := &SecretRotationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SecretRotation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/secretsmanager/v1beta1/zz_secretrotation_types.go b/apis/secretsmanager/v1beta1/zz_secretrotation_types.go index 87282e00cf..d2323b2572 100755 --- a/apis/secretsmanager/v1beta1/zz_secretrotation_types.go +++ b/apis/secretsmanager/v1beta1/zz_secretrotation_types.go @@ -170,13 +170,14 @@ type SecretRotationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SecretRotation is the Schema for the SecretRotations API. Provides a resource to manage AWS Secrets Manager secret rotation // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SecretRotation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/secretsmanager/v1beta1/zz_secretversion_terraformed.go b/apis/secretsmanager/v1beta1/zz_secretversion_terraformed.go new file mode 100755 index 0000000000..656c343ede --- /dev/null +++ b/apis/secretsmanager/v1beta1/zz_secretversion_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SecretVersion +func (mg *SecretVersion) GetTerraformResourceType() string { + return "aws_secretsmanager_secret_version" +} + +// GetConnectionDetailsMapping for this SecretVersion +func (tr *SecretVersion) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"secret_binary": "spec.forProvider.secretBinarySecretRef", "secret_string": "spec.forProvider.secretStringSecretRef"} +} + +// GetObservation of this SecretVersion +func (tr *SecretVersion) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SecretVersion +func (tr *SecretVersion) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SecretVersion +func (tr *SecretVersion) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SecretVersion +func (tr *SecretVersion) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SecretVersion +func (tr *SecretVersion) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SecretVersion +func (tr *SecretVersion) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SecretVersion +func (tr *SecretVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SecretVersion using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SecretVersion) LateInitialize(attrs []byte) (bool, error) { + params := &SecretVersionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SecretVersion) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/secretsmanager/v1beta1/zz_secretversion_types.go b/apis/secretsmanager/v1beta1/zz_secretversion_types.go index 01cafbd026..bb47dc7c59 100755 --- a/apis/secretsmanager/v1beta1/zz_secretversion_types.go +++ b/apis/secretsmanager/v1beta1/zz_secretversion_types.go @@ -115,13 +115,14 @@ type SecretVersionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SecretVersion is the Schema for the SecretVersions API. Provides a resource to manage AWS Secrets Manager secret version including its secret value // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SecretVersion struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/securityhub/v1beta1/zz_account_terraformed.go b/apis/securityhub/v1beta1/zz_account_terraformed.go new file mode 100755 index 0000000000..c6b9149268 --- /dev/null +++ b/apis/securityhub/v1beta1/zz_account_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Account +func (mg *Account) GetTerraformResourceType() string { + return "aws_securityhub_account" +} + +// GetConnectionDetailsMapping for this Account +func (tr *Account) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Account +func (tr *Account) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Account +func (tr *Account) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Account +func (tr *Account) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Account +func (tr *Account) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Account +func (tr *Account) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Account +func (tr *Account) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Account +func (tr *Account) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Account using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Account) LateInitialize(attrs []byte) (bool, error) { + params := &AccountParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Account) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/securityhub/v1beta1/zz_account_types.go b/apis/securityhub/v1beta1/zz_account_types.go index a2e9b66f4b..1158a2cd0e 100755 --- a/apis/securityhub/v1beta1/zz_account_types.go +++ b/apis/securityhub/v1beta1/zz_account_types.go @@ -91,13 +91,14 @@ type AccountStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Account is the Schema for the Accounts API. Enables Security Hub for an AWS account. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Account struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/securityhub/v1beta1/zz_actiontarget_terraformed.go b/apis/securityhub/v1beta1/zz_actiontarget_terraformed.go new file mode 100755 index 0000000000..50f6903b26 --- /dev/null +++ b/apis/securityhub/v1beta1/zz_actiontarget_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ActionTarget +func (mg *ActionTarget) GetTerraformResourceType() string { + return "aws_securityhub_action_target" +} + +// GetConnectionDetailsMapping for this ActionTarget +func (tr *ActionTarget) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ActionTarget +func (tr *ActionTarget) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ActionTarget +func (tr *ActionTarget) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ActionTarget +func (tr *ActionTarget) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ActionTarget +func (tr *ActionTarget) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ActionTarget +func (tr *ActionTarget) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ActionTarget +func (tr *ActionTarget) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ActionTarget +func (tr *ActionTarget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ActionTarget using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ActionTarget) LateInitialize(attrs []byte) (bool, error) { + params := &ActionTargetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ActionTarget) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/securityhub/v1beta1/zz_actiontarget_types.go b/apis/securityhub/v1beta1/zz_actiontarget_types.go index bf18e9192d..e1518afc7e 100755 --- a/apis/securityhub/v1beta1/zz_actiontarget_types.go +++ b/apis/securityhub/v1beta1/zz_actiontarget_types.go @@ -80,13 +80,14 @@ type ActionTargetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ActionTarget is the Schema for the ActionTargets API. Creates Security Hub custom action. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ActionTarget struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/securityhub/v1beta1/zz_findingaggregator_terraformed.go b/apis/securityhub/v1beta1/zz_findingaggregator_terraformed.go new file mode 100755 index 0000000000..eda4197829 --- /dev/null +++ b/apis/securityhub/v1beta1/zz_findingaggregator_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this FindingAggregator +func (mg *FindingAggregator) GetTerraformResourceType() string { + return "aws_securityhub_finding_aggregator" +} + +// GetConnectionDetailsMapping for this FindingAggregator +func (tr *FindingAggregator) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this FindingAggregator +func (tr *FindingAggregator) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this FindingAggregator +func (tr *FindingAggregator) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this FindingAggregator +func (tr *FindingAggregator) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this FindingAggregator +func (tr *FindingAggregator) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this FindingAggregator +func (tr *FindingAggregator) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this FindingAggregator +func (tr *FindingAggregator) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this FindingAggregator +func (tr *FindingAggregator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this FindingAggregator using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *FindingAggregator) LateInitialize(attrs []byte) (bool, error) { + params := &FindingAggregatorParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *FindingAggregator) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/securityhub/v1beta1/zz_findingaggregator_types.go b/apis/securityhub/v1beta1/zz_findingaggregator_types.go index f3ae83bf11..716eef8bb1 100755 --- a/apis/securityhub/v1beta1/zz_findingaggregator_types.go +++ b/apis/securityhub/v1beta1/zz_findingaggregator_types.go @@ -79,13 +79,14 @@ type FindingAggregatorStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // FindingAggregator is the Schema for the FindingAggregators API. Manages a Security Hub finding aggregator // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type FindingAggregator struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/securityhub/v1beta1/zz_generated.conversion_hubs.go b/apis/securityhub/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..da05d8896b --- /dev/null +++ b/apis/securityhub/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Account) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ActionTarget) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *FindingAggregator) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Insight) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InviteAccepter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Member) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ProductSubscription) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *StandardsSubscription) Hub() {} diff --git a/apis/securityhub/v1beta1/zz_generated_terraformed.go b/apis/securityhub/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index a4ec0f9504..0000000000 --- a/apis/securityhub/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,931 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Account -func (mg *Account) GetTerraformResourceType() string { - return "aws_securityhub_account" -} - -// GetConnectionDetailsMapping for this Account -func (tr *Account) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Account -func (tr *Account) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Account -func (tr *Account) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Account -func (tr *Account) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Account -func (tr *Account) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Account -func (tr *Account) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Account -func (tr *Account) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Account -func (tr *Account) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Account using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Account) LateInitialize(attrs []byte) (bool, error) { - params := &AccountParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Account) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this ActionTarget -func (mg *ActionTarget) GetTerraformResourceType() string { - return "aws_securityhub_action_target" -} - -// GetConnectionDetailsMapping for this ActionTarget -func (tr *ActionTarget) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ActionTarget -func (tr *ActionTarget) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ActionTarget -func (tr *ActionTarget) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ActionTarget -func (tr *ActionTarget) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ActionTarget -func (tr *ActionTarget) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ActionTarget -func (tr *ActionTarget) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ActionTarget -func (tr *ActionTarget) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ActionTarget -func (tr *ActionTarget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ActionTarget using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ActionTarget) LateInitialize(attrs []byte) (bool, error) { - params := &ActionTargetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ActionTarget) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this FindingAggregator -func (mg *FindingAggregator) GetTerraformResourceType() string { - return "aws_securityhub_finding_aggregator" -} - -// GetConnectionDetailsMapping for this FindingAggregator -func (tr *FindingAggregator) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this FindingAggregator -func (tr *FindingAggregator) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this FindingAggregator -func (tr *FindingAggregator) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this FindingAggregator -func (tr *FindingAggregator) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this FindingAggregator -func (tr *FindingAggregator) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this FindingAggregator -func (tr *FindingAggregator) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this FindingAggregator -func (tr *FindingAggregator) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this FindingAggregator -func (tr *FindingAggregator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this FindingAggregator using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *FindingAggregator) LateInitialize(attrs []byte) (bool, error) { - params := &FindingAggregatorParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *FindingAggregator) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Insight -func (mg *Insight) GetTerraformResourceType() string { - return "aws_securityhub_insight" -} - -// GetConnectionDetailsMapping for this Insight -func (tr *Insight) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Insight -func (tr *Insight) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Insight -func (tr *Insight) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Insight -func (tr *Insight) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Insight -func (tr *Insight) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Insight -func (tr *Insight) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Insight -func (tr *Insight) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Insight -func (tr *Insight) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Insight using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Insight) LateInitialize(attrs []byte) (bool, error) { - params := &InsightParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Insight) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InviteAccepter -func (mg *InviteAccepter) GetTerraformResourceType() string { - return "aws_securityhub_invite_accepter" -} - -// GetConnectionDetailsMapping for this InviteAccepter -func (tr *InviteAccepter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InviteAccepter -func (tr *InviteAccepter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InviteAccepter -func (tr *InviteAccepter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InviteAccepter -func (tr *InviteAccepter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InviteAccepter -func (tr *InviteAccepter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InviteAccepter -func (tr *InviteAccepter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InviteAccepter -func (tr *InviteAccepter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InviteAccepter -func (tr *InviteAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InviteAccepter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InviteAccepter) LateInitialize(attrs []byte) (bool, error) { - params := &InviteAccepterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InviteAccepter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Member -func (mg *Member) GetTerraformResourceType() string { - return "aws_securityhub_member" -} - -// GetConnectionDetailsMapping for this Member -func (tr *Member) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Member -func (tr *Member) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Member -func (tr *Member) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Member -func (tr *Member) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Member -func (tr *Member) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Member -func (tr *Member) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Member -func (tr *Member) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Member -func (tr *Member) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Member using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Member) LateInitialize(attrs []byte) (bool, error) { - params := &MemberParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Member) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ProductSubscription -func (mg *ProductSubscription) GetTerraformResourceType() string { - return "aws_securityhub_product_subscription" -} - -// GetConnectionDetailsMapping for this ProductSubscription -func (tr *ProductSubscription) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ProductSubscription -func (tr *ProductSubscription) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ProductSubscription -func (tr *ProductSubscription) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ProductSubscription -func (tr *ProductSubscription) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ProductSubscription -func (tr *ProductSubscription) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ProductSubscription -func (tr *ProductSubscription) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ProductSubscription -func (tr *ProductSubscription) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ProductSubscription -func (tr *ProductSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ProductSubscription using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ProductSubscription) LateInitialize(attrs []byte) (bool, error) { - params := &ProductSubscriptionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ProductSubscription) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this StandardsSubscription -func (mg *StandardsSubscription) GetTerraformResourceType() string { - return "aws_securityhub_standards_subscription" -} - -// GetConnectionDetailsMapping for this StandardsSubscription -func (tr *StandardsSubscription) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this StandardsSubscription -func (tr *StandardsSubscription) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this StandardsSubscription -func (tr *StandardsSubscription) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this StandardsSubscription -func (tr *StandardsSubscription) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this StandardsSubscription -func (tr *StandardsSubscription) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this StandardsSubscription -func (tr *StandardsSubscription) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this StandardsSubscription -func (tr *StandardsSubscription) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this StandardsSubscription -func (tr *StandardsSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this StandardsSubscription using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *StandardsSubscription) LateInitialize(attrs []byte) (bool, error) { - params := &StandardsSubscriptionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *StandardsSubscription) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/securityhub/v1beta1/zz_insight_terraformed.go b/apis/securityhub/v1beta1/zz_insight_terraformed.go new file mode 100755 index 0000000000..403b2b0619 --- /dev/null +++ b/apis/securityhub/v1beta1/zz_insight_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Insight +func (mg *Insight) GetTerraformResourceType() string { + return "aws_securityhub_insight" +} + +// GetConnectionDetailsMapping for this Insight +func (tr *Insight) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Insight +func (tr *Insight) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Insight +func (tr *Insight) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Insight +func (tr *Insight) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Insight +func (tr *Insight) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Insight +func (tr *Insight) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Insight +func (tr *Insight) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Insight +func (tr *Insight) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Insight using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Insight) LateInitialize(attrs []byte) (bool, error) { + params := &InsightParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Insight) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/securityhub/v1beta1/zz_insight_types.go b/apis/securityhub/v1beta1/zz_insight_types.go index 5eb457d61c..a2515ef29f 100755 --- a/apis/securityhub/v1beta1/zz_insight_types.go +++ b/apis/securityhub/v1beta1/zz_insight_types.go @@ -4011,13 +4011,14 @@ type InsightStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Insight is the Schema for the Insights API. Provides a Security Hub custom insight resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Insight struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/securityhub/v1beta1/zz_inviteaccepter_terraformed.go b/apis/securityhub/v1beta1/zz_inviteaccepter_terraformed.go new file mode 100755 index 0000000000..2c3dfc5353 --- /dev/null +++ b/apis/securityhub/v1beta1/zz_inviteaccepter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InviteAccepter +func (mg *InviteAccepter) GetTerraformResourceType() string { + return "aws_securityhub_invite_accepter" +} + +// GetConnectionDetailsMapping for this InviteAccepter +func (tr *InviteAccepter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InviteAccepter +func (tr *InviteAccepter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InviteAccepter +func (tr *InviteAccepter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InviteAccepter +func (tr *InviteAccepter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InviteAccepter +func (tr *InviteAccepter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InviteAccepter +func (tr *InviteAccepter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InviteAccepter +func (tr *InviteAccepter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InviteAccepter +func (tr *InviteAccepter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InviteAccepter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InviteAccepter) LateInitialize(attrs []byte) (bool, error) { + params := &InviteAccepterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InviteAccepter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/securityhub/v1beta1/zz_inviteaccepter_types.go b/apis/securityhub/v1beta1/zz_inviteaccepter_types.go index 8970ec5fa3..2bbdbb0382 100755 --- a/apis/securityhub/v1beta1/zz_inviteaccepter_types.go +++ b/apis/securityhub/v1beta1/zz_inviteaccepter_types.go @@ -89,13 +89,14 @@ type InviteAccepterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InviteAccepter is the Schema for the InviteAccepters API. Accepts a Security Hub invitation. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InviteAccepter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/securityhub/v1beta1/zz_member_terraformed.go b/apis/securityhub/v1beta1/zz_member_terraformed.go new file mode 100755 index 0000000000..9cd45546d8 --- /dev/null +++ b/apis/securityhub/v1beta1/zz_member_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Member +func (mg *Member) GetTerraformResourceType() string { + return "aws_securityhub_member" +} + +// GetConnectionDetailsMapping for this Member +func (tr *Member) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Member +func (tr *Member) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Member +func (tr *Member) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Member +func (tr *Member) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Member +func (tr *Member) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Member +func (tr *Member) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Member +func (tr *Member) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Member +func (tr *Member) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Member using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Member) LateInitialize(attrs []byte) (bool, error) { + params := &MemberParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Member) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/securityhub/v1beta1/zz_member_types.go b/apis/securityhub/v1beta1/zz_member_types.go index 0b53950e5e..053c7f7f00 100755 --- a/apis/securityhub/v1beta1/zz_member_types.go +++ b/apis/securityhub/v1beta1/zz_member_types.go @@ -94,13 +94,14 @@ type MemberStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Member is the Schema for the Members API. Provides a Security Hub member resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Member struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/securityhub/v1beta1/zz_productsubscription_terraformed.go b/apis/securityhub/v1beta1/zz_productsubscription_terraformed.go new file mode 100755 index 0000000000..5f1e3112f5 --- /dev/null +++ b/apis/securityhub/v1beta1/zz_productsubscription_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ProductSubscription +func (mg *ProductSubscription) GetTerraformResourceType() string { + return "aws_securityhub_product_subscription" +} + +// GetConnectionDetailsMapping for this ProductSubscription +func (tr *ProductSubscription) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ProductSubscription +func (tr *ProductSubscription) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ProductSubscription +func (tr *ProductSubscription) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ProductSubscription +func (tr *ProductSubscription) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ProductSubscription +func (tr *ProductSubscription) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ProductSubscription +func (tr *ProductSubscription) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ProductSubscription +func (tr *ProductSubscription) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ProductSubscription +func (tr *ProductSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ProductSubscription using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ProductSubscription) LateInitialize(attrs []byte) (bool, error) { + params := &ProductSubscriptionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ProductSubscription) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/securityhub/v1beta1/zz_productsubscription_types.go b/apis/securityhub/v1beta1/zz_productsubscription_types.go index 39c57d4c40..3d7234cd1f 100755 --- a/apis/securityhub/v1beta1/zz_productsubscription_types.go +++ b/apis/securityhub/v1beta1/zz_productsubscription_types.go @@ -70,13 +70,14 @@ type ProductSubscriptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ProductSubscription is the Schema for the ProductSubscriptions API. Subscribes to a Security Hub product. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ProductSubscription struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/securityhub/v1beta1/zz_standardssubscription_terraformed.go b/apis/securityhub/v1beta1/zz_standardssubscription_terraformed.go new file mode 100755 index 0000000000..15c75784af --- /dev/null +++ b/apis/securityhub/v1beta1/zz_standardssubscription_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this StandardsSubscription +func (mg *StandardsSubscription) GetTerraformResourceType() string { + return "aws_securityhub_standards_subscription" +} + +// GetConnectionDetailsMapping for this StandardsSubscription +func (tr *StandardsSubscription) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this StandardsSubscription +func (tr *StandardsSubscription) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this StandardsSubscription +func (tr *StandardsSubscription) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this StandardsSubscription +func (tr *StandardsSubscription) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this StandardsSubscription +func (tr *StandardsSubscription) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this StandardsSubscription +func (tr *StandardsSubscription) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this StandardsSubscription +func (tr *StandardsSubscription) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this StandardsSubscription +func (tr *StandardsSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this StandardsSubscription using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *StandardsSubscription) LateInitialize(attrs []byte) (bool, error) { + params := &StandardsSubscriptionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *StandardsSubscription) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/securityhub/v1beta1/zz_standardssubscription_types.go b/apis/securityhub/v1beta1/zz_standardssubscription_types.go index 9d45f078da..ce687d4002 100755 --- a/apis/securityhub/v1beta1/zz_standardssubscription_types.go +++ b/apis/securityhub/v1beta1/zz_standardssubscription_types.go @@ -68,13 +68,14 @@ type StandardsSubscriptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // StandardsSubscription is the Schema for the StandardsSubscriptions API. Subscribes to a Security Hub standard. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type StandardsSubscription struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/serverlessrepo/v1beta1/zz_generated_terraformed.go b/apis/serverlessrepo/v1beta1/zz_cloudformationstack_terraformed.go similarity index 100% rename from apis/serverlessrepo/v1beta1/zz_generated_terraformed.go rename to apis/serverlessrepo/v1beta1/zz_cloudformationstack_terraformed.go diff --git a/apis/serverlessrepo/v1beta1/zz_cloudformationstack_types.go b/apis/serverlessrepo/v1beta1/zz_cloudformationstack_types.go index 9e4d677d7d..99e899cdae 100755 --- a/apis/serverlessrepo/v1beta1/zz_cloudformationstack_types.go +++ b/apis/serverlessrepo/v1beta1/zz_cloudformationstack_types.go @@ -135,13 +135,14 @@ type CloudFormationStackStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CloudFormationStack is the Schema for the CloudFormationStacks API. Deploys an Application CloudFormation Stack from the Serverless Application Repository. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CloudFormationStack struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/serverlessrepo/v1beta1/zz_generated.conversion_hubs.go b/apis/serverlessrepo/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..3dc715cd4d --- /dev/null +++ b/apis/serverlessrepo/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *CloudFormationStack) Hub() {} diff --git a/apis/servicecatalog/v1beta1/zz_budgetresourceassociation_terraformed.go b/apis/servicecatalog/v1beta1/zz_budgetresourceassociation_terraformed.go new file mode 100755 index 0000000000..1004191584 --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_budgetresourceassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BudgetResourceAssociation +func (mg *BudgetResourceAssociation) GetTerraformResourceType() string { + return "aws_servicecatalog_budget_resource_association" +} + +// GetConnectionDetailsMapping for this BudgetResourceAssociation +func (tr *BudgetResourceAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BudgetResourceAssociation +func (tr *BudgetResourceAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BudgetResourceAssociation +func (tr *BudgetResourceAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BudgetResourceAssociation +func (tr *BudgetResourceAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BudgetResourceAssociation +func (tr *BudgetResourceAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BudgetResourceAssociation +func (tr *BudgetResourceAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BudgetResourceAssociation +func (tr *BudgetResourceAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BudgetResourceAssociation +func (tr *BudgetResourceAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BudgetResourceAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BudgetResourceAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &BudgetResourceAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BudgetResourceAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicecatalog/v1beta1/zz_budgetresourceassociation_types.go b/apis/servicecatalog/v1beta1/zz_budgetresourceassociation_types.go index 7a47bef2d0..d3c86d3379 100755 --- a/apis/servicecatalog/v1beta1/zz_budgetresourceassociation_types.go +++ b/apis/servicecatalog/v1beta1/zz_budgetresourceassociation_types.go @@ -114,13 +114,14 @@ type BudgetResourceAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // BudgetResourceAssociation is the Schema for the BudgetResourceAssociations API. Manages a Service Catalog Budget Resource Association // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type BudgetResourceAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicecatalog/v1beta1/zz_constraint_terraformed.go b/apis/servicecatalog/v1beta1/zz_constraint_terraformed.go new file mode 100755 index 0000000000..f1eeb8c535 --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_constraint_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Constraint +func (mg *Constraint) GetTerraformResourceType() string { + return "aws_servicecatalog_constraint" +} + +// GetConnectionDetailsMapping for this Constraint +func (tr *Constraint) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Constraint +func (tr *Constraint) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Constraint +func (tr *Constraint) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Constraint +func (tr *Constraint) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Constraint +func (tr *Constraint) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Constraint +func (tr *Constraint) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Constraint +func (tr *Constraint) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Constraint +func (tr *Constraint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Constraint using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Constraint) LateInitialize(attrs []byte) (bool, error) { + params := &ConstraintParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Constraint) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicecatalog/v1beta1/zz_constraint_types.go b/apis/servicecatalog/v1beta1/zz_constraint_types.go index e1569631d0..011da2bf6a 100755 --- a/apis/servicecatalog/v1beta1/zz_constraint_types.go +++ b/apis/servicecatalog/v1beta1/zz_constraint_types.go @@ -163,13 +163,14 @@ type ConstraintStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Constraint is the Schema for the Constraints API. Manages a Service Catalog Constraint // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Constraint struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicecatalog/v1beta1/zz_generated.conversion_hubs.go b/apis/servicecatalog/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..8c93f098c3 --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *BudgetResourceAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Constraint) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Portfolio) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PortfolioShare) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PrincipalPortfolioAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Product) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ProductPortfolioAssociation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ProvisioningArtifact) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ServiceAction) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TagOption) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TagOptionResourceAssociation) Hub() {} diff --git a/apis/servicecatalog/v1beta1/zz_generated_terraformed.go b/apis/servicecatalog/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 43e3757479..0000000000 --- a/apis/servicecatalog/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1273 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this BudgetResourceAssociation -func (mg *BudgetResourceAssociation) GetTerraformResourceType() string { - return "aws_servicecatalog_budget_resource_association" -} - -// GetConnectionDetailsMapping for this BudgetResourceAssociation -func (tr *BudgetResourceAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this BudgetResourceAssociation -func (tr *BudgetResourceAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this BudgetResourceAssociation -func (tr *BudgetResourceAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this BudgetResourceAssociation -func (tr *BudgetResourceAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this BudgetResourceAssociation -func (tr *BudgetResourceAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this BudgetResourceAssociation -func (tr *BudgetResourceAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this BudgetResourceAssociation -func (tr *BudgetResourceAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this BudgetResourceAssociation -func (tr *BudgetResourceAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this BudgetResourceAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *BudgetResourceAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &BudgetResourceAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *BudgetResourceAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Constraint -func (mg *Constraint) GetTerraformResourceType() string { - return "aws_servicecatalog_constraint" -} - -// GetConnectionDetailsMapping for this Constraint -func (tr *Constraint) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Constraint -func (tr *Constraint) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Constraint -func (tr *Constraint) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Constraint -func (tr *Constraint) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Constraint -func (tr *Constraint) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Constraint -func (tr *Constraint) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Constraint -func (tr *Constraint) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Constraint -func (tr *Constraint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Constraint using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Constraint) LateInitialize(attrs []byte) (bool, error) { - params := &ConstraintParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Constraint) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Portfolio -func (mg *Portfolio) GetTerraformResourceType() string { - return "aws_servicecatalog_portfolio" -} - -// GetConnectionDetailsMapping for this Portfolio -func (tr *Portfolio) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Portfolio -func (tr *Portfolio) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Portfolio -func (tr *Portfolio) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Portfolio -func (tr *Portfolio) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Portfolio -func (tr *Portfolio) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Portfolio -func (tr *Portfolio) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Portfolio -func (tr *Portfolio) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Portfolio -func (tr *Portfolio) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Portfolio using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Portfolio) LateInitialize(attrs []byte) (bool, error) { - params := &PortfolioParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Portfolio) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PortfolioShare -func (mg *PortfolioShare) GetTerraformResourceType() string { - return "aws_servicecatalog_portfolio_share" -} - -// GetConnectionDetailsMapping for this PortfolioShare -func (tr *PortfolioShare) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PortfolioShare -func (tr *PortfolioShare) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PortfolioShare -func (tr *PortfolioShare) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PortfolioShare -func (tr *PortfolioShare) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PortfolioShare -func (tr *PortfolioShare) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PortfolioShare -func (tr *PortfolioShare) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PortfolioShare -func (tr *PortfolioShare) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PortfolioShare -func (tr *PortfolioShare) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PortfolioShare using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PortfolioShare) LateInitialize(attrs []byte) (bool, error) { - params := &PortfolioShareParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PortfolioShare) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PrincipalPortfolioAssociation -func (mg *PrincipalPortfolioAssociation) GetTerraformResourceType() string { - return "aws_servicecatalog_principal_portfolio_association" -} - -// GetConnectionDetailsMapping for this PrincipalPortfolioAssociation -func (tr *PrincipalPortfolioAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PrincipalPortfolioAssociation -func (tr *PrincipalPortfolioAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PrincipalPortfolioAssociation -func (tr *PrincipalPortfolioAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PrincipalPortfolioAssociation -func (tr *PrincipalPortfolioAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PrincipalPortfolioAssociation -func (tr *PrincipalPortfolioAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PrincipalPortfolioAssociation -func (tr *PrincipalPortfolioAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PrincipalPortfolioAssociation -func (tr *PrincipalPortfolioAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PrincipalPortfolioAssociation -func (tr *PrincipalPortfolioAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PrincipalPortfolioAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PrincipalPortfolioAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &PrincipalPortfolioAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PrincipalPortfolioAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Product -func (mg *Product) GetTerraformResourceType() string { - return "aws_servicecatalog_product" -} - -// GetConnectionDetailsMapping for this Product -func (tr *Product) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Product -func (tr *Product) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Product -func (tr *Product) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Product -func (tr *Product) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Product -func (tr *Product) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Product -func (tr *Product) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Product -func (tr *Product) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Product -func (tr *Product) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Product using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Product) LateInitialize(attrs []byte) (bool, error) { - params := &ProductParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Product) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ProductPortfolioAssociation -func (mg *ProductPortfolioAssociation) GetTerraformResourceType() string { - return "aws_servicecatalog_product_portfolio_association" -} - -// GetConnectionDetailsMapping for this ProductPortfolioAssociation -func (tr *ProductPortfolioAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ProductPortfolioAssociation -func (tr *ProductPortfolioAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ProductPortfolioAssociation -func (tr *ProductPortfolioAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ProductPortfolioAssociation -func (tr *ProductPortfolioAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ProductPortfolioAssociation -func (tr *ProductPortfolioAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ProductPortfolioAssociation -func (tr *ProductPortfolioAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ProductPortfolioAssociation -func (tr *ProductPortfolioAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ProductPortfolioAssociation -func (tr *ProductPortfolioAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ProductPortfolioAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ProductPortfolioAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &ProductPortfolioAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ProductPortfolioAssociation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ProvisioningArtifact -func (mg *ProvisioningArtifact) GetTerraformResourceType() string { - return "aws_servicecatalog_provisioning_artifact" -} - -// GetConnectionDetailsMapping for this ProvisioningArtifact -func (tr *ProvisioningArtifact) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ProvisioningArtifact -func (tr *ProvisioningArtifact) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ProvisioningArtifact -func (tr *ProvisioningArtifact) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ProvisioningArtifact -func (tr *ProvisioningArtifact) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ProvisioningArtifact -func (tr *ProvisioningArtifact) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ProvisioningArtifact -func (tr *ProvisioningArtifact) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ProvisioningArtifact -func (tr *ProvisioningArtifact) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ProvisioningArtifact -func (tr *ProvisioningArtifact) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ProvisioningArtifact using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ProvisioningArtifact) LateInitialize(attrs []byte) (bool, error) { - params := &ProvisioningArtifactParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ProvisioningArtifact) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ServiceAction -func (mg *ServiceAction) GetTerraformResourceType() string { - return "aws_servicecatalog_service_action" -} - -// GetConnectionDetailsMapping for this ServiceAction -func (tr *ServiceAction) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ServiceAction -func (tr *ServiceAction) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ServiceAction -func (tr *ServiceAction) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ServiceAction -func (tr *ServiceAction) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ServiceAction -func (tr *ServiceAction) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ServiceAction -func (tr *ServiceAction) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ServiceAction -func (tr *ServiceAction) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ServiceAction -func (tr *ServiceAction) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ServiceAction using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ServiceAction) LateInitialize(attrs []byte) (bool, error) { - params := &ServiceActionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ServiceAction) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TagOption -func (mg *TagOption) GetTerraformResourceType() string { - return "aws_servicecatalog_tag_option" -} - -// GetConnectionDetailsMapping for this TagOption -func (tr *TagOption) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TagOption -func (tr *TagOption) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TagOption -func (tr *TagOption) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TagOption -func (tr *TagOption) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TagOption -func (tr *TagOption) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TagOption -func (tr *TagOption) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TagOption -func (tr *TagOption) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TagOption -func (tr *TagOption) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TagOption using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TagOption) LateInitialize(attrs []byte) (bool, error) { - params := &TagOptionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TagOption) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TagOptionResourceAssociation -func (mg *TagOptionResourceAssociation) GetTerraformResourceType() string { - return "aws_servicecatalog_tag_option_resource_association" -} - -// GetConnectionDetailsMapping for this TagOptionResourceAssociation -func (tr *TagOptionResourceAssociation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TagOptionResourceAssociation -func (tr *TagOptionResourceAssociation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TagOptionResourceAssociation -func (tr *TagOptionResourceAssociation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TagOptionResourceAssociation -func (tr *TagOptionResourceAssociation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TagOptionResourceAssociation -func (tr *TagOptionResourceAssociation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TagOptionResourceAssociation -func (tr *TagOptionResourceAssociation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TagOptionResourceAssociation -func (tr *TagOptionResourceAssociation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TagOptionResourceAssociation -func (tr *TagOptionResourceAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TagOptionResourceAssociation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TagOptionResourceAssociation) LateInitialize(attrs []byte) (bool, error) { - params := &TagOptionResourceAssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TagOptionResourceAssociation) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/servicecatalog/v1beta1/zz_portfolio_terraformed.go b/apis/servicecatalog/v1beta1/zz_portfolio_terraformed.go new file mode 100755 index 0000000000..3baf7c90fe --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_portfolio_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Portfolio +func (mg *Portfolio) GetTerraformResourceType() string { + return "aws_servicecatalog_portfolio" +} + +// GetConnectionDetailsMapping for this Portfolio +func (tr *Portfolio) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Portfolio +func (tr *Portfolio) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Portfolio +func (tr *Portfolio) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Portfolio +func (tr *Portfolio) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Portfolio +func (tr *Portfolio) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Portfolio +func (tr *Portfolio) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Portfolio +func (tr *Portfolio) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Portfolio +func (tr *Portfolio) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Portfolio using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Portfolio) LateInitialize(attrs []byte) (bool, error) { + params := &PortfolioParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Portfolio) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicecatalog/v1beta1/zz_portfolio_types.go b/apis/servicecatalog/v1beta1/zz_portfolio_types.go index b7504c0493..48c1d04025 100755 --- a/apis/servicecatalog/v1beta1/zz_portfolio_types.go +++ b/apis/servicecatalog/v1beta1/zz_portfolio_types.go @@ -108,13 +108,14 @@ type PortfolioStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Portfolio is the Schema for the Portfolios API. Provides a resource to create a Service Catalog portfolio // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Portfolio struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicecatalog/v1beta1/zz_portfolioshare_terraformed.go b/apis/servicecatalog/v1beta1/zz_portfolioshare_terraformed.go new file mode 100755 index 0000000000..39f4ac1ced --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_portfolioshare_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PortfolioShare +func (mg *PortfolioShare) GetTerraformResourceType() string { + return "aws_servicecatalog_portfolio_share" +} + +// GetConnectionDetailsMapping for this PortfolioShare +func (tr *PortfolioShare) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PortfolioShare +func (tr *PortfolioShare) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PortfolioShare +func (tr *PortfolioShare) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PortfolioShare +func (tr *PortfolioShare) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PortfolioShare +func (tr *PortfolioShare) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PortfolioShare +func (tr *PortfolioShare) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PortfolioShare +func (tr *PortfolioShare) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PortfolioShare +func (tr *PortfolioShare) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PortfolioShare using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PortfolioShare) LateInitialize(attrs []byte) (bool, error) { + params := &PortfolioShareParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PortfolioShare) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicecatalog/v1beta1/zz_portfolioshare_types.go b/apis/servicecatalog/v1beta1/zz_portfolioshare_types.go index 01d082a032..3fc88dcfe6 100755 --- a/apis/servicecatalog/v1beta1/zz_portfolioshare_types.go +++ b/apis/servicecatalog/v1beta1/zz_portfolioshare_types.go @@ -150,13 +150,14 @@ type PortfolioShareStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PortfolioShare is the Schema for the PortfolioShares API. Manages a Service Catalog Portfolio Share // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PortfolioShare struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicecatalog/v1beta1/zz_principalportfolioassociation_terraformed.go b/apis/servicecatalog/v1beta1/zz_principalportfolioassociation_terraformed.go new file mode 100755 index 0000000000..2487a2ad09 --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_principalportfolioassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PrincipalPortfolioAssociation +func (mg *PrincipalPortfolioAssociation) GetTerraformResourceType() string { + return "aws_servicecatalog_principal_portfolio_association" +} + +// GetConnectionDetailsMapping for this PrincipalPortfolioAssociation +func (tr *PrincipalPortfolioAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PrincipalPortfolioAssociation +func (tr *PrincipalPortfolioAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PrincipalPortfolioAssociation +func (tr *PrincipalPortfolioAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PrincipalPortfolioAssociation +func (tr *PrincipalPortfolioAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PrincipalPortfolioAssociation +func (tr *PrincipalPortfolioAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PrincipalPortfolioAssociation +func (tr *PrincipalPortfolioAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PrincipalPortfolioAssociation +func (tr *PrincipalPortfolioAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PrincipalPortfolioAssociation +func (tr *PrincipalPortfolioAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PrincipalPortfolioAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PrincipalPortfolioAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &PrincipalPortfolioAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PrincipalPortfolioAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicecatalog/v1beta1/zz_principalportfolioassociation_types.go b/apis/servicecatalog/v1beta1/zz_principalportfolioassociation_types.go index 69a346fb37..9eb27804ca 100755 --- a/apis/servicecatalog/v1beta1/zz_principalportfolioassociation_types.go +++ b/apis/servicecatalog/v1beta1/zz_principalportfolioassociation_types.go @@ -136,13 +136,14 @@ type PrincipalPortfolioAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PrincipalPortfolioAssociation is the Schema for the PrincipalPortfolioAssociations API. Manages a Service Catalog Principal Portfolio Association // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PrincipalPortfolioAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicecatalog/v1beta1/zz_product_terraformed.go b/apis/servicecatalog/v1beta1/zz_product_terraformed.go new file mode 100755 index 0000000000..628dd4d9f3 --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_product_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Product +func (mg *Product) GetTerraformResourceType() string { + return "aws_servicecatalog_product" +} + +// GetConnectionDetailsMapping for this Product +func (tr *Product) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Product +func (tr *Product) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Product +func (tr *Product) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Product +func (tr *Product) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Product +func (tr *Product) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Product +func (tr *Product) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Product +func (tr *Product) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Product +func (tr *Product) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Product using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Product) LateInitialize(attrs []byte) (bool, error) { + params := &ProductParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Product) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicecatalog/v1beta1/zz_product_types.go b/apis/servicecatalog/v1beta1/zz_product_types.go index cf95a4d195..94c6e8c80b 100755 --- a/apis/servicecatalog/v1beta1/zz_product_types.go +++ b/apis/servicecatalog/v1beta1/zz_product_types.go @@ -256,13 +256,14 @@ type ProductStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Product is the Schema for the Products API. Manages a Service Catalog Product // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Product struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicecatalog/v1beta1/zz_productportfolioassociation_terraformed.go b/apis/servicecatalog/v1beta1/zz_productportfolioassociation_terraformed.go new file mode 100755 index 0000000000..3db1f9fcf9 --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_productportfolioassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ProductPortfolioAssociation +func (mg *ProductPortfolioAssociation) GetTerraformResourceType() string { + return "aws_servicecatalog_product_portfolio_association" +} + +// GetConnectionDetailsMapping for this ProductPortfolioAssociation +func (tr *ProductPortfolioAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ProductPortfolioAssociation +func (tr *ProductPortfolioAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ProductPortfolioAssociation +func (tr *ProductPortfolioAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ProductPortfolioAssociation +func (tr *ProductPortfolioAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ProductPortfolioAssociation +func (tr *ProductPortfolioAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ProductPortfolioAssociation +func (tr *ProductPortfolioAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ProductPortfolioAssociation +func (tr *ProductPortfolioAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ProductPortfolioAssociation +func (tr *ProductPortfolioAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ProductPortfolioAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ProductPortfolioAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &ProductPortfolioAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ProductPortfolioAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicecatalog/v1beta1/zz_productportfolioassociation_types.go b/apis/servicecatalog/v1beta1/zz_productportfolioassociation_types.go index ed96ce7db8..aa941762d6 100755 --- a/apis/servicecatalog/v1beta1/zz_productportfolioassociation_types.go +++ b/apis/servicecatalog/v1beta1/zz_productportfolioassociation_types.go @@ -134,13 +134,14 @@ type ProductPortfolioAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ProductPortfolioAssociation is the Schema for the ProductPortfolioAssociations API. Manages a Service Catalog Product Portfolio Association // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ProductPortfolioAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicecatalog/v1beta1/zz_provisioningartifact_terraformed.go b/apis/servicecatalog/v1beta1/zz_provisioningartifact_terraformed.go new file mode 100755 index 0000000000..cc5ceb1975 --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_provisioningartifact_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ProvisioningArtifact +func (mg *ProvisioningArtifact) GetTerraformResourceType() string { + return "aws_servicecatalog_provisioning_artifact" +} + +// GetConnectionDetailsMapping for this ProvisioningArtifact +func (tr *ProvisioningArtifact) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ProvisioningArtifact +func (tr *ProvisioningArtifact) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ProvisioningArtifact +func (tr *ProvisioningArtifact) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ProvisioningArtifact +func (tr *ProvisioningArtifact) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ProvisioningArtifact +func (tr *ProvisioningArtifact) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ProvisioningArtifact +func (tr *ProvisioningArtifact) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ProvisioningArtifact +func (tr *ProvisioningArtifact) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ProvisioningArtifact +func (tr *ProvisioningArtifact) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ProvisioningArtifact using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ProvisioningArtifact) LateInitialize(attrs []byte) (bool, error) { + params := &ProvisioningArtifactParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ProvisioningArtifact) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicecatalog/v1beta1/zz_provisioningartifact_types.go b/apis/servicecatalog/v1beta1/zz_provisioningartifact_types.go index 632aa10d00..143517ccdf 100755 --- a/apis/servicecatalog/v1beta1/zz_provisioningartifact_types.go +++ b/apis/servicecatalog/v1beta1/zz_provisioningartifact_types.go @@ -184,13 +184,14 @@ type ProvisioningArtifactStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ProvisioningArtifact is the Schema for the ProvisioningArtifacts API. Manages a Service Catalog Provisioning Artifact // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ProvisioningArtifact struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicecatalog/v1beta1/zz_serviceaction_terraformed.go b/apis/servicecatalog/v1beta1/zz_serviceaction_terraformed.go new file mode 100755 index 0000000000..c272503ffb --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_serviceaction_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ServiceAction +func (mg *ServiceAction) GetTerraformResourceType() string { + return "aws_servicecatalog_service_action" +} + +// GetConnectionDetailsMapping for this ServiceAction +func (tr *ServiceAction) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ServiceAction +func (tr *ServiceAction) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ServiceAction +func (tr *ServiceAction) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ServiceAction +func (tr *ServiceAction) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ServiceAction +func (tr *ServiceAction) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ServiceAction +func (tr *ServiceAction) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ServiceAction +func (tr *ServiceAction) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ServiceAction +func (tr *ServiceAction) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ServiceAction using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ServiceAction) LateInitialize(attrs []byte) (bool, error) { + params := &ServiceActionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ServiceAction) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicecatalog/v1beta1/zz_serviceaction_types.go b/apis/servicecatalog/v1beta1/zz_serviceaction_types.go index 82ab9942fc..d0ff3b1829 100755 --- a/apis/servicecatalog/v1beta1/zz_serviceaction_types.go +++ b/apis/servicecatalog/v1beta1/zz_serviceaction_types.go @@ -157,13 +157,14 @@ type ServiceActionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ServiceAction is the Schema for the ServiceActions API. Manages a Service Catalog Service Action // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ServiceAction struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicecatalog/v1beta1/zz_tagoption_terraformed.go b/apis/servicecatalog/v1beta1/zz_tagoption_terraformed.go new file mode 100755 index 0000000000..96462fcd03 --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_tagoption_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TagOption +func (mg *TagOption) GetTerraformResourceType() string { + return "aws_servicecatalog_tag_option" +} + +// GetConnectionDetailsMapping for this TagOption +func (tr *TagOption) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TagOption +func (tr *TagOption) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TagOption +func (tr *TagOption) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TagOption +func (tr *TagOption) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TagOption +func (tr *TagOption) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TagOption +func (tr *TagOption) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TagOption +func (tr *TagOption) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TagOption +func (tr *TagOption) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TagOption using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TagOption) LateInitialize(attrs []byte) (bool, error) { + params := &TagOptionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TagOption) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicecatalog/v1beta1/zz_tagoption_types.go b/apis/servicecatalog/v1beta1/zz_tagoption_types.go index fc59b0a728..f06492826a 100755 --- a/apis/servicecatalog/v1beta1/zz_tagoption_types.go +++ b/apis/servicecatalog/v1beta1/zz_tagoption_types.go @@ -90,13 +90,14 @@ type TagOptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TagOption is the Schema for the TagOptions API. Manages a Service Catalog Tag Option // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TagOption struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicecatalog/v1beta1/zz_tagoptionresourceassociation_terraformed.go b/apis/servicecatalog/v1beta1/zz_tagoptionresourceassociation_terraformed.go new file mode 100755 index 0000000000..e47b4954a3 --- /dev/null +++ b/apis/servicecatalog/v1beta1/zz_tagoptionresourceassociation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TagOptionResourceAssociation +func (mg *TagOptionResourceAssociation) GetTerraformResourceType() string { + return "aws_servicecatalog_tag_option_resource_association" +} + +// GetConnectionDetailsMapping for this TagOptionResourceAssociation +func (tr *TagOptionResourceAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TagOptionResourceAssociation +func (tr *TagOptionResourceAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TagOptionResourceAssociation +func (tr *TagOptionResourceAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TagOptionResourceAssociation +func (tr *TagOptionResourceAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TagOptionResourceAssociation +func (tr *TagOptionResourceAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TagOptionResourceAssociation +func (tr *TagOptionResourceAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TagOptionResourceAssociation +func (tr *TagOptionResourceAssociation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TagOptionResourceAssociation +func (tr *TagOptionResourceAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TagOptionResourceAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TagOptionResourceAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &TagOptionResourceAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TagOptionResourceAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicecatalog/v1beta1/zz_tagoptionresourceassociation_types.go b/apis/servicecatalog/v1beta1/zz_tagoptionresourceassociation_types.go index ce38a3f26e..2a595c6489 100755 --- a/apis/servicecatalog/v1beta1/zz_tagoptionresourceassociation_types.go +++ b/apis/servicecatalog/v1beta1/zz_tagoptionresourceassociation_types.go @@ -126,13 +126,14 @@ type TagOptionResourceAssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TagOptionResourceAssociation is the Schema for the TagOptionResourceAssociations API. Manages a Service Catalog Tag Option Resource Association // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TagOptionResourceAssociation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicediscovery/v1beta1/zz_generated.conversion_hubs.go b/apis/servicediscovery/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..17c54cc18a --- /dev/null +++ b/apis/servicediscovery/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *HTTPNamespace) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PrivateDNSNamespace) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PublicDNSNamespace) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Service) Hub() {} diff --git a/apis/servicediscovery/v1beta1/zz_generated_terraformed.go b/apis/servicediscovery/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index c53966124f..0000000000 --- a/apis/servicediscovery/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this HTTPNamespace -func (mg *HTTPNamespace) GetTerraformResourceType() string { - return "aws_service_discovery_http_namespace" -} - -// GetConnectionDetailsMapping for this HTTPNamespace -func (tr *HTTPNamespace) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this HTTPNamespace -func (tr *HTTPNamespace) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this HTTPNamespace -func (tr *HTTPNamespace) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this HTTPNamespace -func (tr *HTTPNamespace) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this HTTPNamespace -func (tr *HTTPNamespace) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this HTTPNamespace -func (tr *HTTPNamespace) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this HTTPNamespace -func (tr *HTTPNamespace) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this HTTPNamespace -func (tr *HTTPNamespace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this HTTPNamespace using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *HTTPNamespace) LateInitialize(attrs []byte) (bool, error) { - params := &HTTPNamespaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *HTTPNamespace) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PrivateDNSNamespace -func (mg *PrivateDNSNamespace) GetTerraformResourceType() string { - return "aws_service_discovery_private_dns_namespace" -} - -// GetConnectionDetailsMapping for this PrivateDNSNamespace -func (tr *PrivateDNSNamespace) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PrivateDNSNamespace -func (tr *PrivateDNSNamespace) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PrivateDNSNamespace -func (tr *PrivateDNSNamespace) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PrivateDNSNamespace -func (tr *PrivateDNSNamespace) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PrivateDNSNamespace -func (tr *PrivateDNSNamespace) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PrivateDNSNamespace -func (tr *PrivateDNSNamespace) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PrivateDNSNamespace -func (tr *PrivateDNSNamespace) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PrivateDNSNamespace -func (tr *PrivateDNSNamespace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PrivateDNSNamespace using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PrivateDNSNamespace) LateInitialize(attrs []byte) (bool, error) { - params := &PrivateDNSNamespaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PrivateDNSNamespace) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PublicDNSNamespace -func (mg *PublicDNSNamespace) GetTerraformResourceType() string { - return "aws_service_discovery_public_dns_namespace" -} - -// GetConnectionDetailsMapping for this PublicDNSNamespace -func (tr *PublicDNSNamespace) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PublicDNSNamespace -func (tr *PublicDNSNamespace) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PublicDNSNamespace -func (tr *PublicDNSNamespace) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PublicDNSNamespace -func (tr *PublicDNSNamespace) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PublicDNSNamespace -func (tr *PublicDNSNamespace) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PublicDNSNamespace -func (tr *PublicDNSNamespace) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PublicDNSNamespace -func (tr *PublicDNSNamespace) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PublicDNSNamespace -func (tr *PublicDNSNamespace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PublicDNSNamespace using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PublicDNSNamespace) LateInitialize(attrs []byte) (bool, error) { - params := &PublicDNSNamespaceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PublicDNSNamespace) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Service -func (mg *Service) GetTerraformResourceType() string { - return "aws_service_discovery_service" -} - -// GetConnectionDetailsMapping for this Service -func (tr *Service) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Service -func (tr *Service) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Service -func (tr *Service) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Service -func (tr *Service) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Service -func (tr *Service) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Service -func (tr *Service) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Service -func (tr *Service) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Service -func (tr *Service) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Service using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Service) LateInitialize(attrs []byte) (bool, error) { - params := &ServiceParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Service) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/servicediscovery/v1beta1/zz_httpnamespace_terraformed.go b/apis/servicediscovery/v1beta1/zz_httpnamespace_terraformed.go new file mode 100755 index 0000000000..56e0ddcd74 --- /dev/null +++ b/apis/servicediscovery/v1beta1/zz_httpnamespace_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this HTTPNamespace +func (mg *HTTPNamespace) GetTerraformResourceType() string { + return "aws_service_discovery_http_namespace" +} + +// GetConnectionDetailsMapping for this HTTPNamespace +func (tr *HTTPNamespace) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this HTTPNamespace +func (tr *HTTPNamespace) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this HTTPNamespace +func (tr *HTTPNamespace) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this HTTPNamespace +func (tr *HTTPNamespace) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this HTTPNamespace +func (tr *HTTPNamespace) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this HTTPNamespace +func (tr *HTTPNamespace) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this HTTPNamespace +func (tr *HTTPNamespace) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this HTTPNamespace +func (tr *HTTPNamespace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this HTTPNamespace using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *HTTPNamespace) LateInitialize(attrs []byte) (bool, error) { + params := &HTTPNamespaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *HTTPNamespace) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicediscovery/v1beta1/zz_httpnamespace_types.go b/apis/servicediscovery/v1beta1/zz_httpnamespace_types.go index 4e99459cd4..d68489d3c0 100755 --- a/apis/servicediscovery/v1beta1/zz_httpnamespace_types.go +++ b/apis/servicediscovery/v1beta1/zz_httpnamespace_types.go @@ -101,13 +101,14 @@ type HTTPNamespaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // HTTPNamespace is the Schema for the HTTPNamespaces API. Provides a Service Discovery HTTP Namespace resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type HTTPNamespace struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicediscovery/v1beta1/zz_privatednsnamespace_terraformed.go b/apis/servicediscovery/v1beta1/zz_privatednsnamespace_terraformed.go new file mode 100755 index 0000000000..846107e01c --- /dev/null +++ b/apis/servicediscovery/v1beta1/zz_privatednsnamespace_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PrivateDNSNamespace +func (mg *PrivateDNSNamespace) GetTerraformResourceType() string { + return "aws_service_discovery_private_dns_namespace" +} + +// GetConnectionDetailsMapping for this PrivateDNSNamespace +func (tr *PrivateDNSNamespace) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PrivateDNSNamespace +func (tr *PrivateDNSNamespace) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PrivateDNSNamespace +func (tr *PrivateDNSNamespace) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PrivateDNSNamespace +func (tr *PrivateDNSNamespace) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PrivateDNSNamespace +func (tr *PrivateDNSNamespace) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PrivateDNSNamespace +func (tr *PrivateDNSNamespace) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PrivateDNSNamespace +func (tr *PrivateDNSNamespace) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PrivateDNSNamespace +func (tr *PrivateDNSNamespace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PrivateDNSNamespace using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PrivateDNSNamespace) LateInitialize(attrs []byte) (bool, error) { + params := &PrivateDNSNamespaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PrivateDNSNamespace) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicediscovery/v1beta1/zz_privatednsnamespace_types.go b/apis/servicediscovery/v1beta1/zz_privatednsnamespace_types.go index 85f31f0e2f..9cb60a241b 100755 --- a/apis/servicediscovery/v1beta1/zz_privatednsnamespace_types.go +++ b/apis/servicediscovery/v1beta1/zz_privatednsnamespace_types.go @@ -129,13 +129,14 @@ type PrivateDNSNamespaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PrivateDNSNamespace is the Schema for the PrivateDNSNamespaces API. Provides a Service Discovery Private DNS Namespace resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PrivateDNSNamespace struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicediscovery/v1beta1/zz_publicdnsnamespace_terraformed.go b/apis/servicediscovery/v1beta1/zz_publicdnsnamespace_terraformed.go new file mode 100755 index 0000000000..8ab604759a --- /dev/null +++ b/apis/servicediscovery/v1beta1/zz_publicdnsnamespace_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PublicDNSNamespace +func (mg *PublicDNSNamespace) GetTerraformResourceType() string { + return "aws_service_discovery_public_dns_namespace" +} + +// GetConnectionDetailsMapping for this PublicDNSNamespace +func (tr *PublicDNSNamespace) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PublicDNSNamespace +func (tr *PublicDNSNamespace) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PublicDNSNamespace +func (tr *PublicDNSNamespace) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PublicDNSNamespace +func (tr *PublicDNSNamespace) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PublicDNSNamespace +func (tr *PublicDNSNamespace) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PublicDNSNamespace +func (tr *PublicDNSNamespace) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PublicDNSNamespace +func (tr *PublicDNSNamespace) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PublicDNSNamespace +func (tr *PublicDNSNamespace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PublicDNSNamespace using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PublicDNSNamespace) LateInitialize(attrs []byte) (bool, error) { + params := &PublicDNSNamespaceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PublicDNSNamespace) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicediscovery/v1beta1/zz_publicdnsnamespace_types.go b/apis/servicediscovery/v1beta1/zz_publicdnsnamespace_types.go index 9c5d151d2f..a2b41ffe1d 100755 --- a/apis/servicediscovery/v1beta1/zz_publicdnsnamespace_types.go +++ b/apis/servicediscovery/v1beta1/zz_publicdnsnamespace_types.go @@ -101,13 +101,14 @@ type PublicDNSNamespaceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PublicDNSNamespace is the Schema for the PublicDNSNamespaces API. Provides a Service Discovery Public DNS Namespace resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PublicDNSNamespace struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicediscovery/v1beta1/zz_service_terraformed.go b/apis/servicediscovery/v1beta1/zz_service_terraformed.go new file mode 100755 index 0000000000..72fe420a56 --- /dev/null +++ b/apis/servicediscovery/v1beta1/zz_service_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Service +func (mg *Service) GetTerraformResourceType() string { + return "aws_service_discovery_service" +} + +// GetConnectionDetailsMapping for this Service +func (tr *Service) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Service +func (tr *Service) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Service +func (tr *Service) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Service +func (tr *Service) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Service +func (tr *Service) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Service +func (tr *Service) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Service +func (tr *Service) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Service +func (tr *Service) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Service using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Service) LateInitialize(attrs []byte) (bool, error) { + params := &ServiceParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Service) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/servicediscovery/v1beta1/zz_service_types.go b/apis/servicediscovery/v1beta1/zz_service_types.go index 2d5be87b13..e271a19e6e 100755 --- a/apis/servicediscovery/v1beta1/zz_service_types.go +++ b/apis/servicediscovery/v1beta1/zz_service_types.go @@ -304,13 +304,14 @@ type ServiceStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Service is the Schema for the Services API. Provides a Service Discovery Service resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Service struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/servicequotas/v1beta1/zz_generated.conversion_hubs.go b/apis/servicequotas/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..2a7387b89c --- /dev/null +++ b/apis/servicequotas/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ServiceQuota) Hub() {} diff --git a/apis/servicequotas/v1beta1/zz_generated_terraformed.go b/apis/servicequotas/v1beta1/zz_servicequota_terraformed.go similarity index 100% rename from apis/servicequotas/v1beta1/zz_generated_terraformed.go rename to apis/servicequotas/v1beta1/zz_servicequota_terraformed.go diff --git a/apis/servicequotas/v1beta1/zz_servicequota_types.go b/apis/servicequotas/v1beta1/zz_servicequota_types.go index 0de733f373..4849eccf5a 100755 --- a/apis/servicequotas/v1beta1/zz_servicequota_types.go +++ b/apis/servicequotas/v1beta1/zz_servicequota_types.go @@ -148,13 +148,14 @@ type ServiceQuotaStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ServiceQuota is the Schema for the ServiceQuotas API. Manages an individual Service Quota // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ServiceQuota struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_activereceiptruleset_terraformed.go b/apis/ses/v1beta1/zz_activereceiptruleset_terraformed.go new file mode 100755 index 0000000000..a347227e84 --- /dev/null +++ b/apis/ses/v1beta1/zz_activereceiptruleset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ActiveReceiptRuleSet +func (mg *ActiveReceiptRuleSet) GetTerraformResourceType() string { + return "aws_ses_active_receipt_rule_set" +} + +// GetConnectionDetailsMapping for this ActiveReceiptRuleSet +func (tr *ActiveReceiptRuleSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ActiveReceiptRuleSet +func (tr *ActiveReceiptRuleSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ActiveReceiptRuleSet +func (tr *ActiveReceiptRuleSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ActiveReceiptRuleSet +func (tr *ActiveReceiptRuleSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ActiveReceiptRuleSet +func (tr *ActiveReceiptRuleSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ActiveReceiptRuleSet +func (tr *ActiveReceiptRuleSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ActiveReceiptRuleSet +func (tr *ActiveReceiptRuleSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ActiveReceiptRuleSet +func (tr *ActiveReceiptRuleSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ActiveReceiptRuleSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ActiveReceiptRuleSet) LateInitialize(attrs []byte) (bool, error) { + params := &ActiveReceiptRuleSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ActiveReceiptRuleSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_activereceiptruleset_types.go b/apis/ses/v1beta1/zz_activereceiptruleset_types.go index 5d9bba72e8..43d49db00c 100755 --- a/apis/ses/v1beta1/zz_activereceiptruleset_types.go +++ b/apis/ses/v1beta1/zz_activereceiptruleset_types.go @@ -71,13 +71,14 @@ type ActiveReceiptRuleSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ActiveReceiptRuleSet is the Schema for the ActiveReceiptRuleSets API. Provides a resource to designate the active SES receipt rule set // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ActiveReceiptRuleSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_configurationset_terraformed.go b/apis/ses/v1beta1/zz_configurationset_terraformed.go new file mode 100755 index 0000000000..7bb3214cee --- /dev/null +++ b/apis/ses/v1beta1/zz_configurationset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConfigurationSet +func (mg *ConfigurationSet) GetTerraformResourceType() string { + return "aws_ses_configuration_set" +} + +// GetConnectionDetailsMapping for this ConfigurationSet +func (tr *ConfigurationSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ConfigurationSet +func (tr *ConfigurationSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConfigurationSet +func (tr *ConfigurationSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConfigurationSet +func (tr *ConfigurationSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConfigurationSet +func (tr *ConfigurationSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConfigurationSet +func (tr *ConfigurationSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConfigurationSet +func (tr *ConfigurationSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConfigurationSet +func (tr *ConfigurationSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConfigurationSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConfigurationSet) LateInitialize(attrs []byte) (bool, error) { + params := &ConfigurationSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConfigurationSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_configurationset_types.go b/apis/ses/v1beta1/zz_configurationset_types.go index 49974fa275..4ace84e3b9 100755 --- a/apis/ses/v1beta1/zz_configurationset_types.go +++ b/apis/ses/v1beta1/zz_configurationset_types.go @@ -142,13 +142,14 @@ type ConfigurationSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConfigurationSet is the Schema for the ConfigurationSets API. Provides an SES configuration set // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConfigurationSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_domaindkim_terraformed.go b/apis/ses/v1beta1/zz_domaindkim_terraformed.go new file mode 100755 index 0000000000..a990c1dd39 --- /dev/null +++ b/apis/ses/v1beta1/zz_domaindkim_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DomainDKIM +func (mg *DomainDKIM) GetTerraformResourceType() string { + return "aws_ses_domain_dkim" +} + +// GetConnectionDetailsMapping for this DomainDKIM +func (tr *DomainDKIM) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DomainDKIM +func (tr *DomainDKIM) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DomainDKIM +func (tr *DomainDKIM) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DomainDKIM +func (tr *DomainDKIM) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DomainDKIM +func (tr *DomainDKIM) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DomainDKIM +func (tr *DomainDKIM) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DomainDKIM +func (tr *DomainDKIM) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DomainDKIM +func (tr *DomainDKIM) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DomainDKIM using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DomainDKIM) LateInitialize(attrs []byte) (bool, error) { + params := &DomainDKIMParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DomainDKIM) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_domaindkim_types.go b/apis/ses/v1beta1/zz_domaindkim_types.go index 9d01dfc29a..836d5288f0 100755 --- a/apis/ses/v1beta1/zz_domaindkim_types.go +++ b/apis/ses/v1beta1/zz_domaindkim_types.go @@ -63,13 +63,14 @@ type DomainDKIMStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DomainDKIM is the Schema for the DomainDKIMs API. Provides an SES domain DKIM generation resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DomainDKIM struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_domainidentity_terraformed.go b/apis/ses/v1beta1/zz_domainidentity_terraformed.go new file mode 100755 index 0000000000..c466ef0aa4 --- /dev/null +++ b/apis/ses/v1beta1/zz_domainidentity_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DomainIdentity +func (mg *DomainIdentity) GetTerraformResourceType() string { + return "aws_ses_domain_identity" +} + +// GetConnectionDetailsMapping for this DomainIdentity +func (tr *DomainIdentity) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DomainIdentity +func (tr *DomainIdentity) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DomainIdentity +func (tr *DomainIdentity) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DomainIdentity +func (tr *DomainIdentity) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DomainIdentity +func (tr *DomainIdentity) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DomainIdentity +func (tr *DomainIdentity) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DomainIdentity +func (tr *DomainIdentity) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DomainIdentity +func (tr *DomainIdentity) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DomainIdentity using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DomainIdentity) LateInitialize(attrs []byte) (bool, error) { + params := &DomainIdentityParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DomainIdentity) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_domainidentity_types.go b/apis/ses/v1beta1/zz_domainidentity_types.go index 9e8a9c1f03..c6de7fb9ee 100755 --- a/apis/ses/v1beta1/zz_domainidentity_types.go +++ b/apis/ses/v1beta1/zz_domainidentity_types.go @@ -68,13 +68,14 @@ type DomainIdentityStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DomainIdentity is the Schema for the DomainIdentitys API. Provides an SES domain identity resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DomainIdentity struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_domainmailfrom_terraformed.go b/apis/ses/v1beta1/zz_domainmailfrom_terraformed.go new file mode 100755 index 0000000000..c15409af5a --- /dev/null +++ b/apis/ses/v1beta1/zz_domainmailfrom_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DomainMailFrom +func (mg *DomainMailFrom) GetTerraformResourceType() string { + return "aws_ses_domain_mail_from" +} + +// GetConnectionDetailsMapping for this DomainMailFrom +func (tr *DomainMailFrom) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DomainMailFrom +func (tr *DomainMailFrom) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DomainMailFrom +func (tr *DomainMailFrom) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DomainMailFrom +func (tr *DomainMailFrom) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DomainMailFrom +func (tr *DomainMailFrom) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DomainMailFrom +func (tr *DomainMailFrom) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DomainMailFrom +func (tr *DomainMailFrom) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DomainMailFrom +func (tr *DomainMailFrom) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DomainMailFrom using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DomainMailFrom) LateInitialize(attrs []byte) (bool, error) { + params := &DomainMailFromParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DomainMailFrom) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_domainmailfrom_types.go b/apis/ses/v1beta1/zz_domainmailfrom_types.go index 6753cd32b4..c7ee9b9dd0 100755 --- a/apis/ses/v1beta1/zz_domainmailfrom_types.go +++ b/apis/ses/v1beta1/zz_domainmailfrom_types.go @@ -106,13 +106,14 @@ type DomainMailFromStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DomainMailFrom is the Schema for the DomainMailFroms API. Provides an SES domain MAIL FROM resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DomainMailFrom struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_emailidentity_terraformed.go b/apis/ses/v1beta1/zz_emailidentity_terraformed.go new file mode 100755 index 0000000000..c57e0a0a1a --- /dev/null +++ b/apis/ses/v1beta1/zz_emailidentity_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EmailIdentity +func (mg *EmailIdentity) GetTerraformResourceType() string { + return "aws_ses_email_identity" +} + +// GetConnectionDetailsMapping for this EmailIdentity +func (tr *EmailIdentity) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EmailIdentity +func (tr *EmailIdentity) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EmailIdentity +func (tr *EmailIdentity) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EmailIdentity +func (tr *EmailIdentity) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EmailIdentity +func (tr *EmailIdentity) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EmailIdentity +func (tr *EmailIdentity) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EmailIdentity +func (tr *EmailIdentity) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EmailIdentity +func (tr *EmailIdentity) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EmailIdentity using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EmailIdentity) LateInitialize(attrs []byte) (bool, error) { + params := &EmailIdentityParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EmailIdentity) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_emailidentity_types.go b/apis/ses/v1beta1/zz_emailidentity_types.go index 3306f9a396..c04e613931 100755 --- a/apis/ses/v1beta1/zz_emailidentity_types.go +++ b/apis/ses/v1beta1/zz_emailidentity_types.go @@ -70,13 +70,14 @@ type EmailIdentityStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EmailIdentity is the Schema for the EmailIdentitys API. Provides an SES email identity resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EmailIdentity struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_eventdestination_terraformed.go b/apis/ses/v1beta1/zz_eventdestination_terraformed.go new file mode 100755 index 0000000000..c824f7dc12 --- /dev/null +++ b/apis/ses/v1beta1/zz_eventdestination_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EventDestination +func (mg *EventDestination) GetTerraformResourceType() string { + return "aws_ses_event_destination" +} + +// GetConnectionDetailsMapping for this EventDestination +func (tr *EventDestination) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EventDestination +func (tr *EventDestination) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EventDestination +func (tr *EventDestination) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EventDestination +func (tr *EventDestination) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EventDestination +func (tr *EventDestination) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EventDestination +func (tr *EventDestination) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EventDestination +func (tr *EventDestination) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EventDestination +func (tr *EventDestination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EventDestination using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EventDestination) LateInitialize(attrs []byte) (bool, error) { + params := &EventDestinationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EventDestination) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_eventdestination_types.go b/apis/ses/v1beta1/zz_eventdestination_types.go index fca940b98a..c98513596c 100755 --- a/apis/ses/v1beta1/zz_eventdestination_types.go +++ b/apis/ses/v1beta1/zz_eventdestination_types.go @@ -289,13 +289,14 @@ type EventDestinationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EventDestination is the Schema for the EventDestinations API. Provides an SES event destination // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EventDestination struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_generated.conversion_hubs.go b/apis/ses/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..b455a6a500 --- /dev/null +++ b/apis/ses/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ActiveReceiptRuleSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ConfigurationSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DomainDKIM) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DomainIdentity) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DomainMailFrom) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EmailIdentity) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EventDestination) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *IdentityNotificationTopic) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *IdentityPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReceiptFilter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReceiptRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ReceiptRuleSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Template) Hub() {} diff --git a/apis/ses/v1beta1/zz_generated_terraformed.go b/apis/ses/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index d148a6c64d..0000000000 --- a/apis/ses/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1501 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this ActiveReceiptRuleSet -func (mg *ActiveReceiptRuleSet) GetTerraformResourceType() string { - return "aws_ses_active_receipt_rule_set" -} - -// GetConnectionDetailsMapping for this ActiveReceiptRuleSet -func (tr *ActiveReceiptRuleSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ActiveReceiptRuleSet -func (tr *ActiveReceiptRuleSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ActiveReceiptRuleSet -func (tr *ActiveReceiptRuleSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ActiveReceiptRuleSet -func (tr *ActiveReceiptRuleSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ActiveReceiptRuleSet -func (tr *ActiveReceiptRuleSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ActiveReceiptRuleSet -func (tr *ActiveReceiptRuleSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ActiveReceiptRuleSet -func (tr *ActiveReceiptRuleSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ActiveReceiptRuleSet -func (tr *ActiveReceiptRuleSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ActiveReceiptRuleSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ActiveReceiptRuleSet) LateInitialize(attrs []byte) (bool, error) { - params := &ActiveReceiptRuleSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ActiveReceiptRuleSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ConfigurationSet -func (mg *ConfigurationSet) GetTerraformResourceType() string { - return "aws_ses_configuration_set" -} - -// GetConnectionDetailsMapping for this ConfigurationSet -func (tr *ConfigurationSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ConfigurationSet -func (tr *ConfigurationSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConfigurationSet -func (tr *ConfigurationSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConfigurationSet -func (tr *ConfigurationSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConfigurationSet -func (tr *ConfigurationSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConfigurationSet -func (tr *ConfigurationSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConfigurationSet -func (tr *ConfigurationSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConfigurationSet -func (tr *ConfigurationSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConfigurationSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConfigurationSet) LateInitialize(attrs []byte) (bool, error) { - params := &ConfigurationSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConfigurationSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DomainDKIM -func (mg *DomainDKIM) GetTerraformResourceType() string { - return "aws_ses_domain_dkim" -} - -// GetConnectionDetailsMapping for this DomainDKIM -func (tr *DomainDKIM) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DomainDKIM -func (tr *DomainDKIM) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DomainDKIM -func (tr *DomainDKIM) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DomainDKIM -func (tr *DomainDKIM) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DomainDKIM -func (tr *DomainDKIM) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DomainDKIM -func (tr *DomainDKIM) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DomainDKIM -func (tr *DomainDKIM) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DomainDKIM -func (tr *DomainDKIM) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DomainDKIM using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DomainDKIM) LateInitialize(attrs []byte) (bool, error) { - params := &DomainDKIMParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DomainDKIM) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DomainIdentity -func (mg *DomainIdentity) GetTerraformResourceType() string { - return "aws_ses_domain_identity" -} - -// GetConnectionDetailsMapping for this DomainIdentity -func (tr *DomainIdentity) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DomainIdentity -func (tr *DomainIdentity) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DomainIdentity -func (tr *DomainIdentity) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DomainIdentity -func (tr *DomainIdentity) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DomainIdentity -func (tr *DomainIdentity) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DomainIdentity -func (tr *DomainIdentity) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DomainIdentity -func (tr *DomainIdentity) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DomainIdentity -func (tr *DomainIdentity) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DomainIdentity using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DomainIdentity) LateInitialize(attrs []byte) (bool, error) { - params := &DomainIdentityParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DomainIdentity) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DomainMailFrom -func (mg *DomainMailFrom) GetTerraformResourceType() string { - return "aws_ses_domain_mail_from" -} - -// GetConnectionDetailsMapping for this DomainMailFrom -func (tr *DomainMailFrom) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DomainMailFrom -func (tr *DomainMailFrom) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DomainMailFrom -func (tr *DomainMailFrom) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DomainMailFrom -func (tr *DomainMailFrom) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DomainMailFrom -func (tr *DomainMailFrom) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DomainMailFrom -func (tr *DomainMailFrom) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DomainMailFrom -func (tr *DomainMailFrom) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DomainMailFrom -func (tr *DomainMailFrom) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DomainMailFrom using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DomainMailFrom) LateInitialize(attrs []byte) (bool, error) { - params := &DomainMailFromParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DomainMailFrom) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EmailIdentity -func (mg *EmailIdentity) GetTerraformResourceType() string { - return "aws_ses_email_identity" -} - -// GetConnectionDetailsMapping for this EmailIdentity -func (tr *EmailIdentity) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EmailIdentity -func (tr *EmailIdentity) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EmailIdentity -func (tr *EmailIdentity) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EmailIdentity -func (tr *EmailIdentity) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EmailIdentity -func (tr *EmailIdentity) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EmailIdentity -func (tr *EmailIdentity) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EmailIdentity -func (tr *EmailIdentity) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EmailIdentity -func (tr *EmailIdentity) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EmailIdentity using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EmailIdentity) LateInitialize(attrs []byte) (bool, error) { - params := &EmailIdentityParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EmailIdentity) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EventDestination -func (mg *EventDestination) GetTerraformResourceType() string { - return "aws_ses_event_destination" -} - -// GetConnectionDetailsMapping for this EventDestination -func (tr *EventDestination) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EventDestination -func (tr *EventDestination) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EventDestination -func (tr *EventDestination) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EventDestination -func (tr *EventDestination) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EventDestination -func (tr *EventDestination) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EventDestination -func (tr *EventDestination) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EventDestination -func (tr *EventDestination) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EventDestination -func (tr *EventDestination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EventDestination using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EventDestination) LateInitialize(attrs []byte) (bool, error) { - params := &EventDestinationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EventDestination) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this IdentityNotificationTopic -func (mg *IdentityNotificationTopic) GetTerraformResourceType() string { - return "aws_ses_identity_notification_topic" -} - -// GetConnectionDetailsMapping for this IdentityNotificationTopic -func (tr *IdentityNotificationTopic) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this IdentityNotificationTopic -func (tr *IdentityNotificationTopic) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this IdentityNotificationTopic -func (tr *IdentityNotificationTopic) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this IdentityNotificationTopic -func (tr *IdentityNotificationTopic) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this IdentityNotificationTopic -func (tr *IdentityNotificationTopic) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this IdentityNotificationTopic -func (tr *IdentityNotificationTopic) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this IdentityNotificationTopic -func (tr *IdentityNotificationTopic) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this IdentityNotificationTopic -func (tr *IdentityNotificationTopic) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this IdentityNotificationTopic using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *IdentityNotificationTopic) LateInitialize(attrs []byte) (bool, error) { - params := &IdentityNotificationTopicParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *IdentityNotificationTopic) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this IdentityPolicy -func (mg *IdentityPolicy) GetTerraformResourceType() string { - return "aws_ses_identity_policy" -} - -// GetConnectionDetailsMapping for this IdentityPolicy -func (tr *IdentityPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this IdentityPolicy -func (tr *IdentityPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this IdentityPolicy -func (tr *IdentityPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this IdentityPolicy -func (tr *IdentityPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this IdentityPolicy -func (tr *IdentityPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this IdentityPolicy -func (tr *IdentityPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this IdentityPolicy -func (tr *IdentityPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this IdentityPolicy -func (tr *IdentityPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this IdentityPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *IdentityPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &IdentityPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *IdentityPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReceiptFilter -func (mg *ReceiptFilter) GetTerraformResourceType() string { - return "aws_ses_receipt_filter" -} - -// GetConnectionDetailsMapping for this ReceiptFilter -func (tr *ReceiptFilter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ReceiptFilter -func (tr *ReceiptFilter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReceiptFilter -func (tr *ReceiptFilter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReceiptFilter -func (tr *ReceiptFilter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReceiptFilter -func (tr *ReceiptFilter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReceiptFilter -func (tr *ReceiptFilter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReceiptFilter -func (tr *ReceiptFilter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReceiptFilter -func (tr *ReceiptFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReceiptFilter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReceiptFilter) LateInitialize(attrs []byte) (bool, error) { - params := &ReceiptFilterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReceiptFilter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReceiptRule -func (mg *ReceiptRule) GetTerraformResourceType() string { - return "aws_ses_receipt_rule" -} - -// GetConnectionDetailsMapping for this ReceiptRule -func (tr *ReceiptRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ReceiptRule -func (tr *ReceiptRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReceiptRule -func (tr *ReceiptRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReceiptRule -func (tr *ReceiptRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReceiptRule -func (tr *ReceiptRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReceiptRule -func (tr *ReceiptRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReceiptRule -func (tr *ReceiptRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReceiptRule -func (tr *ReceiptRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReceiptRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReceiptRule) LateInitialize(attrs []byte) (bool, error) { - params := &ReceiptRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReceiptRule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ReceiptRuleSet -func (mg *ReceiptRuleSet) GetTerraformResourceType() string { - return "aws_ses_receipt_rule_set" -} - -// GetConnectionDetailsMapping for this ReceiptRuleSet -func (tr *ReceiptRuleSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ReceiptRuleSet -func (tr *ReceiptRuleSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ReceiptRuleSet -func (tr *ReceiptRuleSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ReceiptRuleSet -func (tr *ReceiptRuleSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ReceiptRuleSet -func (tr *ReceiptRuleSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ReceiptRuleSet -func (tr *ReceiptRuleSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ReceiptRuleSet -func (tr *ReceiptRuleSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ReceiptRuleSet -func (tr *ReceiptRuleSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ReceiptRuleSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ReceiptRuleSet) LateInitialize(attrs []byte) (bool, error) { - params := &ReceiptRuleSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ReceiptRuleSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Template -func (mg *Template) GetTerraformResourceType() string { - return "aws_ses_template" -} - -// GetConnectionDetailsMapping for this Template -func (tr *Template) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Template -func (tr *Template) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Template -func (tr *Template) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Template -func (tr *Template) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Template -func (tr *Template) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Template -func (tr *Template) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Template -func (tr *Template) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Template -func (tr *Template) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Template using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Template) LateInitialize(attrs []byte) (bool, error) { - params := &TemplateParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Template) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/ses/v1beta1/zz_identitynotificationtopic_terraformed.go b/apis/ses/v1beta1/zz_identitynotificationtopic_terraformed.go new file mode 100755 index 0000000000..cb5788099d --- /dev/null +++ b/apis/ses/v1beta1/zz_identitynotificationtopic_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this IdentityNotificationTopic +func (mg *IdentityNotificationTopic) GetTerraformResourceType() string { + return "aws_ses_identity_notification_topic" +} + +// GetConnectionDetailsMapping for this IdentityNotificationTopic +func (tr *IdentityNotificationTopic) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this IdentityNotificationTopic +func (tr *IdentityNotificationTopic) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this IdentityNotificationTopic +func (tr *IdentityNotificationTopic) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this IdentityNotificationTopic +func (tr *IdentityNotificationTopic) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this IdentityNotificationTopic +func (tr *IdentityNotificationTopic) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this IdentityNotificationTopic +func (tr *IdentityNotificationTopic) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this IdentityNotificationTopic +func (tr *IdentityNotificationTopic) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this IdentityNotificationTopic +func (tr *IdentityNotificationTopic) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this IdentityNotificationTopic using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *IdentityNotificationTopic) LateInitialize(attrs []byte) (bool, error) { + params := &IdentityNotificationTopicParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *IdentityNotificationTopic) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_identitynotificationtopic_types.go b/apis/ses/v1beta1/zz_identitynotificationtopic_types.go index 19839d6679..4847ce3b93 100755 --- a/apis/ses/v1beta1/zz_identitynotificationtopic_types.go +++ b/apis/ses/v1beta1/zz_identitynotificationtopic_types.go @@ -134,13 +134,14 @@ type IdentityNotificationTopicStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IdentityNotificationTopic is the Schema for the IdentityNotificationTopics API. Setting AWS SES Identity Notification Topic // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type IdentityNotificationTopic struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_identitypolicy_terraformed.go b/apis/ses/v1beta1/zz_identitypolicy_terraformed.go new file mode 100755 index 0000000000..27b04d8268 --- /dev/null +++ b/apis/ses/v1beta1/zz_identitypolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this IdentityPolicy +func (mg *IdentityPolicy) GetTerraformResourceType() string { + return "aws_ses_identity_policy" +} + +// GetConnectionDetailsMapping for this IdentityPolicy +func (tr *IdentityPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this IdentityPolicy +func (tr *IdentityPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this IdentityPolicy +func (tr *IdentityPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this IdentityPolicy +func (tr *IdentityPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this IdentityPolicy +func (tr *IdentityPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this IdentityPolicy +func (tr *IdentityPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this IdentityPolicy +func (tr *IdentityPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this IdentityPolicy +func (tr *IdentityPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this IdentityPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *IdentityPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &IdentityPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *IdentityPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_identitypolicy_types.go b/apis/ses/v1beta1/zz_identitypolicy_types.go index f48cb2d0d8..b0ad559e98 100755 --- a/apis/ses/v1beta1/zz_identitypolicy_types.go +++ b/apis/ses/v1beta1/zz_identitypolicy_types.go @@ -106,13 +106,14 @@ type IdentityPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IdentityPolicy is the Schema for the IdentityPolicys API. Manages a SES Identity Policy // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type IdentityPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_receiptfilter_terraformed.go b/apis/ses/v1beta1/zz_receiptfilter_terraformed.go new file mode 100755 index 0000000000..273e356cb1 --- /dev/null +++ b/apis/ses/v1beta1/zz_receiptfilter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReceiptFilter +func (mg *ReceiptFilter) GetTerraformResourceType() string { + return "aws_ses_receipt_filter" +} + +// GetConnectionDetailsMapping for this ReceiptFilter +func (tr *ReceiptFilter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReceiptFilter +func (tr *ReceiptFilter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReceiptFilter +func (tr *ReceiptFilter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReceiptFilter +func (tr *ReceiptFilter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReceiptFilter +func (tr *ReceiptFilter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReceiptFilter +func (tr *ReceiptFilter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReceiptFilter +func (tr *ReceiptFilter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReceiptFilter +func (tr *ReceiptFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReceiptFilter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReceiptFilter) LateInitialize(attrs []byte) (bool, error) { + params := &ReceiptFilterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReceiptFilter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_receiptfilter_types.go b/apis/ses/v1beta1/zz_receiptfilter_types.go index 6e5a6e8ff2..d68eb3af9a 100755 --- a/apis/ses/v1beta1/zz_receiptfilter_types.go +++ b/apis/ses/v1beta1/zz_receiptfilter_types.go @@ -81,13 +81,14 @@ type ReceiptFilterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReceiptFilter is the Schema for the ReceiptFilters API. Provides an SES receipt filter // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReceiptFilter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_receiptrule_terraformed.go b/apis/ses/v1beta1/zz_receiptrule_terraformed.go new file mode 100755 index 0000000000..d5d715a57d --- /dev/null +++ b/apis/ses/v1beta1/zz_receiptrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReceiptRule +func (mg *ReceiptRule) GetTerraformResourceType() string { + return "aws_ses_receipt_rule" +} + +// GetConnectionDetailsMapping for this ReceiptRule +func (tr *ReceiptRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReceiptRule +func (tr *ReceiptRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReceiptRule +func (tr *ReceiptRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReceiptRule +func (tr *ReceiptRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReceiptRule +func (tr *ReceiptRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReceiptRule +func (tr *ReceiptRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReceiptRule +func (tr *ReceiptRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReceiptRule +func (tr *ReceiptRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReceiptRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReceiptRule) LateInitialize(attrs []byte) (bool, error) { + params := &ReceiptRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReceiptRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_receiptrule_types.go b/apis/ses/v1beta1/zz_receiptrule_types.go index 0581c55df0..f69e2d7d04 100755 --- a/apis/ses/v1beta1/zz_receiptrule_types.go +++ b/apis/ses/v1beta1/zz_receiptrule_types.go @@ -537,13 +537,14 @@ type ReceiptRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReceiptRule is the Schema for the ReceiptRules API. Provides an SES receipt rule resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReceiptRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_receiptruleset_terraformed.go b/apis/ses/v1beta1/zz_receiptruleset_terraformed.go new file mode 100755 index 0000000000..4ed853ddca --- /dev/null +++ b/apis/ses/v1beta1/zz_receiptruleset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ReceiptRuleSet +func (mg *ReceiptRuleSet) GetTerraformResourceType() string { + return "aws_ses_receipt_rule_set" +} + +// GetConnectionDetailsMapping for this ReceiptRuleSet +func (tr *ReceiptRuleSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReceiptRuleSet +func (tr *ReceiptRuleSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ReceiptRuleSet +func (tr *ReceiptRuleSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ReceiptRuleSet +func (tr *ReceiptRuleSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReceiptRuleSet +func (tr *ReceiptRuleSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ReceiptRuleSet +func (tr *ReceiptRuleSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ReceiptRuleSet +func (tr *ReceiptRuleSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ReceiptRuleSet +func (tr *ReceiptRuleSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ReceiptRuleSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReceiptRuleSet) LateInitialize(attrs []byte) (bool, error) { + params := &ReceiptRuleSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ReceiptRuleSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_receiptruleset_types.go b/apis/ses/v1beta1/zz_receiptruleset_types.go index f4d1f892f4..151d51e849 100755 --- a/apis/ses/v1beta1/zz_receiptruleset_types.go +++ b/apis/ses/v1beta1/zz_receiptruleset_types.go @@ -71,13 +71,14 @@ type ReceiptRuleSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ReceiptRuleSet is the Schema for the ReceiptRuleSets API. Provides an SES receipt rule set resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ReceiptRuleSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ses/v1beta1/zz_template_terraformed.go b/apis/ses/v1beta1/zz_template_terraformed.go new file mode 100755 index 0000000000..4a7e611955 --- /dev/null +++ b/apis/ses/v1beta1/zz_template_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Template +func (mg *Template) GetTerraformResourceType() string { + return "aws_ses_template" +} + +// GetConnectionDetailsMapping for this Template +func (tr *Template) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Template +func (tr *Template) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Template +func (tr *Template) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Template +func (tr *Template) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Template +func (tr *Template) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Template +func (tr *Template) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Template +func (tr *Template) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Template +func (tr *Template) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Template using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Template) LateInitialize(attrs []byte) (bool, error) { + params := &TemplateParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Template) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ses/v1beta1/zz_template_types.go b/apis/ses/v1beta1/zz_template_types.go index d0f23a4a65..45cea2247e 100755 --- a/apis/ses/v1beta1/zz_template_types.go +++ b/apis/ses/v1beta1/zz_template_types.go @@ -91,13 +91,14 @@ type TemplateStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Template is the Schema for the Templates API. Provides a resource to create a SES template // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Template struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sesv2/v1beta1/zz_configurationset_terraformed.go b/apis/sesv2/v1beta1/zz_configurationset_terraformed.go new file mode 100755 index 0000000000..fa9cee9743 --- /dev/null +++ b/apis/sesv2/v1beta1/zz_configurationset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConfigurationSet +func (mg *ConfigurationSet) GetTerraformResourceType() string { + return "aws_sesv2_configuration_set" +} + +// GetConnectionDetailsMapping for this ConfigurationSet +func (tr *ConfigurationSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ConfigurationSet +func (tr *ConfigurationSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConfigurationSet +func (tr *ConfigurationSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConfigurationSet +func (tr *ConfigurationSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConfigurationSet +func (tr *ConfigurationSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConfigurationSet +func (tr *ConfigurationSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConfigurationSet +func (tr *ConfigurationSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConfigurationSet +func (tr *ConfigurationSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConfigurationSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConfigurationSet) LateInitialize(attrs []byte) (bool, error) { + params := &ConfigurationSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConfigurationSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sesv2/v1beta1/zz_configurationset_types.go b/apis/sesv2/v1beta1/zz_configurationset_types.go index 98c0d88825..1553a20a11 100755 --- a/apis/sesv2/v1beta1/zz_configurationset_types.go +++ b/apis/sesv2/v1beta1/zz_configurationset_types.go @@ -311,13 +311,14 @@ type ConfigurationSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConfigurationSet is the Schema for the ConfigurationSets API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConfigurationSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sesv2/v1beta1/zz_configurationseteventdestination_terraformed.go b/apis/sesv2/v1beta1/zz_configurationseteventdestination_terraformed.go new file mode 100755 index 0000000000..832bce9413 --- /dev/null +++ b/apis/sesv2/v1beta1/zz_configurationseteventdestination_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ConfigurationSetEventDestination +func (mg *ConfigurationSetEventDestination) GetTerraformResourceType() string { + return "aws_sesv2_configuration_set_event_destination" +} + +// GetConnectionDetailsMapping for this ConfigurationSetEventDestination +func (tr *ConfigurationSetEventDestination) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ConfigurationSetEventDestination +func (tr *ConfigurationSetEventDestination) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ConfigurationSetEventDestination +func (tr *ConfigurationSetEventDestination) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ConfigurationSetEventDestination +func (tr *ConfigurationSetEventDestination) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ConfigurationSetEventDestination +func (tr *ConfigurationSetEventDestination) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ConfigurationSetEventDestination +func (tr *ConfigurationSetEventDestination) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ConfigurationSetEventDestination +func (tr *ConfigurationSetEventDestination) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ConfigurationSetEventDestination +func (tr *ConfigurationSetEventDestination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ConfigurationSetEventDestination using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ConfigurationSetEventDestination) LateInitialize(attrs []byte) (bool, error) { + params := &ConfigurationSetEventDestinationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ConfigurationSetEventDestination) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sesv2/v1beta1/zz_configurationseteventdestination_types.go b/apis/sesv2/v1beta1/zz_configurationseteventdestination_types.go index 262d9b6362..6e4a01cbe8 100755 --- a/apis/sesv2/v1beta1/zz_configurationseteventdestination_types.go +++ b/apis/sesv2/v1beta1/zz_configurationseteventdestination_types.go @@ -376,13 +376,14 @@ type ConfigurationSetEventDestinationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ConfigurationSetEventDestination is the Schema for the ConfigurationSetEventDestinations API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ConfigurationSetEventDestination struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sesv2/v1beta1/zz_dedicatedippool_terraformed.go b/apis/sesv2/v1beta1/zz_dedicatedippool_terraformed.go new file mode 100755 index 0000000000..accf9387a3 --- /dev/null +++ b/apis/sesv2/v1beta1/zz_dedicatedippool_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DedicatedIPPool +func (mg *DedicatedIPPool) GetTerraformResourceType() string { + return "aws_sesv2_dedicated_ip_pool" +} + +// GetConnectionDetailsMapping for this DedicatedIPPool +func (tr *DedicatedIPPool) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DedicatedIPPool +func (tr *DedicatedIPPool) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DedicatedIPPool +func (tr *DedicatedIPPool) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DedicatedIPPool +func (tr *DedicatedIPPool) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DedicatedIPPool +func (tr *DedicatedIPPool) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DedicatedIPPool +func (tr *DedicatedIPPool) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DedicatedIPPool +func (tr *DedicatedIPPool) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DedicatedIPPool +func (tr *DedicatedIPPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DedicatedIPPool using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DedicatedIPPool) LateInitialize(attrs []byte) (bool, error) { + params := &DedicatedIPPoolParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DedicatedIPPool) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sesv2/v1beta1/zz_dedicatedippool_types.go b/apis/sesv2/v1beta1/zz_dedicatedippool_types.go index 9e898dce50..73bb3ce067 100755 --- a/apis/sesv2/v1beta1/zz_dedicatedippool_types.go +++ b/apis/sesv2/v1beta1/zz_dedicatedippool_types.go @@ -86,13 +86,14 @@ type DedicatedIPPoolStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DedicatedIPPool is the Schema for the DedicatedIPPools API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DedicatedIPPool struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sesv2/v1beta1/zz_emailidentity_terraformed.go b/apis/sesv2/v1beta1/zz_emailidentity_terraformed.go new file mode 100755 index 0000000000..dfb1d8e75a --- /dev/null +++ b/apis/sesv2/v1beta1/zz_emailidentity_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EmailIdentity +func (mg *EmailIdentity) GetTerraformResourceType() string { + return "aws_sesv2_email_identity" +} + +// GetConnectionDetailsMapping for this EmailIdentity +func (tr *EmailIdentity) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EmailIdentity +func (tr *EmailIdentity) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EmailIdentity +func (tr *EmailIdentity) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EmailIdentity +func (tr *EmailIdentity) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EmailIdentity +func (tr *EmailIdentity) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EmailIdentity +func (tr *EmailIdentity) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EmailIdentity +func (tr *EmailIdentity) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EmailIdentity +func (tr *EmailIdentity) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EmailIdentity using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EmailIdentity) LateInitialize(attrs []byte) (bool, error) { + params := &EmailIdentityParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EmailIdentity) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sesv2/v1beta1/zz_emailidentity_types.go b/apis/sesv2/v1beta1/zz_emailidentity_types.go index d77b16bb8a..a349773cea 100755 --- a/apis/sesv2/v1beta1/zz_emailidentity_types.go +++ b/apis/sesv2/v1beta1/zz_emailidentity_types.go @@ -174,13 +174,14 @@ type EmailIdentityStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EmailIdentity is the Schema for the EmailIdentitys API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EmailIdentity struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sesv2/v1beta1/zz_emailidentityfeedbackattributes_terraformed.go b/apis/sesv2/v1beta1/zz_emailidentityfeedbackattributes_terraformed.go new file mode 100755 index 0000000000..36eb62d189 --- /dev/null +++ b/apis/sesv2/v1beta1/zz_emailidentityfeedbackattributes_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EmailIdentityFeedbackAttributes +func (mg *EmailIdentityFeedbackAttributes) GetTerraformResourceType() string { + return "aws_sesv2_email_identity_feedback_attributes" +} + +// GetConnectionDetailsMapping for this EmailIdentityFeedbackAttributes +func (tr *EmailIdentityFeedbackAttributes) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EmailIdentityFeedbackAttributes +func (tr *EmailIdentityFeedbackAttributes) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EmailIdentityFeedbackAttributes +func (tr *EmailIdentityFeedbackAttributes) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EmailIdentityFeedbackAttributes +func (tr *EmailIdentityFeedbackAttributes) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EmailIdentityFeedbackAttributes +func (tr *EmailIdentityFeedbackAttributes) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EmailIdentityFeedbackAttributes +func (tr *EmailIdentityFeedbackAttributes) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EmailIdentityFeedbackAttributes +func (tr *EmailIdentityFeedbackAttributes) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EmailIdentityFeedbackAttributes +func (tr *EmailIdentityFeedbackAttributes) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EmailIdentityFeedbackAttributes using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EmailIdentityFeedbackAttributes) LateInitialize(attrs []byte) (bool, error) { + params := &EmailIdentityFeedbackAttributesParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EmailIdentityFeedbackAttributes) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sesv2/v1beta1/zz_emailidentityfeedbackattributes_types.go b/apis/sesv2/v1beta1/zz_emailidentityfeedbackattributes_types.go index 6e0b18f922..bbee58ec59 100755 --- a/apis/sesv2/v1beta1/zz_emailidentityfeedbackattributes_types.go +++ b/apis/sesv2/v1beta1/zz_emailidentityfeedbackattributes_types.go @@ -67,13 +67,14 @@ type EmailIdentityFeedbackAttributesStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EmailIdentityFeedbackAttributes is the Schema for the EmailIdentityFeedbackAttributess API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EmailIdentityFeedbackAttributes struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sesv2/v1beta1/zz_emailidentitymailfromattributes_terraformed.go b/apis/sesv2/v1beta1/zz_emailidentitymailfromattributes_terraformed.go new file mode 100755 index 0000000000..1c0448b0ab --- /dev/null +++ b/apis/sesv2/v1beta1/zz_emailidentitymailfromattributes_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EmailIdentityMailFromAttributes +func (mg *EmailIdentityMailFromAttributes) GetTerraformResourceType() string { + return "aws_sesv2_email_identity_mail_from_attributes" +} + +// GetConnectionDetailsMapping for this EmailIdentityMailFromAttributes +func (tr *EmailIdentityMailFromAttributes) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EmailIdentityMailFromAttributes +func (tr *EmailIdentityMailFromAttributes) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EmailIdentityMailFromAttributes +func (tr *EmailIdentityMailFromAttributes) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EmailIdentityMailFromAttributes +func (tr *EmailIdentityMailFromAttributes) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EmailIdentityMailFromAttributes +func (tr *EmailIdentityMailFromAttributes) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EmailIdentityMailFromAttributes +func (tr *EmailIdentityMailFromAttributes) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EmailIdentityMailFromAttributes +func (tr *EmailIdentityMailFromAttributes) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EmailIdentityMailFromAttributes +func (tr *EmailIdentityMailFromAttributes) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EmailIdentityMailFromAttributes using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EmailIdentityMailFromAttributes) LateInitialize(attrs []byte) (bool, error) { + params := &EmailIdentityMailFromAttributesParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EmailIdentityMailFromAttributes) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sesv2/v1beta1/zz_emailidentitymailfromattributes_types.go b/apis/sesv2/v1beta1/zz_emailidentitymailfromattributes_types.go index e3ecb52fc6..85f03e9a32 100755 --- a/apis/sesv2/v1beta1/zz_emailidentitymailfromattributes_types.go +++ b/apis/sesv2/v1beta1/zz_emailidentitymailfromattributes_types.go @@ -77,13 +77,14 @@ type EmailIdentityMailFromAttributesStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EmailIdentityMailFromAttributes is the Schema for the EmailIdentityMailFromAttributess API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EmailIdentityMailFromAttributes struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sesv2/v1beta1/zz_generated.conversion_hubs.go b/apis/sesv2/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..67c4907940 --- /dev/null +++ b/apis/sesv2/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ConfigurationSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ConfigurationSetEventDestination) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DedicatedIPPool) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EmailIdentity) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EmailIdentityFeedbackAttributes) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *EmailIdentityMailFromAttributes) Hub() {} diff --git a/apis/sesv2/v1beta1/zz_generated_terraformed.go b/apis/sesv2/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 6378e4fa78..0000000000 --- a/apis/sesv2/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,703 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this ConfigurationSet -func (mg *ConfigurationSet) GetTerraformResourceType() string { - return "aws_sesv2_configuration_set" -} - -// GetConnectionDetailsMapping for this ConfigurationSet -func (tr *ConfigurationSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ConfigurationSet -func (tr *ConfigurationSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConfigurationSet -func (tr *ConfigurationSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConfigurationSet -func (tr *ConfigurationSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConfigurationSet -func (tr *ConfigurationSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConfigurationSet -func (tr *ConfigurationSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConfigurationSet -func (tr *ConfigurationSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConfigurationSet -func (tr *ConfigurationSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConfigurationSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConfigurationSet) LateInitialize(attrs []byte) (bool, error) { - params := &ConfigurationSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConfigurationSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ConfigurationSetEventDestination -func (mg *ConfigurationSetEventDestination) GetTerraformResourceType() string { - return "aws_sesv2_configuration_set_event_destination" -} - -// GetConnectionDetailsMapping for this ConfigurationSetEventDestination -func (tr *ConfigurationSetEventDestination) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ConfigurationSetEventDestination -func (tr *ConfigurationSetEventDestination) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ConfigurationSetEventDestination -func (tr *ConfigurationSetEventDestination) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ConfigurationSetEventDestination -func (tr *ConfigurationSetEventDestination) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ConfigurationSetEventDestination -func (tr *ConfigurationSetEventDestination) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ConfigurationSetEventDestination -func (tr *ConfigurationSetEventDestination) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ConfigurationSetEventDestination -func (tr *ConfigurationSetEventDestination) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ConfigurationSetEventDestination -func (tr *ConfigurationSetEventDestination) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ConfigurationSetEventDestination using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ConfigurationSetEventDestination) LateInitialize(attrs []byte) (bool, error) { - params := &ConfigurationSetEventDestinationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ConfigurationSetEventDestination) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this DedicatedIPPool -func (mg *DedicatedIPPool) GetTerraformResourceType() string { - return "aws_sesv2_dedicated_ip_pool" -} - -// GetConnectionDetailsMapping for this DedicatedIPPool -func (tr *DedicatedIPPool) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DedicatedIPPool -func (tr *DedicatedIPPool) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DedicatedIPPool -func (tr *DedicatedIPPool) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DedicatedIPPool -func (tr *DedicatedIPPool) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DedicatedIPPool -func (tr *DedicatedIPPool) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DedicatedIPPool -func (tr *DedicatedIPPool) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DedicatedIPPool -func (tr *DedicatedIPPool) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DedicatedIPPool -func (tr *DedicatedIPPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DedicatedIPPool using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DedicatedIPPool) LateInitialize(attrs []byte) (bool, error) { - params := &DedicatedIPPoolParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DedicatedIPPool) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EmailIdentity -func (mg *EmailIdentity) GetTerraformResourceType() string { - return "aws_sesv2_email_identity" -} - -// GetConnectionDetailsMapping for this EmailIdentity -func (tr *EmailIdentity) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EmailIdentity -func (tr *EmailIdentity) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EmailIdentity -func (tr *EmailIdentity) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EmailIdentity -func (tr *EmailIdentity) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EmailIdentity -func (tr *EmailIdentity) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EmailIdentity -func (tr *EmailIdentity) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EmailIdentity -func (tr *EmailIdentity) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EmailIdentity -func (tr *EmailIdentity) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EmailIdentity using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EmailIdentity) LateInitialize(attrs []byte) (bool, error) { - params := &EmailIdentityParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EmailIdentity) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EmailIdentityFeedbackAttributes -func (mg *EmailIdentityFeedbackAttributes) GetTerraformResourceType() string { - return "aws_sesv2_email_identity_feedback_attributes" -} - -// GetConnectionDetailsMapping for this EmailIdentityFeedbackAttributes -func (tr *EmailIdentityFeedbackAttributes) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EmailIdentityFeedbackAttributes -func (tr *EmailIdentityFeedbackAttributes) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EmailIdentityFeedbackAttributes -func (tr *EmailIdentityFeedbackAttributes) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EmailIdentityFeedbackAttributes -func (tr *EmailIdentityFeedbackAttributes) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EmailIdentityFeedbackAttributes -func (tr *EmailIdentityFeedbackAttributes) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EmailIdentityFeedbackAttributes -func (tr *EmailIdentityFeedbackAttributes) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EmailIdentityFeedbackAttributes -func (tr *EmailIdentityFeedbackAttributes) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EmailIdentityFeedbackAttributes -func (tr *EmailIdentityFeedbackAttributes) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EmailIdentityFeedbackAttributes using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EmailIdentityFeedbackAttributes) LateInitialize(attrs []byte) (bool, error) { - params := &EmailIdentityFeedbackAttributesParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EmailIdentityFeedbackAttributes) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this EmailIdentityMailFromAttributes -func (mg *EmailIdentityMailFromAttributes) GetTerraformResourceType() string { - return "aws_sesv2_email_identity_mail_from_attributes" -} - -// GetConnectionDetailsMapping for this EmailIdentityMailFromAttributes -func (tr *EmailIdentityMailFromAttributes) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EmailIdentityMailFromAttributes -func (tr *EmailIdentityMailFromAttributes) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EmailIdentityMailFromAttributes -func (tr *EmailIdentityMailFromAttributes) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EmailIdentityMailFromAttributes -func (tr *EmailIdentityMailFromAttributes) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EmailIdentityMailFromAttributes -func (tr *EmailIdentityMailFromAttributes) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EmailIdentityMailFromAttributes -func (tr *EmailIdentityMailFromAttributes) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EmailIdentityMailFromAttributes -func (tr *EmailIdentityMailFromAttributes) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EmailIdentityMailFromAttributes -func (tr *EmailIdentityMailFromAttributes) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EmailIdentityMailFromAttributes using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EmailIdentityMailFromAttributes) LateInitialize(attrs []byte) (bool, error) { - params := &EmailIdentityMailFromAttributesParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EmailIdentityMailFromAttributes) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/sfn/v1beta1/zz_activity_terraformed.go b/apis/sfn/v1beta1/zz_activity_terraformed.go new file mode 100755 index 0000000000..d2a57fa8ef --- /dev/null +++ b/apis/sfn/v1beta1/zz_activity_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Activity +func (mg *Activity) GetTerraformResourceType() string { + return "aws_sfn_activity" +} + +// GetConnectionDetailsMapping for this Activity +func (tr *Activity) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Activity +func (tr *Activity) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Activity +func (tr *Activity) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Activity +func (tr *Activity) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Activity +func (tr *Activity) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Activity +func (tr *Activity) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Activity +func (tr *Activity) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Activity +func (tr *Activity) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Activity using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Activity) LateInitialize(attrs []byte) (bool, error) { + params := &ActivityParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Activity) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sfn/v1beta1/zz_activity_types.go b/apis/sfn/v1beta1/zz_activity_types.go index 8070762966..a676f62357 100755 --- a/apis/sfn/v1beta1/zz_activity_types.go +++ b/apis/sfn/v1beta1/zz_activity_types.go @@ -78,13 +78,14 @@ type ActivityStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Activity is the Schema for the Activitys API. Provides a Step Function Activity resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Activity struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sfn/v1beta1/zz_generated.conversion_hubs.go b/apis/sfn/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..317d3bd10a --- /dev/null +++ b/apis/sfn/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Activity) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *StateMachine) Hub() {} diff --git a/apis/sfn/v1beta1/zz_generated_terraformed.go b/apis/sfn/v1beta1/zz_statemachine_terraformed.go similarity index 52% rename from apis/sfn/v1beta1/zz_generated_terraformed.go rename to apis/sfn/v1beta1/zz_statemachine_terraformed.go index 41ef095dd5..4bcc8db917 100755 --- a/apis/sfn/v1beta1/zz_generated_terraformed.go +++ b/apis/sfn/v1beta1/zz_statemachine_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this Activity -func (mg *Activity) GetTerraformResourceType() string { - return "aws_sfn_activity" -} - -// GetConnectionDetailsMapping for this Activity -func (tr *Activity) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Activity -func (tr *Activity) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Activity -func (tr *Activity) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Activity -func (tr *Activity) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Activity -func (tr *Activity) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Activity -func (tr *Activity) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Activity -func (tr *Activity) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Activity -func (tr *Activity) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Activity using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Activity) LateInitialize(attrs []byte) (bool, error) { - params := &ActivityParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Activity) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this StateMachine func (mg *StateMachine) GetTerraformResourceType() string { return "aws_sfn_state_machine" diff --git a/apis/sfn/v1beta1/zz_statemachine_types.go b/apis/sfn/v1beta1/zz_statemachine_types.go index eb5d2036be..48f3e4f088 100755 --- a/apis/sfn/v1beta1/zz_statemachine_types.go +++ b/apis/sfn/v1beta1/zz_statemachine_types.go @@ -212,13 +212,14 @@ type StateMachineStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // StateMachine is the Schema for the StateMachines API. Provides a Step Function State Machine resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type StateMachine struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/signer/v1beta1/zz_generated.conversion_hubs.go b/apis/signer/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..e6e4112bfd --- /dev/null +++ b/apis/signer/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *SigningJob) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SigningProfile) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SigningProfilePermission) Hub() {} diff --git a/apis/signer/v1beta1/zz_generated_terraformed.go b/apis/signer/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 13c98b60ff..0000000000 --- a/apis/signer/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this SigningJob -func (mg *SigningJob) GetTerraformResourceType() string { - return "aws_signer_signing_job" -} - -// GetConnectionDetailsMapping for this SigningJob -func (tr *SigningJob) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SigningJob -func (tr *SigningJob) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SigningJob -func (tr *SigningJob) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SigningJob -func (tr *SigningJob) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SigningJob -func (tr *SigningJob) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SigningJob -func (tr *SigningJob) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SigningJob -func (tr *SigningJob) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SigningJob -func (tr *SigningJob) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SigningJob using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SigningJob) LateInitialize(attrs []byte) (bool, error) { - params := &SigningJobParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SigningJob) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SigningProfile -func (mg *SigningProfile) GetTerraformResourceType() string { - return "aws_signer_signing_profile" -} - -// GetConnectionDetailsMapping for this SigningProfile -func (tr *SigningProfile) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SigningProfile -func (tr *SigningProfile) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SigningProfile -func (tr *SigningProfile) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SigningProfile -func (tr *SigningProfile) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SigningProfile -func (tr *SigningProfile) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SigningProfile -func (tr *SigningProfile) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SigningProfile -func (tr *SigningProfile) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SigningProfile -func (tr *SigningProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SigningProfile using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SigningProfile) LateInitialize(attrs []byte) (bool, error) { - params := &SigningProfileParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SigningProfile) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SigningProfilePermission -func (mg *SigningProfilePermission) GetTerraformResourceType() string { - return "aws_signer_signing_profile_permission" -} - -// GetConnectionDetailsMapping for this SigningProfilePermission -func (tr *SigningProfilePermission) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SigningProfilePermission -func (tr *SigningProfilePermission) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SigningProfilePermission -func (tr *SigningProfilePermission) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SigningProfilePermission -func (tr *SigningProfilePermission) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SigningProfilePermission -func (tr *SigningProfilePermission) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SigningProfilePermission -func (tr *SigningProfilePermission) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SigningProfilePermission -func (tr *SigningProfilePermission) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SigningProfilePermission -func (tr *SigningProfilePermission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SigningProfilePermission using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SigningProfilePermission) LateInitialize(attrs []byte) (bool, error) { - params := &SigningProfilePermissionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SigningProfilePermission) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/signer/v1beta1/zz_signingjob_terraformed.go b/apis/signer/v1beta1/zz_signingjob_terraformed.go new file mode 100755 index 0000000000..e1178301ff --- /dev/null +++ b/apis/signer/v1beta1/zz_signingjob_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SigningJob +func (mg *SigningJob) GetTerraformResourceType() string { + return "aws_signer_signing_job" +} + +// GetConnectionDetailsMapping for this SigningJob +func (tr *SigningJob) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SigningJob +func (tr *SigningJob) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SigningJob +func (tr *SigningJob) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SigningJob +func (tr *SigningJob) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SigningJob +func (tr *SigningJob) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SigningJob +func (tr *SigningJob) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SigningJob +func (tr *SigningJob) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SigningJob +func (tr *SigningJob) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SigningJob using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SigningJob) LateInitialize(attrs []byte) (bool, error) { + params := &SigningJobParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SigningJob) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/signer/v1beta1/zz_signingjob_types.go b/apis/signer/v1beta1/zz_signingjob_types.go index 04da99d894..72c8a58040 100755 --- a/apis/signer/v1beta1/zz_signingjob_types.go +++ b/apis/signer/v1beta1/zz_signingjob_types.go @@ -304,13 +304,14 @@ type SigningJobStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SigningJob is the Schema for the SigningJobs API. Creates a Signer Signing Job. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SigningJob struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/signer/v1beta1/zz_signingprofile_terraformed.go b/apis/signer/v1beta1/zz_signingprofile_terraformed.go new file mode 100755 index 0000000000..18cfd5f602 --- /dev/null +++ b/apis/signer/v1beta1/zz_signingprofile_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SigningProfile +func (mg *SigningProfile) GetTerraformResourceType() string { + return "aws_signer_signing_profile" +} + +// GetConnectionDetailsMapping for this SigningProfile +func (tr *SigningProfile) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SigningProfile +func (tr *SigningProfile) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SigningProfile +func (tr *SigningProfile) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SigningProfile +func (tr *SigningProfile) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SigningProfile +func (tr *SigningProfile) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SigningProfile +func (tr *SigningProfile) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SigningProfile +func (tr *SigningProfile) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SigningProfile +func (tr *SigningProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SigningProfile using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SigningProfile) LateInitialize(attrs []byte) (bool, error) { + params := &SigningProfileParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SigningProfile) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/signer/v1beta1/zz_signingprofile_types.go b/apis/signer/v1beta1/zz_signingprofile_types.go index 7ffe0143cb..65d78e5570 100755 --- a/apis/signer/v1beta1/zz_signingprofile_types.go +++ b/apis/signer/v1beta1/zz_signingprofile_types.go @@ -147,13 +147,14 @@ type SigningProfileStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SigningProfile is the Schema for the SigningProfiles API. Creates a Signer Signing Profile. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SigningProfile struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/signer/v1beta1/zz_signingprofilepermission_terraformed.go b/apis/signer/v1beta1/zz_signingprofilepermission_terraformed.go new file mode 100755 index 0000000000..45d41a534a --- /dev/null +++ b/apis/signer/v1beta1/zz_signingprofilepermission_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SigningProfilePermission +func (mg *SigningProfilePermission) GetTerraformResourceType() string { + return "aws_signer_signing_profile_permission" +} + +// GetConnectionDetailsMapping for this SigningProfilePermission +func (tr *SigningProfilePermission) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SigningProfilePermission +func (tr *SigningProfilePermission) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SigningProfilePermission +func (tr *SigningProfilePermission) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SigningProfilePermission +func (tr *SigningProfilePermission) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SigningProfilePermission +func (tr *SigningProfilePermission) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SigningProfilePermission +func (tr *SigningProfilePermission) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SigningProfilePermission +func (tr *SigningProfilePermission) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SigningProfilePermission +func (tr *SigningProfilePermission) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SigningProfilePermission using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SigningProfilePermission) LateInitialize(attrs []byte) (bool, error) { + params := &SigningProfilePermissionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SigningProfilePermission) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/signer/v1beta1/zz_signingprofilepermission_types.go b/apis/signer/v1beta1/zz_signingprofilepermission_types.go index 7ed295c8b4..4d21a3ce0a 100755 --- a/apis/signer/v1beta1/zz_signingprofilepermission_types.go +++ b/apis/signer/v1beta1/zz_signingprofilepermission_types.go @@ -140,13 +140,14 @@ type SigningProfilePermissionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SigningProfilePermission is the Schema for the SigningProfilePermissions API. Creates a Signer Signing Profile Permission. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SigningProfilePermission struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/simpledb/v1beta1/zz_generated_terraformed.go b/apis/simpledb/v1beta1/zz_domain_terraformed.go similarity index 100% rename from apis/simpledb/v1beta1/zz_generated_terraformed.go rename to apis/simpledb/v1beta1/zz_domain_terraformed.go diff --git a/apis/simpledb/v1beta1/zz_domain_types.go b/apis/simpledb/v1beta1/zz_domain_types.go index ad33548bf0..49680b8153 100755 --- a/apis/simpledb/v1beta1/zz_domain_types.go +++ b/apis/simpledb/v1beta1/zz_domain_types.go @@ -58,13 +58,14 @@ type DomainStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Domain is the Schema for the Domains API. Provides a SimpleDB domain resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Domain struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/simpledb/v1beta1/zz_generated.conversion_hubs.go b/apis/simpledb/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..6f3b930024 --- /dev/null +++ b/apis/simpledb/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Domain) Hub() {} diff --git a/apis/sns/v1beta1/zz_generated.conversion_hubs.go b/apis/sns/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..4f73e92546 --- /dev/null +++ b/apis/sns/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *PlatformApplication) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SMSPreferences) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Topic) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TopicPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TopicSubscription) Hub() {} diff --git a/apis/sns/v1beta1/zz_generated_terraformed.go b/apis/sns/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 14936e6b5b..0000000000 --- a/apis/sns/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,589 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this PlatformApplication -func (mg *PlatformApplication) GetTerraformResourceType() string { - return "aws_sns_platform_application" -} - -// GetConnectionDetailsMapping for this PlatformApplication -func (tr *PlatformApplication) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"platform_credential": "spec.forProvider.platformCredentialSecretRef", "platform_principal": "spec.forProvider.platformPrincipalSecretRef"} -} - -// GetObservation of this PlatformApplication -func (tr *PlatformApplication) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PlatformApplication -func (tr *PlatformApplication) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PlatformApplication -func (tr *PlatformApplication) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PlatformApplication -func (tr *PlatformApplication) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PlatformApplication -func (tr *PlatformApplication) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PlatformApplication -func (tr *PlatformApplication) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PlatformApplication -func (tr *PlatformApplication) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PlatformApplication using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PlatformApplication) LateInitialize(attrs []byte) (bool, error) { - params := &PlatformApplicationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PlatformApplication) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SMSPreferences -func (mg *SMSPreferences) GetTerraformResourceType() string { - return "aws_sns_sms_preferences" -} - -// GetConnectionDetailsMapping for this SMSPreferences -func (tr *SMSPreferences) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SMSPreferences -func (tr *SMSPreferences) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SMSPreferences -func (tr *SMSPreferences) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SMSPreferences -func (tr *SMSPreferences) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SMSPreferences -func (tr *SMSPreferences) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SMSPreferences -func (tr *SMSPreferences) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SMSPreferences -func (tr *SMSPreferences) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SMSPreferences -func (tr *SMSPreferences) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SMSPreferences using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SMSPreferences) LateInitialize(attrs []byte) (bool, error) { - params := &SMSPreferencesParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SMSPreferences) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Topic -func (mg *Topic) GetTerraformResourceType() string { - return "aws_sns_topic" -} - -// GetConnectionDetailsMapping for this Topic -func (tr *Topic) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Topic -func (tr *Topic) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Topic -func (tr *Topic) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Topic -func (tr *Topic) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Topic -func (tr *Topic) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Topic -func (tr *Topic) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Topic -func (tr *Topic) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Topic -func (tr *Topic) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Topic using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Topic) LateInitialize(attrs []byte) (bool, error) { - params := &TopicParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Topic) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TopicPolicy -func (mg *TopicPolicy) GetTerraformResourceType() string { - return "aws_sns_topic_policy" -} - -// GetConnectionDetailsMapping for this TopicPolicy -func (tr *TopicPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TopicPolicy -func (tr *TopicPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TopicPolicy -func (tr *TopicPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TopicPolicy -func (tr *TopicPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TopicPolicy -func (tr *TopicPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TopicPolicy -func (tr *TopicPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TopicPolicy -func (tr *TopicPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TopicPolicy -func (tr *TopicPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TopicPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TopicPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &TopicPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TopicPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this TopicSubscription -func (mg *TopicSubscription) GetTerraformResourceType() string { - return "aws_sns_topic_subscription" -} - -// GetConnectionDetailsMapping for this TopicSubscription -func (tr *TopicSubscription) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this TopicSubscription -func (tr *TopicSubscription) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this TopicSubscription -func (tr *TopicSubscription) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this TopicSubscription -func (tr *TopicSubscription) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this TopicSubscription -func (tr *TopicSubscription) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this TopicSubscription -func (tr *TopicSubscription) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this TopicSubscription -func (tr *TopicSubscription) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this TopicSubscription -func (tr *TopicSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this TopicSubscription using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *TopicSubscription) LateInitialize(attrs []byte) (bool, error) { - params := &TopicSubscriptionParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *TopicSubscription) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/sns/v1beta1/zz_platformapplication_terraformed.go b/apis/sns/v1beta1/zz_platformapplication_terraformed.go new file mode 100755 index 0000000000..2a960a564f --- /dev/null +++ b/apis/sns/v1beta1/zz_platformapplication_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PlatformApplication +func (mg *PlatformApplication) GetTerraformResourceType() string { + return "aws_sns_platform_application" +} + +// GetConnectionDetailsMapping for this PlatformApplication +func (tr *PlatformApplication) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"platform_credential": "spec.forProvider.platformCredentialSecretRef", "platform_principal": "spec.forProvider.platformPrincipalSecretRef"} +} + +// GetObservation of this PlatformApplication +func (tr *PlatformApplication) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PlatformApplication +func (tr *PlatformApplication) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PlatformApplication +func (tr *PlatformApplication) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PlatformApplication +func (tr *PlatformApplication) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PlatformApplication +func (tr *PlatformApplication) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PlatformApplication +func (tr *PlatformApplication) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PlatformApplication +func (tr *PlatformApplication) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PlatformApplication using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PlatformApplication) LateInitialize(attrs []byte) (bool, error) { + params := &PlatformApplicationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PlatformApplication) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sns/v1beta1/zz_platformapplication_types.go b/apis/sns/v1beta1/zz_platformapplication_types.go index d379a570d8..223d1a85e2 100755 --- a/apis/sns/v1beta1/zz_platformapplication_types.go +++ b/apis/sns/v1beta1/zz_platformapplication_types.go @@ -209,13 +209,14 @@ type PlatformApplicationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PlatformApplication is the Schema for the PlatformApplications API. Provides an SNS platform application resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PlatformApplication struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sns/v1beta1/zz_smspreferences_terraformed.go b/apis/sns/v1beta1/zz_smspreferences_terraformed.go new file mode 100755 index 0000000000..bbf0c8440e --- /dev/null +++ b/apis/sns/v1beta1/zz_smspreferences_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SMSPreferences +func (mg *SMSPreferences) GetTerraformResourceType() string { + return "aws_sns_sms_preferences" +} + +// GetConnectionDetailsMapping for this SMSPreferences +func (tr *SMSPreferences) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SMSPreferences +func (tr *SMSPreferences) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SMSPreferences +func (tr *SMSPreferences) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SMSPreferences +func (tr *SMSPreferences) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SMSPreferences +func (tr *SMSPreferences) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SMSPreferences +func (tr *SMSPreferences) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SMSPreferences +func (tr *SMSPreferences) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SMSPreferences +func (tr *SMSPreferences) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SMSPreferences using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SMSPreferences) LateInitialize(attrs []byte) (bool, error) { + params := &SMSPreferencesParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SMSPreferences) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sns/v1beta1/zz_smspreferences_types.go b/apis/sns/v1beta1/zz_smspreferences_types.go index 7b77847aaf..cb947f3285 100755 --- a/apis/sns/v1beta1/zz_smspreferences_types.go +++ b/apis/sns/v1beta1/zz_smspreferences_types.go @@ -137,13 +137,14 @@ type SMSPreferencesStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SMSPreferences is the Schema for the SMSPreferencess API. Provides a way to set SNS SMS preferences. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SMSPreferences struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sns/v1beta1/zz_topic_terraformed.go b/apis/sns/v1beta1/zz_topic_terraformed.go new file mode 100755 index 0000000000..5c16f7026a --- /dev/null +++ b/apis/sns/v1beta1/zz_topic_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Topic +func (mg *Topic) GetTerraformResourceType() string { + return "aws_sns_topic" +} + +// GetConnectionDetailsMapping for this Topic +func (tr *Topic) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Topic +func (tr *Topic) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Topic +func (tr *Topic) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Topic +func (tr *Topic) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Topic +func (tr *Topic) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Topic +func (tr *Topic) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Topic +func (tr *Topic) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Topic +func (tr *Topic) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Topic using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Topic) LateInitialize(attrs []byte) (bool, error) { + params := &TopicParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Topic) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sns/v1beta1/zz_topic_types.go b/apis/sns/v1beta1/zz_topic_types.go index 445559f9d6..9926bf4ef7 100755 --- a/apis/sns/v1beta1/zz_topic_types.go +++ b/apis/sns/v1beta1/zz_topic_types.go @@ -511,13 +511,14 @@ type TopicStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Topic is the Schema for the Topics API. Provides an SNS topic resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Topic struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sns/v1beta1/zz_topicpolicy_terraformed.go b/apis/sns/v1beta1/zz_topicpolicy_terraformed.go new file mode 100755 index 0000000000..eb0facdcb2 --- /dev/null +++ b/apis/sns/v1beta1/zz_topicpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TopicPolicy +func (mg *TopicPolicy) GetTerraformResourceType() string { + return "aws_sns_topic_policy" +} + +// GetConnectionDetailsMapping for this TopicPolicy +func (tr *TopicPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TopicPolicy +func (tr *TopicPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TopicPolicy +func (tr *TopicPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TopicPolicy +func (tr *TopicPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TopicPolicy +func (tr *TopicPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TopicPolicy +func (tr *TopicPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TopicPolicy +func (tr *TopicPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TopicPolicy +func (tr *TopicPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TopicPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TopicPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &TopicPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TopicPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sns/v1beta1/zz_topicpolicy_types.go b/apis/sns/v1beta1/zz_topicpolicy_types.go index 0498c8478c..8a7f441ae7 100755 --- a/apis/sns/v1beta1/zz_topicpolicy_types.go +++ b/apis/sns/v1beta1/zz_topicpolicy_types.go @@ -100,13 +100,14 @@ type TopicPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TopicPolicy is the Schema for the TopicPolicys API. Provides an SNS topic policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TopicPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sns/v1beta1/zz_topicsubscription_terraformed.go b/apis/sns/v1beta1/zz_topicsubscription_terraformed.go new file mode 100755 index 0000000000..ca1dc0da1d --- /dev/null +++ b/apis/sns/v1beta1/zz_topicsubscription_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TopicSubscription +func (mg *TopicSubscription) GetTerraformResourceType() string { + return "aws_sns_topic_subscription" +} + +// GetConnectionDetailsMapping for this TopicSubscription +func (tr *TopicSubscription) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TopicSubscription +func (tr *TopicSubscription) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TopicSubscription +func (tr *TopicSubscription) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TopicSubscription +func (tr *TopicSubscription) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TopicSubscription +func (tr *TopicSubscription) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TopicSubscription +func (tr *TopicSubscription) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TopicSubscription +func (tr *TopicSubscription) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TopicSubscription +func (tr *TopicSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TopicSubscription using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TopicSubscription) LateInitialize(attrs []byte) (bool, error) { + params := &TopicSubscriptionParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TopicSubscription) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sns/v1beta1/zz_topicsubscription_types.go b/apis/sns/v1beta1/zz_topicsubscription_types.go index 1f17fe379e..5a3377e93c 100755 --- a/apis/sns/v1beta1/zz_topicsubscription_types.go +++ b/apis/sns/v1beta1/zz_topicsubscription_types.go @@ -240,13 +240,14 @@ type TopicSubscriptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // TopicSubscription is the Schema for the TopicSubscriptions API. Provides a resource for subscribing to SNS topics. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type TopicSubscription struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sqs/v1beta1/zz_generated.conversion_hubs.go b/apis/sqs/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..fdd2f17ce4 --- /dev/null +++ b/apis/sqs/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Queue) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *QueuePolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *QueueRedriveAllowPolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *QueueRedrivePolicy) Hub() {} diff --git a/apis/sqs/v1beta1/zz_generated_terraformed.go b/apis/sqs/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 88bbd2ea89..0000000000 --- a/apis/sqs/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,475 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Queue -func (mg *Queue) GetTerraformResourceType() string { - return "aws_sqs_queue" -} - -// GetConnectionDetailsMapping for this Queue -func (tr *Queue) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Queue -func (tr *Queue) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Queue -func (tr *Queue) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Queue -func (tr *Queue) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Queue -func (tr *Queue) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Queue -func (tr *Queue) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Queue -func (tr *Queue) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Queue -func (tr *Queue) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Queue using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Queue) LateInitialize(attrs []byte) (bool, error) { - params := &QueueParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Queue) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this QueuePolicy -func (mg *QueuePolicy) GetTerraformResourceType() string { - return "aws_sqs_queue_policy" -} - -// GetConnectionDetailsMapping for this QueuePolicy -func (tr *QueuePolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this QueuePolicy -func (tr *QueuePolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this QueuePolicy -func (tr *QueuePolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this QueuePolicy -func (tr *QueuePolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this QueuePolicy -func (tr *QueuePolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this QueuePolicy -func (tr *QueuePolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this QueuePolicy -func (tr *QueuePolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this QueuePolicy -func (tr *QueuePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this QueuePolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *QueuePolicy) LateInitialize(attrs []byte) (bool, error) { - params := &QueuePolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *QueuePolicy) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this QueueRedriveAllowPolicy -func (mg *QueueRedriveAllowPolicy) GetTerraformResourceType() string { - return "aws_sqs_queue_redrive_allow_policy" -} - -// GetConnectionDetailsMapping for this QueueRedriveAllowPolicy -func (tr *QueueRedriveAllowPolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this QueueRedriveAllowPolicy -func (tr *QueueRedriveAllowPolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this QueueRedriveAllowPolicy -func (tr *QueueRedriveAllowPolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this QueueRedriveAllowPolicy -func (tr *QueueRedriveAllowPolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this QueueRedriveAllowPolicy -func (tr *QueueRedriveAllowPolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this QueueRedriveAllowPolicy -func (tr *QueueRedriveAllowPolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this QueueRedriveAllowPolicy -func (tr *QueueRedriveAllowPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this QueueRedriveAllowPolicy -func (tr *QueueRedriveAllowPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this QueueRedriveAllowPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *QueueRedriveAllowPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &QueueRedriveAllowPolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *QueueRedriveAllowPolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this QueueRedrivePolicy -func (mg *QueueRedrivePolicy) GetTerraformResourceType() string { - return "aws_sqs_queue_redrive_policy" -} - -// GetConnectionDetailsMapping for this QueueRedrivePolicy -func (tr *QueueRedrivePolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this QueueRedrivePolicy -func (tr *QueueRedrivePolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this QueueRedrivePolicy -func (tr *QueueRedrivePolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this QueueRedrivePolicy -func (tr *QueueRedrivePolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this QueueRedrivePolicy -func (tr *QueueRedrivePolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this QueueRedrivePolicy -func (tr *QueueRedrivePolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this QueueRedrivePolicy -func (tr *QueueRedrivePolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this QueueRedrivePolicy -func (tr *QueueRedrivePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this QueueRedrivePolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *QueueRedrivePolicy) LateInitialize(attrs []byte) (bool, error) { - params := &QueueRedrivePolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *QueueRedrivePolicy) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/sqs/v1beta1/zz_queue_terraformed.go b/apis/sqs/v1beta1/zz_queue_terraformed.go new file mode 100755 index 0000000000..9af9e37f94 --- /dev/null +++ b/apis/sqs/v1beta1/zz_queue_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Queue +func (mg *Queue) GetTerraformResourceType() string { + return "aws_sqs_queue" +} + +// GetConnectionDetailsMapping for this Queue +func (tr *Queue) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Queue +func (tr *Queue) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Queue +func (tr *Queue) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Queue +func (tr *Queue) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Queue +func (tr *Queue) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Queue +func (tr *Queue) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Queue +func (tr *Queue) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Queue +func (tr *Queue) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Queue using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Queue) LateInitialize(attrs []byte) (bool, error) { + params := &QueueParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Queue) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sqs/v1beta1/zz_queue_types.go b/apis/sqs/v1beta1/zz_queue_types.go index 0886d33edf..620cd34327 100755 --- a/apis/sqs/v1beta1/zz_queue_types.go +++ b/apis/sqs/v1beta1/zz_queue_types.go @@ -241,13 +241,14 @@ type QueueStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Queue is the Schema for the Queues API. Provides a SQS resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Queue struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sqs/v1beta1/zz_queuepolicy_terraformed.go b/apis/sqs/v1beta1/zz_queuepolicy_terraformed.go new file mode 100755 index 0000000000..33efe8ce14 --- /dev/null +++ b/apis/sqs/v1beta1/zz_queuepolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this QueuePolicy +func (mg *QueuePolicy) GetTerraformResourceType() string { + return "aws_sqs_queue_policy" +} + +// GetConnectionDetailsMapping for this QueuePolicy +func (tr *QueuePolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this QueuePolicy +func (tr *QueuePolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this QueuePolicy +func (tr *QueuePolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this QueuePolicy +func (tr *QueuePolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this QueuePolicy +func (tr *QueuePolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this QueuePolicy +func (tr *QueuePolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this QueuePolicy +func (tr *QueuePolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this QueuePolicy +func (tr *QueuePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this QueuePolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *QueuePolicy) LateInitialize(attrs []byte) (bool, error) { + params := &QueuePolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *QueuePolicy) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/sqs/v1beta1/zz_queuepolicy_types.go b/apis/sqs/v1beta1/zz_queuepolicy_types.go index 206bf9e18c..f81bc80d71 100755 --- a/apis/sqs/v1beta1/zz_queuepolicy_types.go +++ b/apis/sqs/v1beta1/zz_queuepolicy_types.go @@ -96,13 +96,14 @@ type QueuePolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // QueuePolicy is the Schema for the QueuePolicys API. Provides a SQS Queue Policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type QueuePolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sqs/v1beta1/zz_queueredriveallowpolicy_terraformed.go b/apis/sqs/v1beta1/zz_queueredriveallowpolicy_terraformed.go new file mode 100755 index 0000000000..897725eeac --- /dev/null +++ b/apis/sqs/v1beta1/zz_queueredriveallowpolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this QueueRedriveAllowPolicy +func (mg *QueueRedriveAllowPolicy) GetTerraformResourceType() string { + return "aws_sqs_queue_redrive_allow_policy" +} + +// GetConnectionDetailsMapping for this QueueRedriveAllowPolicy +func (tr *QueueRedriveAllowPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this QueueRedriveAllowPolicy +func (tr *QueueRedriveAllowPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this QueueRedriveAllowPolicy +func (tr *QueueRedriveAllowPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this QueueRedriveAllowPolicy +func (tr *QueueRedriveAllowPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this QueueRedriveAllowPolicy +func (tr *QueueRedriveAllowPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this QueueRedriveAllowPolicy +func (tr *QueueRedriveAllowPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this QueueRedriveAllowPolicy +func (tr *QueueRedriveAllowPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this QueueRedriveAllowPolicy +func (tr *QueueRedriveAllowPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this QueueRedriveAllowPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *QueueRedriveAllowPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &QueueRedriveAllowPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *QueueRedriveAllowPolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sqs/v1beta1/zz_queueredriveallowpolicy_types.go b/apis/sqs/v1beta1/zz_queueredriveallowpolicy_types.go index 8e4fe39ef6..97a0d32f76 100755 --- a/apis/sqs/v1beta1/zz_queueredriveallowpolicy_types.go +++ b/apis/sqs/v1beta1/zz_queueredriveallowpolicy_types.go @@ -96,13 +96,14 @@ type QueueRedriveAllowPolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // QueueRedriveAllowPolicy is the Schema for the QueueRedriveAllowPolicys API. Provides a SQS Queue Redrive Allow Policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type QueueRedriveAllowPolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/sqs/v1beta1/zz_queueredrivepolicy_terraformed.go b/apis/sqs/v1beta1/zz_queueredrivepolicy_terraformed.go new file mode 100755 index 0000000000..7cc2705ffc --- /dev/null +++ b/apis/sqs/v1beta1/zz_queueredrivepolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this QueueRedrivePolicy +func (mg *QueueRedrivePolicy) GetTerraformResourceType() string { + return "aws_sqs_queue_redrive_policy" +} + +// GetConnectionDetailsMapping for this QueueRedrivePolicy +func (tr *QueueRedrivePolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this QueueRedrivePolicy +func (tr *QueueRedrivePolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this QueueRedrivePolicy +func (tr *QueueRedrivePolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this QueueRedrivePolicy +func (tr *QueueRedrivePolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this QueueRedrivePolicy +func (tr *QueueRedrivePolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this QueueRedrivePolicy +func (tr *QueueRedrivePolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this QueueRedrivePolicy +func (tr *QueueRedrivePolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this QueueRedrivePolicy +func (tr *QueueRedrivePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this QueueRedrivePolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *QueueRedrivePolicy) LateInitialize(attrs []byte) (bool, error) { + params := &QueueRedrivePolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *QueueRedrivePolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/sqs/v1beta1/zz_queueredrivepolicy_types.go b/apis/sqs/v1beta1/zz_queueredrivepolicy_types.go index 6b01420f56..09252e5c58 100755 --- a/apis/sqs/v1beta1/zz_queueredrivepolicy_types.go +++ b/apis/sqs/v1beta1/zz_queueredrivepolicy_types.go @@ -96,13 +96,14 @@ type QueueRedrivePolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // QueueRedrivePolicy is the Schema for the QueueRedrivePolicys API. Provides a SQS Queue Redrive Policy resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type QueueRedrivePolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_activation_terraformed.go b/apis/ssm/v1beta1/zz_activation_terraformed.go new file mode 100755 index 0000000000..53f3a4f852 --- /dev/null +++ b/apis/ssm/v1beta1/zz_activation_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Activation +func (mg *Activation) GetTerraformResourceType() string { + return "aws_ssm_activation" +} + +// GetConnectionDetailsMapping for this Activation +func (tr *Activation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Activation +func (tr *Activation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Activation +func (tr *Activation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Activation +func (tr *Activation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Activation +func (tr *Activation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Activation +func (tr *Activation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Activation +func (tr *Activation) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Activation +func (tr *Activation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Activation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Activation) LateInitialize(attrs []byte) (bool, error) { + params := &ActivationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Activation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssm/v1beta1/zz_activation_types.go b/apis/ssm/v1beta1/zz_activation_types.go index 604a954cce..4e4c71260b 100755 --- a/apis/ssm/v1beta1/zz_activation_types.go +++ b/apis/ssm/v1beta1/zz_activation_types.go @@ -154,13 +154,14 @@ type ActivationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Activation is the Schema for the Activations API. Registers an on-premises server or virtual machine with Amazon EC2 so that it can be managed using Run Command. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Activation struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_association_terraformed.go b/apis/ssm/v1beta1/zz_association_terraformed.go new file mode 100755 index 0000000000..e8a42529e1 --- /dev/null +++ b/apis/ssm/v1beta1/zz_association_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Association +func (mg *Association) GetTerraformResourceType() string { + return "aws_ssm_association" +} + +// GetConnectionDetailsMapping for this Association +func (tr *Association) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Association +func (tr *Association) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Association +func (tr *Association) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Association +func (tr *Association) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Association +func (tr *Association) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Association +func (tr *Association) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Association +func (tr *Association) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Association +func (tr *Association) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Association using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Association) LateInitialize(attrs []byte) (bool, error) { + params := &AssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Association) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ssm/v1beta1/zz_association_types.go b/apis/ssm/v1beta1/zz_association_types.go index 8d3cdffde6..f95d256f06 100755 --- a/apis/ssm/v1beta1/zz_association_types.go +++ b/apis/ssm/v1beta1/zz_association_types.go @@ -292,13 +292,14 @@ type AssociationStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Association is the Schema for the Associations API. Associates an SSM Document to an instance or EC2 tag. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Association struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_defaultpatchbaseline_terraformed.go b/apis/ssm/v1beta1/zz_defaultpatchbaseline_terraformed.go new file mode 100755 index 0000000000..41957d92df --- /dev/null +++ b/apis/ssm/v1beta1/zz_defaultpatchbaseline_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this DefaultPatchBaseline +func (mg *DefaultPatchBaseline) GetTerraformResourceType() string { + return "aws_ssm_default_patch_baseline" +} + +// GetConnectionDetailsMapping for this DefaultPatchBaseline +func (tr *DefaultPatchBaseline) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this DefaultPatchBaseline +func (tr *DefaultPatchBaseline) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this DefaultPatchBaseline +func (tr *DefaultPatchBaseline) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this DefaultPatchBaseline +func (tr *DefaultPatchBaseline) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this DefaultPatchBaseline +func (tr *DefaultPatchBaseline) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this DefaultPatchBaseline +func (tr *DefaultPatchBaseline) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this DefaultPatchBaseline +func (tr *DefaultPatchBaseline) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this DefaultPatchBaseline +func (tr *DefaultPatchBaseline) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this DefaultPatchBaseline using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *DefaultPatchBaseline) LateInitialize(attrs []byte) (bool, error) { + params := &DefaultPatchBaselineParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *DefaultPatchBaseline) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssm/v1beta1/zz_defaultpatchbaseline_types.go b/apis/ssm/v1beta1/zz_defaultpatchbaseline_types.go index bfdab2f8d0..d95aa8462d 100755 --- a/apis/ssm/v1beta1/zz_defaultpatchbaseline_types.go +++ b/apis/ssm/v1beta1/zz_defaultpatchbaseline_types.go @@ -165,13 +165,14 @@ type DefaultPatchBaselineStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // DefaultPatchBaseline is the Schema for the DefaultPatchBaselines API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type DefaultPatchBaseline struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_document_terraformed.go b/apis/ssm/v1beta1/zz_document_terraformed.go new file mode 100755 index 0000000000..203eb8cb74 --- /dev/null +++ b/apis/ssm/v1beta1/zz_document_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Document +func (mg *Document) GetTerraformResourceType() string { + return "aws_ssm_document" +} + +// GetConnectionDetailsMapping for this Document +func (tr *Document) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Document +func (tr *Document) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Document +func (tr *Document) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Document +func (tr *Document) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Document +func (tr *Document) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Document +func (tr *Document) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Document +func (tr *Document) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Document +func (tr *Document) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Document using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Document) LateInitialize(attrs []byte) (bool, error) { + params := &DocumentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Document) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssm/v1beta1/zz_document_types.go b/apis/ssm/v1beta1/zz_document_types.go index 014c3a8728..6ffa528191 100755 --- a/apis/ssm/v1beta1/zz_document_types.go +++ b/apis/ssm/v1beta1/zz_document_types.go @@ -242,13 +242,14 @@ type DocumentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Document is the Schema for the Documents API. Provides an SSM Document resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Document struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_generated.conversion_hubs.go b/apis/ssm/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..2d5f29a60f --- /dev/null +++ b/apis/ssm/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Activation) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Association) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *DefaultPatchBaseline) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Document) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MaintenanceWindow) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MaintenanceWindowTarget) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *MaintenanceWindowTask) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Parameter) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PatchBaseline) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PatchGroup) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ResourceDataSync) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ServiceSetting) Hub() {} diff --git a/apis/ssm/v1beta1/zz_generated_terraformed.go b/apis/ssm/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index dec95eb878..0000000000 --- a/apis/ssm/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1387 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Activation -func (mg *Activation) GetTerraformResourceType() string { - return "aws_ssm_activation" -} - -// GetConnectionDetailsMapping for this Activation -func (tr *Activation) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Activation -func (tr *Activation) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Activation -func (tr *Activation) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Activation -func (tr *Activation) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Activation -func (tr *Activation) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Activation -func (tr *Activation) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Activation -func (tr *Activation) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Activation -func (tr *Activation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Activation using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Activation) LateInitialize(attrs []byte) (bool, error) { - params := &ActivationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Activation) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Association -func (mg *Association) GetTerraformResourceType() string { - return "aws_ssm_association" -} - -// GetConnectionDetailsMapping for this Association -func (tr *Association) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Association -func (tr *Association) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Association -func (tr *Association) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Association -func (tr *Association) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Association -func (tr *Association) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Association -func (tr *Association) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Association -func (tr *Association) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Association -func (tr *Association) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Association using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Association) LateInitialize(attrs []byte) (bool, error) { - params := &AssociationParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Association) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this DefaultPatchBaseline -func (mg *DefaultPatchBaseline) GetTerraformResourceType() string { - return "aws_ssm_default_patch_baseline" -} - -// GetConnectionDetailsMapping for this DefaultPatchBaseline -func (tr *DefaultPatchBaseline) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this DefaultPatchBaseline -func (tr *DefaultPatchBaseline) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this DefaultPatchBaseline -func (tr *DefaultPatchBaseline) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this DefaultPatchBaseline -func (tr *DefaultPatchBaseline) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this DefaultPatchBaseline -func (tr *DefaultPatchBaseline) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this DefaultPatchBaseline -func (tr *DefaultPatchBaseline) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this DefaultPatchBaseline -func (tr *DefaultPatchBaseline) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this DefaultPatchBaseline -func (tr *DefaultPatchBaseline) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this DefaultPatchBaseline using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *DefaultPatchBaseline) LateInitialize(attrs []byte) (bool, error) { - params := &DefaultPatchBaselineParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *DefaultPatchBaseline) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Document -func (mg *Document) GetTerraformResourceType() string { - return "aws_ssm_document" -} - -// GetConnectionDetailsMapping for this Document -func (tr *Document) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Document -func (tr *Document) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Document -func (tr *Document) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Document -func (tr *Document) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Document -func (tr *Document) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Document -func (tr *Document) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Document -func (tr *Document) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Document -func (tr *Document) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Document using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Document) LateInitialize(attrs []byte) (bool, error) { - params := &DocumentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Document) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MaintenanceWindow -func (mg *MaintenanceWindow) GetTerraformResourceType() string { - return "aws_ssm_maintenance_window" -} - -// GetConnectionDetailsMapping for this MaintenanceWindow -func (tr *MaintenanceWindow) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MaintenanceWindow -func (tr *MaintenanceWindow) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MaintenanceWindow -func (tr *MaintenanceWindow) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MaintenanceWindow -func (tr *MaintenanceWindow) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MaintenanceWindow -func (tr *MaintenanceWindow) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MaintenanceWindow -func (tr *MaintenanceWindow) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MaintenanceWindow -func (tr *MaintenanceWindow) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MaintenanceWindow -func (tr *MaintenanceWindow) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MaintenanceWindow using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MaintenanceWindow) LateInitialize(attrs []byte) (bool, error) { - params := &MaintenanceWindowParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MaintenanceWindow) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MaintenanceWindowTarget -func (mg *MaintenanceWindowTarget) GetTerraformResourceType() string { - return "aws_ssm_maintenance_window_target" -} - -// GetConnectionDetailsMapping for this MaintenanceWindowTarget -func (tr *MaintenanceWindowTarget) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this MaintenanceWindowTarget -func (tr *MaintenanceWindowTarget) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MaintenanceWindowTarget -func (tr *MaintenanceWindowTarget) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MaintenanceWindowTarget -func (tr *MaintenanceWindowTarget) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MaintenanceWindowTarget -func (tr *MaintenanceWindowTarget) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MaintenanceWindowTarget -func (tr *MaintenanceWindowTarget) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MaintenanceWindowTarget -func (tr *MaintenanceWindowTarget) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MaintenanceWindowTarget -func (tr *MaintenanceWindowTarget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MaintenanceWindowTarget using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MaintenanceWindowTarget) LateInitialize(attrs []byte) (bool, error) { - params := &MaintenanceWindowTargetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MaintenanceWindowTarget) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this MaintenanceWindowTask -func (mg *MaintenanceWindowTask) GetTerraformResourceType() string { - return "aws_ssm_maintenance_window_task" -} - -// GetConnectionDetailsMapping for this MaintenanceWindowTask -func (tr *MaintenanceWindowTask) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"task_invocation_parameters[*].lambda_parameters[*].payload": "spec.forProvider.taskInvocationParameters[*].lambdaParameters[*].payloadSecretRef", "task_invocation_parameters[*].step_functions_parameters[*].input": "spec.forProvider.taskInvocationParameters[*].stepFunctionsParameters[*].inputSecretRef"} -} - -// GetObservation of this MaintenanceWindowTask -func (tr *MaintenanceWindowTask) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this MaintenanceWindowTask -func (tr *MaintenanceWindowTask) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this MaintenanceWindowTask -func (tr *MaintenanceWindowTask) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this MaintenanceWindowTask -func (tr *MaintenanceWindowTask) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this MaintenanceWindowTask -func (tr *MaintenanceWindowTask) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this MaintenanceWindowTask -func (tr *MaintenanceWindowTask) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this MaintenanceWindowTask -func (tr *MaintenanceWindowTask) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this MaintenanceWindowTask using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *MaintenanceWindowTask) LateInitialize(attrs []byte) (bool, error) { - params := &MaintenanceWindowTaskParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *MaintenanceWindowTask) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Parameter -func (mg *Parameter) GetTerraformResourceType() string { - return "aws_ssm_parameter" -} - -// GetConnectionDetailsMapping for this Parameter -func (tr *Parameter) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"value": "spec.forProvider.valueSecretRef"} -} - -// GetObservation of this Parameter -func (tr *Parameter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Parameter -func (tr *Parameter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Parameter -func (tr *Parameter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Parameter -func (tr *Parameter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Parameter -func (tr *Parameter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Parameter -func (tr *Parameter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Parameter -func (tr *Parameter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Parameter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Parameter) LateInitialize(attrs []byte) (bool, error) { - params := &ParameterParameters_2{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Parameter) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PatchBaseline -func (mg *PatchBaseline) GetTerraformResourceType() string { - return "aws_ssm_patch_baseline" -} - -// GetConnectionDetailsMapping for this PatchBaseline -func (tr *PatchBaseline) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PatchBaseline -func (tr *PatchBaseline) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PatchBaseline -func (tr *PatchBaseline) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PatchBaseline -func (tr *PatchBaseline) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PatchBaseline -func (tr *PatchBaseline) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PatchBaseline -func (tr *PatchBaseline) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PatchBaseline -func (tr *PatchBaseline) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PatchBaseline -func (tr *PatchBaseline) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PatchBaseline using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PatchBaseline) LateInitialize(attrs []byte) (bool, error) { - params := &PatchBaselineParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PatchBaseline) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PatchGroup -func (mg *PatchGroup) GetTerraformResourceType() string { - return "aws_ssm_patch_group" -} - -// GetConnectionDetailsMapping for this PatchGroup -func (tr *PatchGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PatchGroup -func (tr *PatchGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PatchGroup -func (tr *PatchGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PatchGroup -func (tr *PatchGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PatchGroup -func (tr *PatchGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PatchGroup -func (tr *PatchGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PatchGroup -func (tr *PatchGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PatchGroup -func (tr *PatchGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PatchGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PatchGroup) LateInitialize(attrs []byte) (bool, error) { - params := &PatchGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PatchGroup) GetTerraformSchemaVersion() int { - return 1 -} - -// GetTerraformResourceType returns Terraform resource type for this ResourceDataSync -func (mg *ResourceDataSync) GetTerraformResourceType() string { - return "aws_ssm_resource_data_sync" -} - -// GetConnectionDetailsMapping for this ResourceDataSync -func (tr *ResourceDataSync) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ResourceDataSync -func (tr *ResourceDataSync) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ResourceDataSync -func (tr *ResourceDataSync) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ResourceDataSync -func (tr *ResourceDataSync) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ResourceDataSync -func (tr *ResourceDataSync) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ResourceDataSync -func (tr *ResourceDataSync) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ResourceDataSync -func (tr *ResourceDataSync) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ResourceDataSync -func (tr *ResourceDataSync) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ResourceDataSync using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ResourceDataSync) LateInitialize(attrs []byte) (bool, error) { - params := &ResourceDataSyncParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ResourceDataSync) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ServiceSetting -func (mg *ServiceSetting) GetTerraformResourceType() string { - return "aws_ssm_service_setting" -} - -// GetConnectionDetailsMapping for this ServiceSetting -func (tr *ServiceSetting) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ServiceSetting -func (tr *ServiceSetting) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ServiceSetting -func (tr *ServiceSetting) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ServiceSetting -func (tr *ServiceSetting) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ServiceSetting -func (tr *ServiceSetting) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ServiceSetting -func (tr *ServiceSetting) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ServiceSetting -func (tr *ServiceSetting) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ServiceSetting -func (tr *ServiceSetting) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ServiceSetting using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ServiceSetting) LateInitialize(attrs []byte) (bool, error) { - params := &ServiceSettingParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ServiceSetting) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/ssm/v1beta1/zz_maintenancewindow_terraformed.go b/apis/ssm/v1beta1/zz_maintenancewindow_terraformed.go new file mode 100755 index 0000000000..0824194c2a --- /dev/null +++ b/apis/ssm/v1beta1/zz_maintenancewindow_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MaintenanceWindow +func (mg *MaintenanceWindow) GetTerraformResourceType() string { + return "aws_ssm_maintenance_window" +} + +// GetConnectionDetailsMapping for this MaintenanceWindow +func (tr *MaintenanceWindow) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MaintenanceWindow +func (tr *MaintenanceWindow) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MaintenanceWindow +func (tr *MaintenanceWindow) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MaintenanceWindow +func (tr *MaintenanceWindow) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MaintenanceWindow +func (tr *MaintenanceWindow) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MaintenanceWindow +func (tr *MaintenanceWindow) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MaintenanceWindow +func (tr *MaintenanceWindow) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MaintenanceWindow +func (tr *MaintenanceWindow) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MaintenanceWindow using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MaintenanceWindow) LateInitialize(attrs []byte) (bool, error) { + params := &MaintenanceWindowParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MaintenanceWindow) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssm/v1beta1/zz_maintenancewindow_types.go b/apis/ssm/v1beta1/zz_maintenancewindow_types.go index 9d17068fae..542526f9dc 100755 --- a/apis/ssm/v1beta1/zz_maintenancewindow_types.go +++ b/apis/ssm/v1beta1/zz_maintenancewindow_types.go @@ -185,13 +185,14 @@ type MaintenanceWindowStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MaintenanceWindow is the Schema for the MaintenanceWindows API. Provides an SSM Maintenance Window resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MaintenanceWindow struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_maintenancewindowtarget_terraformed.go b/apis/ssm/v1beta1/zz_maintenancewindowtarget_terraformed.go new file mode 100755 index 0000000000..f09c17b25c --- /dev/null +++ b/apis/ssm/v1beta1/zz_maintenancewindowtarget_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MaintenanceWindowTarget +func (mg *MaintenanceWindowTarget) GetTerraformResourceType() string { + return "aws_ssm_maintenance_window_target" +} + +// GetConnectionDetailsMapping for this MaintenanceWindowTarget +func (tr *MaintenanceWindowTarget) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this MaintenanceWindowTarget +func (tr *MaintenanceWindowTarget) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MaintenanceWindowTarget +func (tr *MaintenanceWindowTarget) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MaintenanceWindowTarget +func (tr *MaintenanceWindowTarget) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MaintenanceWindowTarget +func (tr *MaintenanceWindowTarget) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MaintenanceWindowTarget +func (tr *MaintenanceWindowTarget) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MaintenanceWindowTarget +func (tr *MaintenanceWindowTarget) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MaintenanceWindowTarget +func (tr *MaintenanceWindowTarget) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MaintenanceWindowTarget using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MaintenanceWindowTarget) LateInitialize(attrs []byte) (bool, error) { + params := &MaintenanceWindowTargetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MaintenanceWindowTarget) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssm/v1beta1/zz_maintenancewindowtarget_types.go b/apis/ssm/v1beta1/zz_maintenancewindowtarget_types.go index 4cb0af1819..45c88e67a3 100755 --- a/apis/ssm/v1beta1/zz_maintenancewindowtarget_types.go +++ b/apis/ssm/v1beta1/zz_maintenancewindowtarget_types.go @@ -162,13 +162,14 @@ type MaintenanceWindowTargetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MaintenanceWindowTarget is the Schema for the MaintenanceWindowTargets API. Provides an SSM Maintenance Window Target resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MaintenanceWindowTarget struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_maintenancewindowtask_terraformed.go b/apis/ssm/v1beta1/zz_maintenancewindowtask_terraformed.go new file mode 100755 index 0000000000..a46c9ecb43 --- /dev/null +++ b/apis/ssm/v1beta1/zz_maintenancewindowtask_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this MaintenanceWindowTask +func (mg *MaintenanceWindowTask) GetTerraformResourceType() string { + return "aws_ssm_maintenance_window_task" +} + +// GetConnectionDetailsMapping for this MaintenanceWindowTask +func (tr *MaintenanceWindowTask) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"task_invocation_parameters[*].lambda_parameters[*].payload": "spec.forProvider.taskInvocationParameters[*].lambdaParameters[*].payloadSecretRef", "task_invocation_parameters[*].step_functions_parameters[*].input": "spec.forProvider.taskInvocationParameters[*].stepFunctionsParameters[*].inputSecretRef"} +} + +// GetObservation of this MaintenanceWindowTask +func (tr *MaintenanceWindowTask) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this MaintenanceWindowTask +func (tr *MaintenanceWindowTask) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this MaintenanceWindowTask +func (tr *MaintenanceWindowTask) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this MaintenanceWindowTask +func (tr *MaintenanceWindowTask) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this MaintenanceWindowTask +func (tr *MaintenanceWindowTask) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this MaintenanceWindowTask +func (tr *MaintenanceWindowTask) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this MaintenanceWindowTask +func (tr *MaintenanceWindowTask) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this MaintenanceWindowTask using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *MaintenanceWindowTask) LateInitialize(attrs []byte) (bool, error) { + params := &MaintenanceWindowTaskParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *MaintenanceWindowTask) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssm/v1beta1/zz_maintenancewindowtask_types.go b/apis/ssm/v1beta1/zz_maintenancewindowtask_types.go index 33aaf7221b..eff99fddb1 100755 --- a/apis/ssm/v1beta1/zz_maintenancewindowtask_types.go +++ b/apis/ssm/v1beta1/zz_maintenancewindowtask_types.go @@ -707,13 +707,14 @@ type MaintenanceWindowTaskStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // MaintenanceWindowTask is the Schema for the MaintenanceWindowTasks API. Provides an SSM Maintenance Window Task resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type MaintenanceWindowTask struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_parameter_terraformed.go b/apis/ssm/v1beta1/zz_parameter_terraformed.go new file mode 100755 index 0000000000..4899b158d5 --- /dev/null +++ b/apis/ssm/v1beta1/zz_parameter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Parameter +func (mg *Parameter) GetTerraformResourceType() string { + return "aws_ssm_parameter" +} + +// GetConnectionDetailsMapping for this Parameter +func (tr *Parameter) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"value": "spec.forProvider.valueSecretRef"} +} + +// GetObservation of this Parameter +func (tr *Parameter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Parameter +func (tr *Parameter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Parameter +func (tr *Parameter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Parameter +func (tr *Parameter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Parameter +func (tr *Parameter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Parameter +func (tr *Parameter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Parameter +func (tr *Parameter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Parameter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Parameter) LateInitialize(attrs []byte) (bool, error) { + params := &ParameterParameters_2{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Parameter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssm/v1beta1/zz_parameter_types.go b/apis/ssm/v1beta1/zz_parameter_types.go index 674b3c9bc5..165d56d243 100755 --- a/apis/ssm/v1beta1/zz_parameter_types.go +++ b/apis/ssm/v1beta1/zz_parameter_types.go @@ -171,13 +171,14 @@ type ParameterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Parameter is the Schema for the Parameters API. Provides a SSM Parameter resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Parameter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_patchbaseline_terraformed.go b/apis/ssm/v1beta1/zz_patchbaseline_terraformed.go new file mode 100755 index 0000000000..79a3992134 --- /dev/null +++ b/apis/ssm/v1beta1/zz_patchbaseline_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PatchBaseline +func (mg *PatchBaseline) GetTerraformResourceType() string { + return "aws_ssm_patch_baseline" +} + +// GetConnectionDetailsMapping for this PatchBaseline +func (tr *PatchBaseline) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PatchBaseline +func (tr *PatchBaseline) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PatchBaseline +func (tr *PatchBaseline) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PatchBaseline +func (tr *PatchBaseline) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PatchBaseline +func (tr *PatchBaseline) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PatchBaseline +func (tr *PatchBaseline) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PatchBaseline +func (tr *PatchBaseline) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PatchBaseline +func (tr *PatchBaseline) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PatchBaseline using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PatchBaseline) LateInitialize(attrs []byte) (bool, error) { + params := &PatchBaselineParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PatchBaseline) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssm/v1beta1/zz_patchbaseline_types.go b/apis/ssm/v1beta1/zz_patchbaseline_types.go index 7d5f89819f..371c406854 100755 --- a/apis/ssm/v1beta1/zz_patchbaseline_types.go +++ b/apis/ssm/v1beta1/zz_patchbaseline_types.go @@ -457,13 +457,14 @@ type PatchBaselineStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PatchBaseline is the Schema for the PatchBaselines API. Provides an SSM Patch Baseline resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PatchBaseline struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_patchgroup_terraformed.go b/apis/ssm/v1beta1/zz_patchgroup_terraformed.go new file mode 100755 index 0000000000..d81f42a298 --- /dev/null +++ b/apis/ssm/v1beta1/zz_patchgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PatchGroup +func (mg *PatchGroup) GetTerraformResourceType() string { + return "aws_ssm_patch_group" +} + +// GetConnectionDetailsMapping for this PatchGroup +func (tr *PatchGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PatchGroup +func (tr *PatchGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PatchGroup +func (tr *PatchGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PatchGroup +func (tr *PatchGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PatchGroup +func (tr *PatchGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PatchGroup +func (tr *PatchGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PatchGroup +func (tr *PatchGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PatchGroup +func (tr *PatchGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PatchGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PatchGroup) LateInitialize(attrs []byte) (bool, error) { + params := &PatchGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PatchGroup) GetTerraformSchemaVersion() int { + return 1 +} diff --git a/apis/ssm/v1beta1/zz_patchgroup_types.go b/apis/ssm/v1beta1/zz_patchgroup_types.go index 957abb3518..6291272f54 100755 --- a/apis/ssm/v1beta1/zz_patchgroup_types.go +++ b/apis/ssm/v1beta1/zz_patchgroup_types.go @@ -98,13 +98,14 @@ type PatchGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PatchGroup is the Schema for the PatchGroups API. Provides an SSM Patch Group resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PatchGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_resourcedatasync_terraformed.go b/apis/ssm/v1beta1/zz_resourcedatasync_terraformed.go new file mode 100755 index 0000000000..71ee8093df --- /dev/null +++ b/apis/ssm/v1beta1/zz_resourcedatasync_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ResourceDataSync +func (mg *ResourceDataSync) GetTerraformResourceType() string { + return "aws_ssm_resource_data_sync" +} + +// GetConnectionDetailsMapping for this ResourceDataSync +func (tr *ResourceDataSync) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ResourceDataSync +func (tr *ResourceDataSync) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ResourceDataSync +func (tr *ResourceDataSync) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ResourceDataSync +func (tr *ResourceDataSync) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ResourceDataSync +func (tr *ResourceDataSync) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ResourceDataSync +func (tr *ResourceDataSync) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ResourceDataSync +func (tr *ResourceDataSync) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ResourceDataSync +func (tr *ResourceDataSync) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ResourceDataSync using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ResourceDataSync) LateInitialize(attrs []byte) (bool, error) { + params := &ResourceDataSyncParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ResourceDataSync) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssm/v1beta1/zz_resourcedatasync_types.go b/apis/ssm/v1beta1/zz_resourcedatasync_types.go index 751c22429c..d8bb6d4782 100755 --- a/apis/ssm/v1beta1/zz_resourcedatasync_types.go +++ b/apis/ssm/v1beta1/zz_resourcedatasync_types.go @@ -151,13 +151,14 @@ type ResourceDataSyncStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ResourceDataSync is the Schema for the ResourceDataSyncs API. Provides a SSM resource data sync. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ResourceDataSync struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssm/v1beta1/zz_servicesetting_terraformed.go b/apis/ssm/v1beta1/zz_servicesetting_terraformed.go new file mode 100755 index 0000000000..ff61e30ada --- /dev/null +++ b/apis/ssm/v1beta1/zz_servicesetting_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ServiceSetting +func (mg *ServiceSetting) GetTerraformResourceType() string { + return "aws_ssm_service_setting" +} + +// GetConnectionDetailsMapping for this ServiceSetting +func (tr *ServiceSetting) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ServiceSetting +func (tr *ServiceSetting) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ServiceSetting +func (tr *ServiceSetting) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ServiceSetting +func (tr *ServiceSetting) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ServiceSetting +func (tr *ServiceSetting) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ServiceSetting +func (tr *ServiceSetting) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ServiceSetting +func (tr *ServiceSetting) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ServiceSetting +func (tr *ServiceSetting) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ServiceSetting using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ServiceSetting) LateInitialize(attrs []byte) (bool, error) { + params := &ServiceSettingParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ServiceSetting) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssm/v1beta1/zz_servicesetting_types.go b/apis/ssm/v1beta1/zz_servicesetting_types.go index 9309ecbd1d..64bf10b23b 100755 --- a/apis/ssm/v1beta1/zz_servicesetting_types.go +++ b/apis/ssm/v1beta1/zz_servicesetting_types.go @@ -83,13 +83,14 @@ type ServiceSettingStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ServiceSetting is the Schema for the ServiceSettings API. Defines how a user interacts with or uses a service or a feature of a service. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ServiceSetting struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssoadmin/v1beta1/zz_accountassignment_terraformed.go b/apis/ssoadmin/v1beta1/zz_accountassignment_terraformed.go new file mode 100755 index 0000000000..30c9e58fc2 --- /dev/null +++ b/apis/ssoadmin/v1beta1/zz_accountassignment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this AccountAssignment +func (mg *AccountAssignment) GetTerraformResourceType() string { + return "aws_ssoadmin_account_assignment" +} + +// GetConnectionDetailsMapping for this AccountAssignment +func (tr *AccountAssignment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this AccountAssignment +func (tr *AccountAssignment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this AccountAssignment +func (tr *AccountAssignment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this AccountAssignment +func (tr *AccountAssignment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this AccountAssignment +func (tr *AccountAssignment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this AccountAssignment +func (tr *AccountAssignment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this AccountAssignment +func (tr *AccountAssignment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this AccountAssignment +func (tr *AccountAssignment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this AccountAssignment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *AccountAssignment) LateInitialize(attrs []byte) (bool, error) { + params := &AccountAssignmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *AccountAssignment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssoadmin/v1beta1/zz_accountassignment_types.go b/apis/ssoadmin/v1beta1/zz_accountassignment_types.go index fce2e59db7..717fe70c18 100755 --- a/apis/ssoadmin/v1beta1/zz_accountassignment_types.go +++ b/apis/ssoadmin/v1beta1/zz_accountassignment_types.go @@ -121,13 +121,14 @@ type AccountAssignmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // AccountAssignment is the Schema for the AccountAssignments API. Manages a Single Sign-On (SSO) Account Assignment // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type AccountAssignment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssoadmin/v1beta1/zz_customermanagedpolicyattachment_terraformed.go b/apis/ssoadmin/v1beta1/zz_customermanagedpolicyattachment_terraformed.go new file mode 100755 index 0000000000..8f0674485a --- /dev/null +++ b/apis/ssoadmin/v1beta1/zz_customermanagedpolicyattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this CustomerManagedPolicyAttachment +func (mg *CustomerManagedPolicyAttachment) GetTerraformResourceType() string { + return "aws_ssoadmin_customer_managed_policy_attachment" +} + +// GetConnectionDetailsMapping for this CustomerManagedPolicyAttachment +func (tr *CustomerManagedPolicyAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this CustomerManagedPolicyAttachment +func (tr *CustomerManagedPolicyAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this CustomerManagedPolicyAttachment +func (tr *CustomerManagedPolicyAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this CustomerManagedPolicyAttachment +func (tr *CustomerManagedPolicyAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this CustomerManagedPolicyAttachment +func (tr *CustomerManagedPolicyAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this CustomerManagedPolicyAttachment +func (tr *CustomerManagedPolicyAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this CustomerManagedPolicyAttachment +func (tr *CustomerManagedPolicyAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this CustomerManagedPolicyAttachment +func (tr *CustomerManagedPolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this CustomerManagedPolicyAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *CustomerManagedPolicyAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &CustomerManagedPolicyAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *CustomerManagedPolicyAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssoadmin/v1beta1/zz_customermanagedpolicyattachment_types.go b/apis/ssoadmin/v1beta1/zz_customermanagedpolicyattachment_types.go index 9edc9a428a..2625f3679f 100755 --- a/apis/ssoadmin/v1beta1/zz_customermanagedpolicyattachment_types.go +++ b/apis/ssoadmin/v1beta1/zz_customermanagedpolicyattachment_types.go @@ -143,13 +143,14 @@ type CustomerManagedPolicyAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // CustomerManagedPolicyAttachment is the Schema for the CustomerManagedPolicyAttachments API. Manages a customer managed policy for a Single Sign-On (SSO) Permission Set // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type CustomerManagedPolicyAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssoadmin/v1beta1/zz_generated.conversion_hubs.go b/apis/ssoadmin/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..ff16619194 --- /dev/null +++ b/apis/ssoadmin/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *AccountAssignment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *CustomerManagedPolicyAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *InstanceAccessControlAttributes) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *ManagedPolicyAttachment) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PermissionSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PermissionSetInlinePolicy) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *PermissionsBoundaryAttachment) Hub() {} diff --git a/apis/ssoadmin/v1beta1/zz_generated_terraformed.go b/apis/ssoadmin/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 635f279e92..0000000000 --- a/apis/ssoadmin/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,817 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this AccountAssignment -func (mg *AccountAssignment) GetTerraformResourceType() string { - return "aws_ssoadmin_account_assignment" -} - -// GetConnectionDetailsMapping for this AccountAssignment -func (tr *AccountAssignment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this AccountAssignment -func (tr *AccountAssignment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this AccountAssignment -func (tr *AccountAssignment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this AccountAssignment -func (tr *AccountAssignment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this AccountAssignment -func (tr *AccountAssignment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this AccountAssignment -func (tr *AccountAssignment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this AccountAssignment -func (tr *AccountAssignment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this AccountAssignment -func (tr *AccountAssignment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this AccountAssignment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *AccountAssignment) LateInitialize(attrs []byte) (bool, error) { - params := &AccountAssignmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *AccountAssignment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this CustomerManagedPolicyAttachment -func (mg *CustomerManagedPolicyAttachment) GetTerraformResourceType() string { - return "aws_ssoadmin_customer_managed_policy_attachment" -} - -// GetConnectionDetailsMapping for this CustomerManagedPolicyAttachment -func (tr *CustomerManagedPolicyAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this CustomerManagedPolicyAttachment -func (tr *CustomerManagedPolicyAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this CustomerManagedPolicyAttachment -func (tr *CustomerManagedPolicyAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this CustomerManagedPolicyAttachment -func (tr *CustomerManagedPolicyAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this CustomerManagedPolicyAttachment -func (tr *CustomerManagedPolicyAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this CustomerManagedPolicyAttachment -func (tr *CustomerManagedPolicyAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this CustomerManagedPolicyAttachment -func (tr *CustomerManagedPolicyAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this CustomerManagedPolicyAttachment -func (tr *CustomerManagedPolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this CustomerManagedPolicyAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *CustomerManagedPolicyAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &CustomerManagedPolicyAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *CustomerManagedPolicyAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this InstanceAccessControlAttributes -func (mg *InstanceAccessControlAttributes) GetTerraformResourceType() string { - return "aws_ssoadmin_instance_access_control_attributes" -} - -// GetConnectionDetailsMapping for this InstanceAccessControlAttributes -func (tr *InstanceAccessControlAttributes) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this InstanceAccessControlAttributes -func (tr *InstanceAccessControlAttributes) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this InstanceAccessControlAttributes -func (tr *InstanceAccessControlAttributes) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this InstanceAccessControlAttributes -func (tr *InstanceAccessControlAttributes) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this InstanceAccessControlAttributes -func (tr *InstanceAccessControlAttributes) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this InstanceAccessControlAttributes -func (tr *InstanceAccessControlAttributes) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this InstanceAccessControlAttributes -func (tr *InstanceAccessControlAttributes) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this InstanceAccessControlAttributes -func (tr *InstanceAccessControlAttributes) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this InstanceAccessControlAttributes using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *InstanceAccessControlAttributes) LateInitialize(attrs []byte) (bool, error) { - params := &InstanceAccessControlAttributesParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *InstanceAccessControlAttributes) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this ManagedPolicyAttachment -func (mg *ManagedPolicyAttachment) GetTerraformResourceType() string { - return "aws_ssoadmin_managed_policy_attachment" -} - -// GetConnectionDetailsMapping for this ManagedPolicyAttachment -func (tr *ManagedPolicyAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ManagedPolicyAttachment -func (tr *ManagedPolicyAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ManagedPolicyAttachment -func (tr *ManagedPolicyAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ManagedPolicyAttachment -func (tr *ManagedPolicyAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ManagedPolicyAttachment -func (tr *ManagedPolicyAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ManagedPolicyAttachment -func (tr *ManagedPolicyAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ManagedPolicyAttachment -func (tr *ManagedPolicyAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ManagedPolicyAttachment -func (tr *ManagedPolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ManagedPolicyAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ManagedPolicyAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &ManagedPolicyAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ManagedPolicyAttachment) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PermissionSet -func (mg *PermissionSet) GetTerraformResourceType() string { - return "aws_ssoadmin_permission_set" -} - -// GetConnectionDetailsMapping for this PermissionSet -func (tr *PermissionSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PermissionSet -func (tr *PermissionSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PermissionSet -func (tr *PermissionSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PermissionSet -func (tr *PermissionSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PermissionSet -func (tr *PermissionSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PermissionSet -func (tr *PermissionSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PermissionSet -func (tr *PermissionSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PermissionSet -func (tr *PermissionSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PermissionSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PermissionSet) LateInitialize(attrs []byte) (bool, error) { - params := &PermissionSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PermissionSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PermissionSetInlinePolicy -func (mg *PermissionSetInlinePolicy) GetTerraformResourceType() string { - return "aws_ssoadmin_permission_set_inline_policy" -} - -// GetConnectionDetailsMapping for this PermissionSetInlinePolicy -func (tr *PermissionSetInlinePolicy) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PermissionSetInlinePolicy -func (tr *PermissionSetInlinePolicy) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PermissionSetInlinePolicy -func (tr *PermissionSetInlinePolicy) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PermissionSetInlinePolicy -func (tr *PermissionSetInlinePolicy) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PermissionSetInlinePolicy -func (tr *PermissionSetInlinePolicy) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PermissionSetInlinePolicy -func (tr *PermissionSetInlinePolicy) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PermissionSetInlinePolicy -func (tr *PermissionSetInlinePolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PermissionSetInlinePolicy -func (tr *PermissionSetInlinePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PermissionSetInlinePolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PermissionSetInlinePolicy) LateInitialize(attrs []byte) (bool, error) { - params := &PermissionSetInlinePolicyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PermissionSetInlinePolicy) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this PermissionsBoundaryAttachment -func (mg *PermissionsBoundaryAttachment) GetTerraformResourceType() string { - return "aws_ssoadmin_permissions_boundary_attachment" -} - -// GetConnectionDetailsMapping for this PermissionsBoundaryAttachment -func (tr *PermissionsBoundaryAttachment) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this PermissionsBoundaryAttachment -func (tr *PermissionsBoundaryAttachment) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this PermissionsBoundaryAttachment -func (tr *PermissionsBoundaryAttachment) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this PermissionsBoundaryAttachment -func (tr *PermissionsBoundaryAttachment) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this PermissionsBoundaryAttachment -func (tr *PermissionsBoundaryAttachment) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this PermissionsBoundaryAttachment -func (tr *PermissionsBoundaryAttachment) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this PermissionsBoundaryAttachment -func (tr *PermissionsBoundaryAttachment) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this PermissionsBoundaryAttachment -func (tr *PermissionsBoundaryAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this PermissionsBoundaryAttachment using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *PermissionsBoundaryAttachment) LateInitialize(attrs []byte) (bool, error) { - params := &PermissionsBoundaryAttachmentParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *PermissionsBoundaryAttachment) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/ssoadmin/v1beta1/zz_instanceaccesscontrolattributes_terraformed.go b/apis/ssoadmin/v1beta1/zz_instanceaccesscontrolattributes_terraformed.go new file mode 100755 index 0000000000..bef749f099 --- /dev/null +++ b/apis/ssoadmin/v1beta1/zz_instanceaccesscontrolattributes_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this InstanceAccessControlAttributes +func (mg *InstanceAccessControlAttributes) GetTerraformResourceType() string { + return "aws_ssoadmin_instance_access_control_attributes" +} + +// GetConnectionDetailsMapping for this InstanceAccessControlAttributes +func (tr *InstanceAccessControlAttributes) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this InstanceAccessControlAttributes +func (tr *InstanceAccessControlAttributes) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this InstanceAccessControlAttributes +func (tr *InstanceAccessControlAttributes) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this InstanceAccessControlAttributes +func (tr *InstanceAccessControlAttributes) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this InstanceAccessControlAttributes +func (tr *InstanceAccessControlAttributes) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this InstanceAccessControlAttributes +func (tr *InstanceAccessControlAttributes) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this InstanceAccessControlAttributes +func (tr *InstanceAccessControlAttributes) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this InstanceAccessControlAttributes +func (tr *InstanceAccessControlAttributes) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this InstanceAccessControlAttributes using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *InstanceAccessControlAttributes) LateInitialize(attrs []byte) (bool, error) { + params := &InstanceAccessControlAttributesParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *InstanceAccessControlAttributes) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssoadmin/v1beta1/zz_instanceaccesscontrolattributes_types.go b/apis/ssoadmin/v1beta1/zz_instanceaccesscontrolattributes_types.go index 8391803b6c..24021be899 100755 --- a/apis/ssoadmin/v1beta1/zz_instanceaccesscontrolattributes_types.go +++ b/apis/ssoadmin/v1beta1/zz_instanceaccesscontrolattributes_types.go @@ -130,13 +130,14 @@ type InstanceAccessControlAttributesStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // InstanceAccessControlAttributes is the Schema for the InstanceAccessControlAttributess API. Provides a Single Sign-On (SSO) ABAC Resource: https://docs.aws.amazon.com/singlesignon/latest/userguide/abac.html // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type InstanceAccessControlAttributes struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssoadmin/v1beta1/zz_managedpolicyattachment_terraformed.go b/apis/ssoadmin/v1beta1/zz_managedpolicyattachment_terraformed.go new file mode 100755 index 0000000000..c3118dd25d --- /dev/null +++ b/apis/ssoadmin/v1beta1/zz_managedpolicyattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ManagedPolicyAttachment +func (mg *ManagedPolicyAttachment) GetTerraformResourceType() string { + return "aws_ssoadmin_managed_policy_attachment" +} + +// GetConnectionDetailsMapping for this ManagedPolicyAttachment +func (tr *ManagedPolicyAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ManagedPolicyAttachment +func (tr *ManagedPolicyAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ManagedPolicyAttachment +func (tr *ManagedPolicyAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ManagedPolicyAttachment +func (tr *ManagedPolicyAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ManagedPolicyAttachment +func (tr *ManagedPolicyAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ManagedPolicyAttachment +func (tr *ManagedPolicyAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ManagedPolicyAttachment +func (tr *ManagedPolicyAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ManagedPolicyAttachment +func (tr *ManagedPolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ManagedPolicyAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ManagedPolicyAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &ManagedPolicyAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ManagedPolicyAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssoadmin/v1beta1/zz_managedpolicyattachment_types.go b/apis/ssoadmin/v1beta1/zz_managedpolicyattachment_types.go index 58cc96c2c3..0ee3574daa 100755 --- a/apis/ssoadmin/v1beta1/zz_managedpolicyattachment_types.go +++ b/apis/ssoadmin/v1beta1/zz_managedpolicyattachment_types.go @@ -92,13 +92,14 @@ type ManagedPolicyAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ManagedPolicyAttachment is the Schema for the ManagedPolicyAttachments API. Manages an IAM managed policy for a Single Sign-On (SSO) Permission Set // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ManagedPolicyAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssoadmin/v1beta1/zz_permissionsboundaryattachment_terraformed.go b/apis/ssoadmin/v1beta1/zz_permissionsboundaryattachment_terraformed.go new file mode 100755 index 0000000000..8d8d749d75 --- /dev/null +++ b/apis/ssoadmin/v1beta1/zz_permissionsboundaryattachment_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PermissionsBoundaryAttachment +func (mg *PermissionsBoundaryAttachment) GetTerraformResourceType() string { + return "aws_ssoadmin_permissions_boundary_attachment" +} + +// GetConnectionDetailsMapping for this PermissionsBoundaryAttachment +func (tr *PermissionsBoundaryAttachment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PermissionsBoundaryAttachment +func (tr *PermissionsBoundaryAttachment) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PermissionsBoundaryAttachment +func (tr *PermissionsBoundaryAttachment) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PermissionsBoundaryAttachment +func (tr *PermissionsBoundaryAttachment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PermissionsBoundaryAttachment +func (tr *PermissionsBoundaryAttachment) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PermissionsBoundaryAttachment +func (tr *PermissionsBoundaryAttachment) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PermissionsBoundaryAttachment +func (tr *PermissionsBoundaryAttachment) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PermissionsBoundaryAttachment +func (tr *PermissionsBoundaryAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PermissionsBoundaryAttachment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PermissionsBoundaryAttachment) LateInitialize(attrs []byte) (bool, error) { + params := &PermissionsBoundaryAttachmentParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PermissionsBoundaryAttachment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssoadmin/v1beta1/zz_permissionsboundaryattachment_types.go b/apis/ssoadmin/v1beta1/zz_permissionsboundaryattachment_types.go index c3ea5ab326..4c0b09cf6f 100755 --- a/apis/ssoadmin/v1beta1/zz_permissionsboundaryattachment_types.go +++ b/apis/ssoadmin/v1beta1/zz_permissionsboundaryattachment_types.go @@ -168,13 +168,14 @@ type PermissionsBoundaryAttachmentStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PermissionsBoundaryAttachment is the Schema for the PermissionsBoundaryAttachments API. Attaches a permissions boundary policy to a Single Sign-On (SSO) Permission Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PermissionsBoundaryAttachment struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssoadmin/v1beta1/zz_permissionset_terraformed.go b/apis/ssoadmin/v1beta1/zz_permissionset_terraformed.go new file mode 100755 index 0000000000..0ec0dc9b07 --- /dev/null +++ b/apis/ssoadmin/v1beta1/zz_permissionset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PermissionSet +func (mg *PermissionSet) GetTerraformResourceType() string { + return "aws_ssoadmin_permission_set" +} + +// GetConnectionDetailsMapping for this PermissionSet +func (tr *PermissionSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PermissionSet +func (tr *PermissionSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PermissionSet +func (tr *PermissionSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PermissionSet +func (tr *PermissionSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PermissionSet +func (tr *PermissionSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PermissionSet +func (tr *PermissionSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PermissionSet +func (tr *PermissionSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PermissionSet +func (tr *PermissionSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PermissionSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PermissionSet) LateInitialize(attrs []byte) (bool, error) { + params := &PermissionSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PermissionSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssoadmin/v1beta1/zz_permissionset_types.go b/apis/ssoadmin/v1beta1/zz_permissionset_types.go index a1a83b9fa8..c8e5b8dfe9 100755 --- a/apis/ssoadmin/v1beta1/zz_permissionset_types.go +++ b/apis/ssoadmin/v1beta1/zz_permissionset_types.go @@ -131,13 +131,14 @@ type PermissionSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PermissionSet is the Schema for the PermissionSets API. Manages a Single Sign-On (SSO) Permission Set // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PermissionSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/ssoadmin/v1beta1/zz_permissionsetinlinepolicy_terraformed.go b/apis/ssoadmin/v1beta1/zz_permissionsetinlinepolicy_terraformed.go new file mode 100755 index 0000000000..fe41373fc9 --- /dev/null +++ b/apis/ssoadmin/v1beta1/zz_permissionsetinlinepolicy_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this PermissionSetInlinePolicy +func (mg *PermissionSetInlinePolicy) GetTerraformResourceType() string { + return "aws_ssoadmin_permission_set_inline_policy" +} + +// GetConnectionDetailsMapping for this PermissionSetInlinePolicy +func (tr *PermissionSetInlinePolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this PermissionSetInlinePolicy +func (tr *PermissionSetInlinePolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this PermissionSetInlinePolicy +func (tr *PermissionSetInlinePolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this PermissionSetInlinePolicy +func (tr *PermissionSetInlinePolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this PermissionSetInlinePolicy +func (tr *PermissionSetInlinePolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this PermissionSetInlinePolicy +func (tr *PermissionSetInlinePolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this PermissionSetInlinePolicy +func (tr *PermissionSetInlinePolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this PermissionSetInlinePolicy +func (tr *PermissionSetInlinePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this PermissionSetInlinePolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *PermissionSetInlinePolicy) LateInitialize(attrs []byte) (bool, error) { + params := &PermissionSetInlinePolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *PermissionSetInlinePolicy) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/ssoadmin/v1beta1/zz_permissionsetinlinepolicy_types.go b/apis/ssoadmin/v1beta1/zz_permissionsetinlinepolicy_types.go index 1611764c35..a8ef4af27d 100755 --- a/apis/ssoadmin/v1beta1/zz_permissionsetinlinepolicy_types.go +++ b/apis/ssoadmin/v1beta1/zz_permissionsetinlinepolicy_types.go @@ -92,13 +92,14 @@ type PermissionSetInlinePolicyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // PermissionSetInlinePolicy is the Schema for the PermissionSetInlinePolicys API. Manages an IAM inline policy for a Single Sign-On (SSO) Permission Set // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type PermissionSetInlinePolicy struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/swf/v1beta1/zz_generated_terraformed.go b/apis/swf/v1beta1/zz_domain_terraformed.go similarity index 100% rename from apis/swf/v1beta1/zz_generated_terraformed.go rename to apis/swf/v1beta1/zz_domain_terraformed.go diff --git a/apis/swf/v1beta1/zz_domain_types.go b/apis/swf/v1beta1/zz_domain_types.go index 3cc70574cb..11fcfde978 100755 --- a/apis/swf/v1beta1/zz_domain_types.go +++ b/apis/swf/v1beta1/zz_domain_types.go @@ -98,13 +98,14 @@ type DomainStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Domain is the Schema for the Domains API. Provides an SWF Domain resource // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Domain struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/swf/v1beta1/zz_generated.conversion_hubs.go b/apis/swf/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..6f3b930024 --- /dev/null +++ b/apis/swf/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Domain) Hub() {} diff --git a/apis/timestreamwrite/v1beta1/zz_generated_terraformed.go b/apis/timestreamwrite/v1beta1/zz_database_terraformed.go similarity index 52% rename from apis/timestreamwrite/v1beta1/zz_generated_terraformed.go rename to apis/timestreamwrite/v1beta1/zz_database_terraformed.go index 7212732137..b25f762b00 100755 --- a/apis/timestreamwrite/v1beta1/zz_generated_terraformed.go +++ b/apis/timestreamwrite/v1beta1/zz_database_terraformed.go @@ -131,117 +131,3 @@ func (tr *Database) LateInitialize(attrs []byte) (bool, error) { func (tr *Database) GetTerraformSchemaVersion() int { return 0 } - -// GetTerraformResourceType returns Terraform resource type for this Table -func (mg *Table) GetTerraformResourceType() string { - return "aws_timestreamwrite_table" -} - -// GetConnectionDetailsMapping for this Table -func (tr *Table) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Table -func (tr *Table) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Table -func (tr *Table) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Table -func (tr *Table) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Table -func (tr *Table) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Table -func (tr *Table) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Table -func (tr *Table) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Table -func (tr *Table) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Table using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Table) LateInitialize(attrs []byte) (bool, error) { - params := &TableParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Table) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/timestreamwrite/v1beta1/zz_database_types.go b/apis/timestreamwrite/v1beta1/zz_database_types.go index 5b952cf711..cadd4b6de1 100755 --- a/apis/timestreamwrite/v1beta1/zz_database_types.go +++ b/apis/timestreamwrite/v1beta1/zz_database_types.go @@ -109,13 +109,14 @@ type DatabaseStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Database is the Schema for the Databases API. Provides a Timestream database resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Database struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/timestreamwrite/v1beta1/zz_generated.conversion_hubs.go b/apis/timestreamwrite/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..d0bfdb8e88 --- /dev/null +++ b/apis/timestreamwrite/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Database) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Table) Hub() {} diff --git a/apis/timestreamwrite/v1beta1/zz_table_terraformed.go b/apis/timestreamwrite/v1beta1/zz_table_terraformed.go new file mode 100755 index 0000000000..b106955f78 --- /dev/null +++ b/apis/timestreamwrite/v1beta1/zz_table_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Table +func (mg *Table) GetTerraformResourceType() string { + return "aws_timestreamwrite_table" +} + +// GetConnectionDetailsMapping for this Table +func (tr *Table) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Table +func (tr *Table) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Table +func (tr *Table) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Table +func (tr *Table) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Table +func (tr *Table) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Table +func (tr *Table) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Table +func (tr *Table) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Table +func (tr *Table) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Table using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Table) LateInitialize(attrs []byte) (bool, error) { + params := &TableParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Table) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/timestreamwrite/v1beta1/zz_table_types.go b/apis/timestreamwrite/v1beta1/zz_table_types.go index f85ab8f683..d978b5ae11 100755 --- a/apis/timestreamwrite/v1beta1/zz_table_types.go +++ b/apis/timestreamwrite/v1beta1/zz_table_types.go @@ -247,13 +247,14 @@ type TableStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Table is the Schema for the Tables API. Provides a Timestream table resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Table struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/transcribe/v1beta1/zz_generated.conversion_hubs.go b/apis/transcribe/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..dd9fe14602 --- /dev/null +++ b/apis/transcribe/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *LanguageModel) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Vocabulary) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *VocabularyFilter) Hub() {} diff --git a/apis/transcribe/v1beta1/zz_generated_terraformed.go b/apis/transcribe/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 97a5fd27d3..0000000000 --- a/apis/transcribe/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this LanguageModel -func (mg *LanguageModel) GetTerraformResourceType() string { - return "aws_transcribe_language_model" -} - -// GetConnectionDetailsMapping for this LanguageModel -func (tr *LanguageModel) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this LanguageModel -func (tr *LanguageModel) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this LanguageModel -func (tr *LanguageModel) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this LanguageModel -func (tr *LanguageModel) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this LanguageModel -func (tr *LanguageModel) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this LanguageModel -func (tr *LanguageModel) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this LanguageModel -func (tr *LanguageModel) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this LanguageModel -func (tr *LanguageModel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this LanguageModel using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *LanguageModel) LateInitialize(attrs []byte) (bool, error) { - params := &LanguageModelParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *LanguageModel) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Vocabulary -func (mg *Vocabulary) GetTerraformResourceType() string { - return "aws_transcribe_vocabulary" -} - -// GetConnectionDetailsMapping for this Vocabulary -func (tr *Vocabulary) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Vocabulary -func (tr *Vocabulary) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Vocabulary -func (tr *Vocabulary) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Vocabulary -func (tr *Vocabulary) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Vocabulary -func (tr *Vocabulary) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Vocabulary -func (tr *Vocabulary) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Vocabulary -func (tr *Vocabulary) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Vocabulary -func (tr *Vocabulary) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Vocabulary using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Vocabulary) LateInitialize(attrs []byte) (bool, error) { - params := &VocabularyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Vocabulary) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this VocabularyFilter -func (mg *VocabularyFilter) GetTerraformResourceType() string { - return "aws_transcribe_vocabulary_filter" -} - -// GetConnectionDetailsMapping for this VocabularyFilter -func (tr *VocabularyFilter) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this VocabularyFilter -func (tr *VocabularyFilter) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this VocabularyFilter -func (tr *VocabularyFilter) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this VocabularyFilter -func (tr *VocabularyFilter) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this VocabularyFilter -func (tr *VocabularyFilter) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this VocabularyFilter -func (tr *VocabularyFilter) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this VocabularyFilter -func (tr *VocabularyFilter) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this VocabularyFilter -func (tr *VocabularyFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this VocabularyFilter using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *VocabularyFilter) LateInitialize(attrs []byte) (bool, error) { - params := &VocabularyFilterParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *VocabularyFilter) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/transcribe/v1beta1/zz_languagemodel_terraformed.go b/apis/transcribe/v1beta1/zz_languagemodel_terraformed.go new file mode 100755 index 0000000000..53e0f3c45c --- /dev/null +++ b/apis/transcribe/v1beta1/zz_languagemodel_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LanguageModel +func (mg *LanguageModel) GetTerraformResourceType() string { + return "aws_transcribe_language_model" +} + +// GetConnectionDetailsMapping for this LanguageModel +func (tr *LanguageModel) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LanguageModel +func (tr *LanguageModel) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LanguageModel +func (tr *LanguageModel) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LanguageModel +func (tr *LanguageModel) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LanguageModel +func (tr *LanguageModel) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LanguageModel +func (tr *LanguageModel) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this LanguageModel +func (tr *LanguageModel) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this LanguageModel +func (tr *LanguageModel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this LanguageModel using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LanguageModel) LateInitialize(attrs []byte) (bool, error) { + params := &LanguageModelParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LanguageModel) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/transcribe/v1beta1/zz_languagemodel_types.go b/apis/transcribe/v1beta1/zz_languagemodel_types.go index 944c7656d6..218d16f7c1 100755 --- a/apis/transcribe/v1beta1/zz_languagemodel_types.go +++ b/apis/transcribe/v1beta1/zz_languagemodel_types.go @@ -166,13 +166,14 @@ type LanguageModelStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // LanguageModel is the Schema for the LanguageModels API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type LanguageModel struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/transcribe/v1beta1/zz_vocabulary_terraformed.go b/apis/transcribe/v1beta1/zz_vocabulary_terraformed.go new file mode 100755 index 0000000000..41cdbd6df0 --- /dev/null +++ b/apis/transcribe/v1beta1/zz_vocabulary_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Vocabulary +func (mg *Vocabulary) GetTerraformResourceType() string { + return "aws_transcribe_vocabulary" +} + +// GetConnectionDetailsMapping for this Vocabulary +func (tr *Vocabulary) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Vocabulary +func (tr *Vocabulary) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Vocabulary +func (tr *Vocabulary) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Vocabulary +func (tr *Vocabulary) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Vocabulary +func (tr *Vocabulary) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Vocabulary +func (tr *Vocabulary) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Vocabulary +func (tr *Vocabulary) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Vocabulary +func (tr *Vocabulary) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Vocabulary using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Vocabulary) LateInitialize(attrs []byte) (bool, error) { + params := &VocabularyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Vocabulary) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/transcribe/v1beta1/zz_vocabulary_types.go b/apis/transcribe/v1beta1/zz_vocabulary_types.go index 01204e6750..d65600534d 100755 --- a/apis/transcribe/v1beta1/zz_vocabulary_types.go +++ b/apis/transcribe/v1beta1/zz_vocabulary_types.go @@ -110,13 +110,14 @@ type VocabularyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Vocabulary is the Schema for the Vocabularys API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Vocabulary struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/transcribe/v1beta1/zz_vocabularyfilter_terraformed.go b/apis/transcribe/v1beta1/zz_vocabularyfilter_terraformed.go new file mode 100755 index 0000000000..a35d4e44eb --- /dev/null +++ b/apis/transcribe/v1beta1/zz_vocabularyfilter_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this VocabularyFilter +func (mg *VocabularyFilter) GetTerraformResourceType() string { + return "aws_transcribe_vocabulary_filter" +} + +// GetConnectionDetailsMapping for this VocabularyFilter +func (tr *VocabularyFilter) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this VocabularyFilter +func (tr *VocabularyFilter) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this VocabularyFilter +func (tr *VocabularyFilter) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this VocabularyFilter +func (tr *VocabularyFilter) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this VocabularyFilter +func (tr *VocabularyFilter) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this VocabularyFilter +func (tr *VocabularyFilter) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this VocabularyFilter +func (tr *VocabularyFilter) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this VocabularyFilter +func (tr *VocabularyFilter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this VocabularyFilter using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *VocabularyFilter) LateInitialize(attrs []byte) (bool, error) { + params := &VocabularyFilterParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *VocabularyFilter) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/transcribe/v1beta1/zz_vocabularyfilter_types.go b/apis/transcribe/v1beta1/zz_vocabularyfilter_types.go index 1a4d5e491f..7383d3ef12 100755 --- a/apis/transcribe/v1beta1/zz_vocabularyfilter_types.go +++ b/apis/transcribe/v1beta1/zz_vocabularyfilter_types.go @@ -110,13 +110,14 @@ type VocabularyFilterStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // VocabularyFilter is the Schema for the VocabularyFilters API. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type VocabularyFilter struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/transfer/v1beta1/zz_generated.conversion_hubs.go b/apis/transfer/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..8e3a20036c --- /dev/null +++ b/apis/transfer/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Server) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SSHKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Tag) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *User) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Workflow) Hub() {} diff --git a/apis/transfer/v1beta1/zz_generated_terraformed.go b/apis/transfer/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 8414c02d30..0000000000 --- a/apis/transfer/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,589 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this Server -func (mg *Server) GetTerraformResourceType() string { - return "aws_transfer_server" -} - -// GetConnectionDetailsMapping for this Server -func (tr *Server) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"host_key": "spec.forProvider.hostKeySecretRef", "post_authentication_login_banner": "spec.forProvider.postAuthenticationLoginBannerSecretRef", "pre_authentication_login_banner": "spec.forProvider.preAuthenticationLoginBannerSecretRef"} -} - -// GetObservation of this Server -func (tr *Server) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Server -func (tr *Server) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Server -func (tr *Server) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Server -func (tr *Server) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Server -func (tr *Server) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Server -func (tr *Server) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Server -func (tr *Server) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Server using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Server) LateInitialize(attrs []byte) (bool, error) { - params := &ServerParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Server) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SSHKey -func (mg *SSHKey) GetTerraformResourceType() string { - return "aws_transfer_ssh_key" -} - -// GetConnectionDetailsMapping for this SSHKey -func (tr *SSHKey) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SSHKey -func (tr *SSHKey) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SSHKey -func (tr *SSHKey) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SSHKey -func (tr *SSHKey) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SSHKey -func (tr *SSHKey) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SSHKey -func (tr *SSHKey) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SSHKey -func (tr *SSHKey) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SSHKey -func (tr *SSHKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SSHKey using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SSHKey) LateInitialize(attrs []byte) (bool, error) { - params := &SSHKeyParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SSHKey) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Tag -func (mg *Tag) GetTerraformResourceType() string { - return "aws_transfer_tag" -} - -// GetConnectionDetailsMapping for this Tag -func (tr *Tag) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Tag -func (tr *Tag) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Tag -func (tr *Tag) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Tag -func (tr *Tag) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Tag -func (tr *Tag) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Tag -func (tr *Tag) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Tag -func (tr *Tag) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Tag -func (tr *Tag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Tag using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Tag) LateInitialize(attrs []byte) (bool, error) { - params := &TagParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Tag) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this User -func (mg *User) GetTerraformResourceType() string { - return "aws_transfer_user" -} - -// GetConnectionDetailsMapping for this User -func (tr *User) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this User -func (tr *User) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this User -func (tr *User) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this User -func (tr *User) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this User -func (tr *User) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this User -func (tr *User) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this User -func (tr *User) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this User -func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this User using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *User) LateInitialize(attrs []byte) (bool, error) { - params := &UserParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *User) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Workflow -func (mg *Workflow) GetTerraformResourceType() string { - return "aws_transfer_workflow" -} - -// GetConnectionDetailsMapping for this Workflow -func (tr *Workflow) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Workflow -func (tr *Workflow) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Workflow -func (tr *Workflow) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Workflow -func (tr *Workflow) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Workflow -func (tr *Workflow) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Workflow -func (tr *Workflow) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Workflow -func (tr *Workflow) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Workflow -func (tr *Workflow) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Workflow using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Workflow) LateInitialize(attrs []byte) (bool, error) { - params := &WorkflowParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Workflow) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/transfer/v1beta1/zz_server_terraformed.go b/apis/transfer/v1beta1/zz_server_terraformed.go new file mode 100755 index 0000000000..b5553d8099 --- /dev/null +++ b/apis/transfer/v1beta1/zz_server_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Server +func (mg *Server) GetTerraformResourceType() string { + return "aws_transfer_server" +} + +// GetConnectionDetailsMapping for this Server +func (tr *Server) GetConnectionDetailsMapping() map[string]string { + return map[string]string{"host_key": "spec.forProvider.hostKeySecretRef", "post_authentication_login_banner": "spec.forProvider.postAuthenticationLoginBannerSecretRef", "pre_authentication_login_banner": "spec.forProvider.preAuthenticationLoginBannerSecretRef"} +} + +// GetObservation of this Server +func (tr *Server) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Server +func (tr *Server) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Server +func (tr *Server) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Server +func (tr *Server) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Server +func (tr *Server) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Server +func (tr *Server) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Server +func (tr *Server) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Server using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Server) LateInitialize(attrs []byte) (bool, error) { + params := &ServerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Server) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/transfer/v1beta1/zz_server_types.go b/apis/transfer/v1beta1/zz_server_types.go index f43215de68..88d9decfdc 100755 --- a/apis/transfer/v1beta1/zz_server_types.go +++ b/apis/transfer/v1beta1/zz_server_types.go @@ -516,13 +516,14 @@ type ServerStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Server is the Schema for the Servers API. Provides a AWS Transfer Server resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Server struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/transfer/v1beta1/zz_sshkey_terraformed.go b/apis/transfer/v1beta1/zz_sshkey_terraformed.go new file mode 100755 index 0000000000..d53e8188e6 --- /dev/null +++ b/apis/transfer/v1beta1/zz_sshkey_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SSHKey +func (mg *SSHKey) GetTerraformResourceType() string { + return "aws_transfer_ssh_key" +} + +// GetConnectionDetailsMapping for this SSHKey +func (tr *SSHKey) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SSHKey +func (tr *SSHKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SSHKey +func (tr *SSHKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SSHKey +func (tr *SSHKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SSHKey +func (tr *SSHKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SSHKey +func (tr *SSHKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SSHKey +func (tr *SSHKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SSHKey +func (tr *SSHKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SSHKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SSHKey) LateInitialize(attrs []byte) (bool, error) { + params := &SSHKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SSHKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/transfer/v1beta1/zz_sshkey_types.go b/apis/transfer/v1beta1/zz_sshkey_types.go index c33fbf94de..714911d21c 100755 --- a/apis/transfer/v1beta1/zz_sshkey_types.go +++ b/apis/transfer/v1beta1/zz_sshkey_types.go @@ -125,13 +125,14 @@ type SSHKeyStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SSHKey is the Schema for the SSHKeys API. Provides a AWS Transfer SSH Public Key resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SSHKey struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/transfer/v1beta1/zz_tag_terraformed.go b/apis/transfer/v1beta1/zz_tag_terraformed.go new file mode 100755 index 0000000000..72548c3df9 --- /dev/null +++ b/apis/transfer/v1beta1/zz_tag_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Tag +func (mg *Tag) GetTerraformResourceType() string { + return "aws_transfer_tag" +} + +// GetConnectionDetailsMapping for this Tag +func (tr *Tag) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Tag +func (tr *Tag) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Tag +func (tr *Tag) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Tag +func (tr *Tag) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Tag +func (tr *Tag) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Tag +func (tr *Tag) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Tag +func (tr *Tag) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Tag +func (tr *Tag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Tag using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Tag) LateInitialize(attrs []byte) (bool, error) { + params := &TagParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Tag) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/transfer/v1beta1/zz_tag_types.go b/apis/transfer/v1beta1/zz_tag_types.go index a9b951bb08..e4b727268d 100755 --- a/apis/transfer/v1beta1/zz_tag_types.go +++ b/apis/transfer/v1beta1/zz_tag_types.go @@ -108,13 +108,14 @@ type TagStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Tag is the Schema for the Tags API. Manages an individual Transfer Family resource tag // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Tag struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/transfer/v1beta1/zz_user_terraformed.go b/apis/transfer/v1beta1/zz_user_terraformed.go new file mode 100755 index 0000000000..3f6a647cf1 --- /dev/null +++ b/apis/transfer/v1beta1/zz_user_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this User +func (mg *User) GetTerraformResourceType() string { + return "aws_transfer_user" +} + +// GetConnectionDetailsMapping for this User +func (tr *User) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this User +func (tr *User) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this User +func (tr *User) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this User +func (tr *User) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this User +func (tr *User) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this User +func (tr *User) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this User +func (tr *User) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this User +func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this User using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *User) LateInitialize(attrs []byte) (bool, error) { + params := &UserParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *User) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/transfer/v1beta1/zz_user_types.go b/apis/transfer/v1beta1/zz_user_types.go index d3b3303648..ec58fea509 100755 --- a/apis/transfer/v1beta1/zz_user_types.go +++ b/apis/transfer/v1beta1/zz_user_types.go @@ -256,13 +256,14 @@ type UserStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // User is the Schema for the Users API. Provides a AWS Transfer User resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type User struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/transfer/v1beta1/zz_workflow_terraformed.go b/apis/transfer/v1beta1/zz_workflow_terraformed.go new file mode 100755 index 0000000000..d8ed7bb87a --- /dev/null +++ b/apis/transfer/v1beta1/zz_workflow_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Workflow +func (mg *Workflow) GetTerraformResourceType() string { + return "aws_transfer_workflow" +} + +// GetConnectionDetailsMapping for this Workflow +func (tr *Workflow) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Workflow +func (tr *Workflow) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Workflow +func (tr *Workflow) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Workflow +func (tr *Workflow) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Workflow +func (tr *Workflow) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Workflow +func (tr *Workflow) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Workflow +func (tr *Workflow) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Workflow +func (tr *Workflow) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Workflow using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Workflow) LateInitialize(attrs []byte) (bool, error) { + params := &WorkflowParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Workflow) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/transfer/v1beta1/zz_workflow_types.go b/apis/transfer/v1beta1/zz_workflow_types.go index 0d9a50ce93..6c28b3cfd2 100755 --- a/apis/transfer/v1beta1/zz_workflow_types.go +++ b/apis/transfer/v1beta1/zz_workflow_types.go @@ -1122,13 +1122,14 @@ type WorkflowStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Workflow is the Schema for the Workflows API. Provides a AWS Transfer Workflow resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Workflow struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/vpc/v1beta1/zz_generated.conversion_hubs.go b/apis/vpc/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..62be635cc9 --- /dev/null +++ b/apis/vpc/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *NetworkPerformanceMetricSubscription) Hub() {} diff --git a/apis/vpc/v1beta1/zz_generated_terraformed.go b/apis/vpc/v1beta1/zz_networkperformancemetricsubscription_terraformed.go similarity index 100% rename from apis/vpc/v1beta1/zz_generated_terraformed.go rename to apis/vpc/v1beta1/zz_networkperformancemetricsubscription_terraformed.go diff --git a/apis/vpc/v1beta1/zz_networkperformancemetricsubscription_types.go b/apis/vpc/v1beta1/zz_networkperformancemetricsubscription_types.go index 01d45578d9..715fcd0af0 100755 --- a/apis/vpc/v1beta1/zz_networkperformancemetricsubscription_types.go +++ b/apis/vpc/v1beta1/zz_networkperformancemetricsubscription_types.go @@ -100,13 +100,14 @@ type NetworkPerformanceMetricSubscriptionStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // NetworkPerformanceMetricSubscription is the Schema for the NetworkPerformanceMetricSubscriptions API. Provides a resource to manage an Infrastructure Performance subscription. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type NetworkPerformanceMetricSubscription struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/waf/v1beta1/zz_bytematchset_terraformed.go b/apis/waf/v1beta1/zz_bytematchset_terraformed.go new file mode 100755 index 0000000000..eefc439c6a --- /dev/null +++ b/apis/waf/v1beta1/zz_bytematchset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ByteMatchSet +func (mg *ByteMatchSet) GetTerraformResourceType() string { + return "aws_waf_byte_match_set" +} + +// GetConnectionDetailsMapping for this ByteMatchSet +func (tr *ByteMatchSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ByteMatchSet +func (tr *ByteMatchSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ByteMatchSet +func (tr *ByteMatchSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ByteMatchSet +func (tr *ByteMatchSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ByteMatchSet +func (tr *ByteMatchSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ByteMatchSet +func (tr *ByteMatchSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ByteMatchSet +func (tr *ByteMatchSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ByteMatchSet +func (tr *ByteMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ByteMatchSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ByteMatchSet) LateInitialize(attrs []byte) (bool, error) { + params := &ByteMatchSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ByteMatchSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/waf/v1beta1/zz_bytematchset_types.go b/apis/waf/v1beta1/zz_bytematchset_types.go index b44d285612..7c0f8085ad 100755 --- a/apis/waf/v1beta1/zz_bytematchset_types.go +++ b/apis/waf/v1beta1/zz_bytematchset_types.go @@ -204,13 +204,14 @@ type ByteMatchSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ByteMatchSet is the Schema for the ByteMatchSets API. Provides a AWS WAF Byte Match Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ByteMatchSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/waf/v1beta1/zz_generated.conversion_hubs.go b/apis/waf/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..a1bbe3813a --- /dev/null +++ b/apis/waf/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ByteMatchSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GeoMatchSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *IPSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RateBasedRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RegexMatchSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RegexPatternSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Rule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SizeConstraintSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SQLInjectionMatchSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *WebACL) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *XSSMatchSet) Hub() {} diff --git a/apis/waf/v1beta1/zz_generated_terraformed.go b/apis/waf/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 9cd7063c38..0000000000 --- a/apis/waf/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1273 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this ByteMatchSet -func (mg *ByteMatchSet) GetTerraformResourceType() string { - return "aws_waf_byte_match_set" -} - -// GetConnectionDetailsMapping for this ByteMatchSet -func (tr *ByteMatchSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ByteMatchSet -func (tr *ByteMatchSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ByteMatchSet -func (tr *ByteMatchSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ByteMatchSet -func (tr *ByteMatchSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ByteMatchSet -func (tr *ByteMatchSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ByteMatchSet -func (tr *ByteMatchSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ByteMatchSet -func (tr *ByteMatchSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ByteMatchSet -func (tr *ByteMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ByteMatchSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ByteMatchSet) LateInitialize(attrs []byte) (bool, error) { - params := &ByteMatchSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ByteMatchSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GeoMatchSet -func (mg *GeoMatchSet) GetTerraformResourceType() string { - return "aws_waf_geo_match_set" -} - -// GetConnectionDetailsMapping for this GeoMatchSet -func (tr *GeoMatchSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GeoMatchSet -func (tr *GeoMatchSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GeoMatchSet -func (tr *GeoMatchSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GeoMatchSet -func (tr *GeoMatchSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GeoMatchSet -func (tr *GeoMatchSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GeoMatchSet -func (tr *GeoMatchSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GeoMatchSet -func (tr *GeoMatchSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GeoMatchSet -func (tr *GeoMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GeoMatchSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GeoMatchSet) LateInitialize(attrs []byte) (bool, error) { - params := &GeoMatchSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GeoMatchSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this IPSet -func (mg *IPSet) GetTerraformResourceType() string { - return "aws_waf_ipset" -} - -// GetConnectionDetailsMapping for this IPSet -func (tr *IPSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this IPSet -func (tr *IPSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this IPSet -func (tr *IPSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this IPSet -func (tr *IPSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this IPSet -func (tr *IPSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this IPSet -func (tr *IPSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this IPSet -func (tr *IPSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this IPSet -func (tr *IPSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this IPSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *IPSet) LateInitialize(attrs []byte) (bool, error) { - params := &IPSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *IPSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RateBasedRule -func (mg *RateBasedRule) GetTerraformResourceType() string { - return "aws_waf_rate_based_rule" -} - -// GetConnectionDetailsMapping for this RateBasedRule -func (tr *RateBasedRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RateBasedRule -func (tr *RateBasedRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RateBasedRule -func (tr *RateBasedRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RateBasedRule -func (tr *RateBasedRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RateBasedRule -func (tr *RateBasedRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RateBasedRule -func (tr *RateBasedRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RateBasedRule -func (tr *RateBasedRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RateBasedRule -func (tr *RateBasedRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RateBasedRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RateBasedRule) LateInitialize(attrs []byte) (bool, error) { - params := &RateBasedRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RateBasedRule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RegexMatchSet -func (mg *RegexMatchSet) GetTerraformResourceType() string { - return "aws_waf_regex_match_set" -} - -// GetConnectionDetailsMapping for this RegexMatchSet -func (tr *RegexMatchSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RegexMatchSet -func (tr *RegexMatchSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RegexMatchSet -func (tr *RegexMatchSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RegexMatchSet -func (tr *RegexMatchSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RegexMatchSet -func (tr *RegexMatchSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RegexMatchSet -func (tr *RegexMatchSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RegexMatchSet -func (tr *RegexMatchSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RegexMatchSet -func (tr *RegexMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RegexMatchSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RegexMatchSet) LateInitialize(attrs []byte) (bool, error) { - params := &RegexMatchSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RegexMatchSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RegexPatternSet -func (mg *RegexPatternSet) GetTerraformResourceType() string { - return "aws_waf_regex_pattern_set" -} - -// GetConnectionDetailsMapping for this RegexPatternSet -func (tr *RegexPatternSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RegexPatternSet -func (tr *RegexPatternSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RegexPatternSet -func (tr *RegexPatternSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RegexPatternSet -func (tr *RegexPatternSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RegexPatternSet -func (tr *RegexPatternSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RegexPatternSet -func (tr *RegexPatternSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RegexPatternSet -func (tr *RegexPatternSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RegexPatternSet -func (tr *RegexPatternSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RegexPatternSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RegexPatternSet) LateInitialize(attrs []byte) (bool, error) { - params := &RegexPatternSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RegexPatternSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Rule -func (mg *Rule) GetTerraformResourceType() string { - return "aws_waf_rule" -} - -// GetConnectionDetailsMapping for this Rule -func (tr *Rule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Rule -func (tr *Rule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Rule -func (tr *Rule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Rule -func (tr *Rule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Rule -func (tr *Rule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Rule -func (tr *Rule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Rule -func (tr *Rule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Rule -func (tr *Rule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Rule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Rule) LateInitialize(attrs []byte) (bool, error) { - params := &RuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Rule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SizeConstraintSet -func (mg *SizeConstraintSet) GetTerraformResourceType() string { - return "aws_waf_size_constraint_set" -} - -// GetConnectionDetailsMapping for this SizeConstraintSet -func (tr *SizeConstraintSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SizeConstraintSet -func (tr *SizeConstraintSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SizeConstraintSet -func (tr *SizeConstraintSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SizeConstraintSet -func (tr *SizeConstraintSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SizeConstraintSet -func (tr *SizeConstraintSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SizeConstraintSet -func (tr *SizeConstraintSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SizeConstraintSet -func (tr *SizeConstraintSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SizeConstraintSet -func (tr *SizeConstraintSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SizeConstraintSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SizeConstraintSet) LateInitialize(attrs []byte) (bool, error) { - params := &SizeConstraintSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SizeConstraintSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SQLInjectionMatchSet -func (mg *SQLInjectionMatchSet) GetTerraformResourceType() string { - return "aws_waf_sql_injection_match_set" -} - -// GetConnectionDetailsMapping for this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SQLInjectionMatchSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SQLInjectionMatchSet) LateInitialize(attrs []byte) (bool, error) { - params := &SQLInjectionMatchSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SQLInjectionMatchSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this WebACL -func (mg *WebACL) GetTerraformResourceType() string { - return "aws_waf_web_acl" -} - -// GetConnectionDetailsMapping for this WebACL -func (tr *WebACL) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this WebACL -func (tr *WebACL) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this WebACL -func (tr *WebACL) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this WebACL -func (tr *WebACL) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this WebACL -func (tr *WebACL) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this WebACL -func (tr *WebACL) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this WebACL -func (tr *WebACL) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this WebACL -func (tr *WebACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this WebACL using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *WebACL) LateInitialize(attrs []byte) (bool, error) { - params := &WebACLParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *WebACL) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this XSSMatchSet -func (mg *XSSMatchSet) GetTerraformResourceType() string { - return "aws_waf_xss_match_set" -} - -// GetConnectionDetailsMapping for this XSSMatchSet -func (tr *XSSMatchSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this XSSMatchSet -func (tr *XSSMatchSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this XSSMatchSet -func (tr *XSSMatchSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this XSSMatchSet -func (tr *XSSMatchSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this XSSMatchSet -func (tr *XSSMatchSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this XSSMatchSet -func (tr *XSSMatchSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this XSSMatchSet -func (tr *XSSMatchSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this XSSMatchSet -func (tr *XSSMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this XSSMatchSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *XSSMatchSet) LateInitialize(attrs []byte) (bool, error) { - params := &XSSMatchSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *XSSMatchSet) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/waf/v1beta1/zz_geomatchset_terraformed.go b/apis/waf/v1beta1/zz_geomatchset_terraformed.go new file mode 100755 index 0000000000..838883d599 --- /dev/null +++ b/apis/waf/v1beta1/zz_geomatchset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GeoMatchSet +func (mg *GeoMatchSet) GetTerraformResourceType() string { + return "aws_waf_geo_match_set" +} + +// GetConnectionDetailsMapping for this GeoMatchSet +func (tr *GeoMatchSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GeoMatchSet +func (tr *GeoMatchSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GeoMatchSet +func (tr *GeoMatchSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GeoMatchSet +func (tr *GeoMatchSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GeoMatchSet +func (tr *GeoMatchSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GeoMatchSet +func (tr *GeoMatchSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GeoMatchSet +func (tr *GeoMatchSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GeoMatchSet +func (tr *GeoMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GeoMatchSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GeoMatchSet) LateInitialize(attrs []byte) (bool, error) { + params := &GeoMatchSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GeoMatchSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/waf/v1beta1/zz_geomatchset_types.go b/apis/waf/v1beta1/zz_geomatchset_types.go index 84c68a1f76..14ef831d12 100755 --- a/apis/waf/v1beta1/zz_geomatchset_types.go +++ b/apis/waf/v1beta1/zz_geomatchset_types.go @@ -116,13 +116,14 @@ type GeoMatchSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GeoMatchSet is the Schema for the GeoMatchSets API. Provides a AWS WAF GeoMatchSet resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GeoMatchSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/waf/v1beta1/zz_ipset_terraformed.go b/apis/waf/v1beta1/zz_ipset_terraformed.go new file mode 100755 index 0000000000..4f1f7e4f29 --- /dev/null +++ b/apis/waf/v1beta1/zz_ipset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this IPSet +func (mg *IPSet) GetTerraformResourceType() string { + return "aws_waf_ipset" +} + +// GetConnectionDetailsMapping for this IPSet +func (tr *IPSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this IPSet +func (tr *IPSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this IPSet +func (tr *IPSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this IPSet +func (tr *IPSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this IPSet +func (tr *IPSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this IPSet +func (tr *IPSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this IPSet +func (tr *IPSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this IPSet +func (tr *IPSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this IPSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *IPSet) LateInitialize(attrs []byte) (bool, error) { + params := &IPSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *IPSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/waf/v1beta1/zz_ipset_types.go b/apis/waf/v1beta1/zz_ipset_types.go index eb8fa043b5..8a05898f7b 100755 --- a/apis/waf/v1beta1/zz_ipset_types.go +++ b/apis/waf/v1beta1/zz_ipset_types.go @@ -110,13 +110,14 @@ type IPSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IPSet is the Schema for the IPSets API. Provides a AWS WAF IPSet resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type IPSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/waf/v1beta1/zz_ratebasedrule_terraformed.go b/apis/waf/v1beta1/zz_ratebasedrule_terraformed.go new file mode 100755 index 0000000000..2452e59d85 --- /dev/null +++ b/apis/waf/v1beta1/zz_ratebasedrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RateBasedRule +func (mg *RateBasedRule) GetTerraformResourceType() string { + return "aws_waf_rate_based_rule" +} + +// GetConnectionDetailsMapping for this RateBasedRule +func (tr *RateBasedRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RateBasedRule +func (tr *RateBasedRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RateBasedRule +func (tr *RateBasedRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RateBasedRule +func (tr *RateBasedRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RateBasedRule +func (tr *RateBasedRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RateBasedRule +func (tr *RateBasedRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RateBasedRule +func (tr *RateBasedRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RateBasedRule +func (tr *RateBasedRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RateBasedRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RateBasedRule) LateInitialize(attrs []byte) (bool, error) { + params := &RateBasedRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RateBasedRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/waf/v1beta1/zz_ratebasedrule_types.go b/apis/waf/v1beta1/zz_ratebasedrule_types.go index 261e68615f..1e155f4037 100755 --- a/apis/waf/v1beta1/zz_ratebasedrule_types.go +++ b/apis/waf/v1beta1/zz_ratebasedrule_types.go @@ -196,13 +196,14 @@ type RateBasedRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RateBasedRule is the Schema for the RateBasedRules API. Provides a AWS WAF rule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RateBasedRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/waf/v1beta1/zz_regexmatchset_terraformed.go b/apis/waf/v1beta1/zz_regexmatchset_terraformed.go new file mode 100755 index 0000000000..3c5e4f17ce --- /dev/null +++ b/apis/waf/v1beta1/zz_regexmatchset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RegexMatchSet +func (mg *RegexMatchSet) GetTerraformResourceType() string { + return "aws_waf_regex_match_set" +} + +// GetConnectionDetailsMapping for this RegexMatchSet +func (tr *RegexMatchSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RegexMatchSet +func (tr *RegexMatchSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RegexMatchSet +func (tr *RegexMatchSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RegexMatchSet +func (tr *RegexMatchSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RegexMatchSet +func (tr *RegexMatchSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RegexMatchSet +func (tr *RegexMatchSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RegexMatchSet +func (tr *RegexMatchSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RegexMatchSet +func (tr *RegexMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RegexMatchSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RegexMatchSet) LateInitialize(attrs []byte) (bool, error) { + params := &RegexMatchSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RegexMatchSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/waf/v1beta1/zz_regexmatchset_types.go b/apis/waf/v1beta1/zz_regexmatchset_types.go index cc09e138fd..294c506579 100755 --- a/apis/waf/v1beta1/zz_regexmatchset_types.go +++ b/apis/waf/v1beta1/zz_regexmatchset_types.go @@ -190,13 +190,14 @@ type RegexMatchSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RegexMatchSet is the Schema for the RegexMatchSets API. Provides a AWS WAF Regex Match Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RegexMatchSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/waf/v1beta1/zz_regexpatternset_terraformed.go b/apis/waf/v1beta1/zz_regexpatternset_terraformed.go new file mode 100755 index 0000000000..25ec4c344a --- /dev/null +++ b/apis/waf/v1beta1/zz_regexpatternset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RegexPatternSet +func (mg *RegexPatternSet) GetTerraformResourceType() string { + return "aws_waf_regex_pattern_set" +} + +// GetConnectionDetailsMapping for this RegexPatternSet +func (tr *RegexPatternSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RegexPatternSet +func (tr *RegexPatternSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RegexPatternSet +func (tr *RegexPatternSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RegexPatternSet +func (tr *RegexPatternSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RegexPatternSet +func (tr *RegexPatternSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RegexPatternSet +func (tr *RegexPatternSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RegexPatternSet +func (tr *RegexPatternSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RegexPatternSet +func (tr *RegexPatternSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RegexPatternSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RegexPatternSet) LateInitialize(attrs []byte) (bool, error) { + params := &RegexPatternSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RegexPatternSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/waf/v1beta1/zz_regexpatternset_types.go b/apis/waf/v1beta1/zz_regexpatternset_types.go index 097553d122..f79a897ba1 100755 --- a/apis/waf/v1beta1/zz_regexpatternset_types.go +++ b/apis/waf/v1beta1/zz_regexpatternset_types.go @@ -84,13 +84,14 @@ type RegexPatternSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RegexPatternSet is the Schema for the RegexPatternSets API. Provides a AWS WAF Regex Pattern Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RegexPatternSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/waf/v1beta1/zz_rule_terraformed.go b/apis/waf/v1beta1/zz_rule_terraformed.go new file mode 100755 index 0000000000..52383a0330 --- /dev/null +++ b/apis/waf/v1beta1/zz_rule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Rule +func (mg *Rule) GetTerraformResourceType() string { + return "aws_waf_rule" +} + +// GetConnectionDetailsMapping for this Rule +func (tr *Rule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Rule +func (tr *Rule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Rule +func (tr *Rule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Rule +func (tr *Rule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Rule +func (tr *Rule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Rule +func (tr *Rule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Rule +func (tr *Rule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Rule +func (tr *Rule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Rule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Rule) LateInitialize(attrs []byte) (bool, error) { + params := &RuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Rule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/waf/v1beta1/zz_rule_types.go b/apis/waf/v1beta1/zz_rule_types.go index a6f84fb010..75d7bb9c51 100755 --- a/apis/waf/v1beta1/zz_rule_types.go +++ b/apis/waf/v1beta1/zz_rule_types.go @@ -176,13 +176,14 @@ type RuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Rule is the Schema for the Rules API. Provides a AWS WAF rule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Rule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/waf/v1beta1/zz_sizeconstraintset_terraformed.go b/apis/waf/v1beta1/zz_sizeconstraintset_terraformed.go new file mode 100755 index 0000000000..49916a64ce --- /dev/null +++ b/apis/waf/v1beta1/zz_sizeconstraintset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SizeConstraintSet +func (mg *SizeConstraintSet) GetTerraformResourceType() string { + return "aws_waf_size_constraint_set" +} + +// GetConnectionDetailsMapping for this SizeConstraintSet +func (tr *SizeConstraintSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SizeConstraintSet +func (tr *SizeConstraintSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SizeConstraintSet +func (tr *SizeConstraintSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SizeConstraintSet +func (tr *SizeConstraintSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SizeConstraintSet +func (tr *SizeConstraintSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SizeConstraintSet +func (tr *SizeConstraintSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SizeConstraintSet +func (tr *SizeConstraintSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SizeConstraintSet +func (tr *SizeConstraintSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SizeConstraintSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SizeConstraintSet) LateInitialize(attrs []byte) (bool, error) { + params := &SizeConstraintSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SizeConstraintSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/waf/v1beta1/zz_sizeconstraintset_types.go b/apis/waf/v1beta1/zz_sizeconstraintset_types.go index ab4a2700cb..c7bf43f89b 100755 --- a/apis/waf/v1beta1/zz_sizeconstraintset_types.go +++ b/apis/waf/v1beta1/zz_sizeconstraintset_types.go @@ -195,13 +195,14 @@ type SizeConstraintSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SizeConstraintSet is the Schema for the SizeConstraintSets API. Provides a AWS WAF Size Constraint Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SizeConstraintSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/waf/v1beta1/zz_sqlinjectionmatchset_terraformed.go b/apis/waf/v1beta1/zz_sqlinjectionmatchset_terraformed.go new file mode 100755 index 0000000000..4cedd7c5d6 --- /dev/null +++ b/apis/waf/v1beta1/zz_sqlinjectionmatchset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SQLInjectionMatchSet +func (mg *SQLInjectionMatchSet) GetTerraformResourceType() string { + return "aws_waf_sql_injection_match_set" +} + +// GetConnectionDetailsMapping for this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SQLInjectionMatchSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SQLInjectionMatchSet) LateInitialize(attrs []byte) (bool, error) { + params := &SQLInjectionMatchSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SQLInjectionMatchSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/waf/v1beta1/zz_sqlinjectionmatchset_types.go b/apis/waf/v1beta1/zz_sqlinjectionmatchset_types.go index 970c59f3df..2cd6644339 100755 --- a/apis/waf/v1beta1/zz_sqlinjectionmatchset_types.go +++ b/apis/waf/v1beta1/zz_sqlinjectionmatchset_types.go @@ -160,13 +160,14 @@ type SQLInjectionMatchSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SQLInjectionMatchSet is the Schema for the SQLInjectionMatchSets API. Provides a AWS WAF SQL Injection Match Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SQLInjectionMatchSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/waf/v1beta1/zz_webacl_terraformed.go b/apis/waf/v1beta1/zz_webacl_terraformed.go new file mode 100755 index 0000000000..9c477ccbee --- /dev/null +++ b/apis/waf/v1beta1/zz_webacl_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this WebACL +func (mg *WebACL) GetTerraformResourceType() string { + return "aws_waf_web_acl" +} + +// GetConnectionDetailsMapping for this WebACL +func (tr *WebACL) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this WebACL +func (tr *WebACL) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this WebACL +func (tr *WebACL) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this WebACL +func (tr *WebACL) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this WebACL +func (tr *WebACL) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this WebACL +func (tr *WebACL) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this WebACL +func (tr *WebACL) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this WebACL +func (tr *WebACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this WebACL using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *WebACL) LateInitialize(attrs []byte) (bool, error) { + params := &WebACLParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *WebACL) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/waf/v1beta1/zz_webacl_types.go b/apis/waf/v1beta1/zz_webacl_types.go index 798e64d98f..e72d4bbb89 100755 --- a/apis/waf/v1beta1/zz_webacl_types.go +++ b/apis/waf/v1beta1/zz_webacl_types.go @@ -367,13 +367,14 @@ type WebACLStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // WebACL is the Schema for the WebACLs API. Provides a AWS WAF web access control group (ACL) resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type WebACL struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/waf/v1beta1/zz_xssmatchset_terraformed.go b/apis/waf/v1beta1/zz_xssmatchset_terraformed.go new file mode 100755 index 0000000000..54fb083200 --- /dev/null +++ b/apis/waf/v1beta1/zz_xssmatchset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this XSSMatchSet +func (mg *XSSMatchSet) GetTerraformResourceType() string { + return "aws_waf_xss_match_set" +} + +// GetConnectionDetailsMapping for this XSSMatchSet +func (tr *XSSMatchSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this XSSMatchSet +func (tr *XSSMatchSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this XSSMatchSet +func (tr *XSSMatchSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this XSSMatchSet +func (tr *XSSMatchSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this XSSMatchSet +func (tr *XSSMatchSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this XSSMatchSet +func (tr *XSSMatchSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this XSSMatchSet +func (tr *XSSMatchSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this XSSMatchSet +func (tr *XSSMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this XSSMatchSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *XSSMatchSet) LateInitialize(attrs []byte) (bool, error) { + params := &XSSMatchSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *XSSMatchSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/waf/v1beta1/zz_xssmatchset_types.go b/apis/waf/v1beta1/zz_xssmatchset_types.go index e64509c38c..9892b48e21 100755 --- a/apis/waf/v1beta1/zz_xssmatchset_types.go +++ b/apis/waf/v1beta1/zz_xssmatchset_types.go @@ -163,13 +163,14 @@ type XSSMatchSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // XSSMatchSet is the Schema for the XSSMatchSets API. Provides a AWS WAF XssMatchSet resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type XSSMatchSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafregional/v1beta1/zz_bytematchset_terraformed.go b/apis/wafregional/v1beta1/zz_bytematchset_terraformed.go new file mode 100755 index 0000000000..c689b5ffe4 --- /dev/null +++ b/apis/wafregional/v1beta1/zz_bytematchset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ByteMatchSet +func (mg *ByteMatchSet) GetTerraformResourceType() string { + return "aws_wafregional_byte_match_set" +} + +// GetConnectionDetailsMapping for this ByteMatchSet +func (tr *ByteMatchSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ByteMatchSet +func (tr *ByteMatchSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ByteMatchSet +func (tr *ByteMatchSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ByteMatchSet +func (tr *ByteMatchSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ByteMatchSet +func (tr *ByteMatchSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ByteMatchSet +func (tr *ByteMatchSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ByteMatchSet +func (tr *ByteMatchSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ByteMatchSet +func (tr *ByteMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ByteMatchSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ByteMatchSet) LateInitialize(attrs []byte) (bool, error) { + params := &ByteMatchSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ByteMatchSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafregional/v1beta1/zz_bytematchset_types.go b/apis/wafregional/v1beta1/zz_bytematchset_types.go index c8fded22f5..9e9f4bb6de 100755 --- a/apis/wafregional/v1beta1/zz_bytematchset_types.go +++ b/apis/wafregional/v1beta1/zz_bytematchset_types.go @@ -156,13 +156,14 @@ type ByteMatchSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // ByteMatchSet is the Schema for the ByteMatchSets API. Provides a AWS WAF Regional ByteMatchSet resource for use with ALB. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type ByteMatchSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafregional/v1beta1/zz_generated.conversion_hubs.go b/apis/wafregional/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..a1bbe3813a --- /dev/null +++ b/apis/wafregional/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *ByteMatchSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *GeoMatchSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *IPSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RateBasedRule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RegexMatchSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RegexPatternSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Rule) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SizeConstraintSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SQLInjectionMatchSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *WebACL) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *XSSMatchSet) Hub() {} diff --git a/apis/wafregional/v1beta1/zz_generated_terraformed.go b/apis/wafregional/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index 3fe15b4deb..0000000000 --- a/apis/wafregional/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,1273 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this ByteMatchSet -func (mg *ByteMatchSet) GetTerraformResourceType() string { - return "aws_wafregional_byte_match_set" -} - -// GetConnectionDetailsMapping for this ByteMatchSet -func (tr *ByteMatchSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this ByteMatchSet -func (tr *ByteMatchSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this ByteMatchSet -func (tr *ByteMatchSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this ByteMatchSet -func (tr *ByteMatchSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this ByteMatchSet -func (tr *ByteMatchSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this ByteMatchSet -func (tr *ByteMatchSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this ByteMatchSet -func (tr *ByteMatchSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this ByteMatchSet -func (tr *ByteMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this ByteMatchSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *ByteMatchSet) LateInitialize(attrs []byte) (bool, error) { - params := &ByteMatchSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *ByteMatchSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this GeoMatchSet -func (mg *GeoMatchSet) GetTerraformResourceType() string { - return "aws_wafregional_geo_match_set" -} - -// GetConnectionDetailsMapping for this GeoMatchSet -func (tr *GeoMatchSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this GeoMatchSet -func (tr *GeoMatchSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this GeoMatchSet -func (tr *GeoMatchSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this GeoMatchSet -func (tr *GeoMatchSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this GeoMatchSet -func (tr *GeoMatchSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this GeoMatchSet -func (tr *GeoMatchSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this GeoMatchSet -func (tr *GeoMatchSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this GeoMatchSet -func (tr *GeoMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this GeoMatchSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GeoMatchSet) LateInitialize(attrs []byte) (bool, error) { - params := &GeoMatchSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *GeoMatchSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this IPSet -func (mg *IPSet) GetTerraformResourceType() string { - return "aws_wafregional_ipset" -} - -// GetConnectionDetailsMapping for this IPSet -func (tr *IPSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this IPSet -func (tr *IPSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this IPSet -func (tr *IPSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this IPSet -func (tr *IPSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this IPSet -func (tr *IPSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this IPSet -func (tr *IPSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this IPSet -func (tr *IPSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this IPSet -func (tr *IPSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this IPSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *IPSet) LateInitialize(attrs []byte) (bool, error) { - params := &IPSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *IPSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RateBasedRule -func (mg *RateBasedRule) GetTerraformResourceType() string { - return "aws_wafregional_rate_based_rule" -} - -// GetConnectionDetailsMapping for this RateBasedRule -func (tr *RateBasedRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RateBasedRule -func (tr *RateBasedRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RateBasedRule -func (tr *RateBasedRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RateBasedRule -func (tr *RateBasedRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RateBasedRule -func (tr *RateBasedRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RateBasedRule -func (tr *RateBasedRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RateBasedRule -func (tr *RateBasedRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RateBasedRule -func (tr *RateBasedRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RateBasedRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RateBasedRule) LateInitialize(attrs []byte) (bool, error) { - params := &RateBasedRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RateBasedRule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RegexMatchSet -func (mg *RegexMatchSet) GetTerraformResourceType() string { - return "aws_wafregional_regex_match_set" -} - -// GetConnectionDetailsMapping for this RegexMatchSet -func (tr *RegexMatchSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RegexMatchSet -func (tr *RegexMatchSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RegexMatchSet -func (tr *RegexMatchSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RegexMatchSet -func (tr *RegexMatchSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RegexMatchSet -func (tr *RegexMatchSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RegexMatchSet -func (tr *RegexMatchSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RegexMatchSet -func (tr *RegexMatchSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RegexMatchSet -func (tr *RegexMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RegexMatchSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RegexMatchSet) LateInitialize(attrs []byte) (bool, error) { - params := &RegexMatchSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RegexMatchSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this RegexPatternSet -func (mg *RegexPatternSet) GetTerraformResourceType() string { - return "aws_wafregional_regex_pattern_set" -} - -// GetConnectionDetailsMapping for this RegexPatternSet -func (tr *RegexPatternSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this RegexPatternSet -func (tr *RegexPatternSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this RegexPatternSet -func (tr *RegexPatternSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this RegexPatternSet -func (tr *RegexPatternSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this RegexPatternSet -func (tr *RegexPatternSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this RegexPatternSet -func (tr *RegexPatternSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this RegexPatternSet -func (tr *RegexPatternSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this RegexPatternSet -func (tr *RegexPatternSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this RegexPatternSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *RegexPatternSet) LateInitialize(attrs []byte) (bool, error) { - params := &RegexPatternSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *RegexPatternSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Rule -func (mg *Rule) GetTerraformResourceType() string { - return "aws_wafregional_rule" -} - -// GetConnectionDetailsMapping for this Rule -func (tr *Rule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Rule -func (tr *Rule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Rule -func (tr *Rule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Rule -func (tr *Rule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Rule -func (tr *Rule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Rule -func (tr *Rule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Rule -func (tr *Rule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Rule -func (tr *Rule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Rule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Rule) LateInitialize(attrs []byte) (bool, error) { - params := &RuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Rule) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SizeConstraintSet -func (mg *SizeConstraintSet) GetTerraformResourceType() string { - return "aws_wafregional_size_constraint_set" -} - -// GetConnectionDetailsMapping for this SizeConstraintSet -func (tr *SizeConstraintSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SizeConstraintSet -func (tr *SizeConstraintSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SizeConstraintSet -func (tr *SizeConstraintSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SizeConstraintSet -func (tr *SizeConstraintSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SizeConstraintSet -func (tr *SizeConstraintSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SizeConstraintSet -func (tr *SizeConstraintSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SizeConstraintSet -func (tr *SizeConstraintSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SizeConstraintSet -func (tr *SizeConstraintSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SizeConstraintSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SizeConstraintSet) LateInitialize(attrs []byte) (bool, error) { - params := &SizeConstraintSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SizeConstraintSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SQLInjectionMatchSet -func (mg *SQLInjectionMatchSet) GetTerraformResourceType() string { - return "aws_wafregional_sql_injection_match_set" -} - -// GetConnectionDetailsMapping for this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SQLInjectionMatchSet -func (tr *SQLInjectionMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SQLInjectionMatchSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SQLInjectionMatchSet) LateInitialize(attrs []byte) (bool, error) { - params := &SQLInjectionMatchSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SQLInjectionMatchSet) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this WebACL -func (mg *WebACL) GetTerraformResourceType() string { - return "aws_wafregional_web_acl" -} - -// GetConnectionDetailsMapping for this WebACL -func (tr *WebACL) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this WebACL -func (tr *WebACL) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this WebACL -func (tr *WebACL) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this WebACL -func (tr *WebACL) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this WebACL -func (tr *WebACL) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this WebACL -func (tr *WebACL) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this WebACL -func (tr *WebACL) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this WebACL -func (tr *WebACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this WebACL using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *WebACL) LateInitialize(attrs []byte) (bool, error) { - params := &WebACLParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *WebACL) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this XSSMatchSet -func (mg *XSSMatchSet) GetTerraformResourceType() string { - return "aws_wafregional_xss_match_set" -} - -// GetConnectionDetailsMapping for this XSSMatchSet -func (tr *XSSMatchSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this XSSMatchSet -func (tr *XSSMatchSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this XSSMatchSet -func (tr *XSSMatchSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this XSSMatchSet -func (tr *XSSMatchSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this XSSMatchSet -func (tr *XSSMatchSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this XSSMatchSet -func (tr *XSSMatchSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this XSSMatchSet -func (tr *XSSMatchSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this XSSMatchSet -func (tr *XSSMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this XSSMatchSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *XSSMatchSet) LateInitialize(attrs []byte) (bool, error) { - params := &XSSMatchSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *XSSMatchSet) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/wafregional/v1beta1/zz_geomatchset_terraformed.go b/apis/wafregional/v1beta1/zz_geomatchset_terraformed.go new file mode 100755 index 0000000000..afa1ad2812 --- /dev/null +++ b/apis/wafregional/v1beta1/zz_geomatchset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this GeoMatchSet +func (mg *GeoMatchSet) GetTerraformResourceType() string { + return "aws_wafregional_geo_match_set" +} + +// GetConnectionDetailsMapping for this GeoMatchSet +func (tr *GeoMatchSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this GeoMatchSet +func (tr *GeoMatchSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this GeoMatchSet +func (tr *GeoMatchSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this GeoMatchSet +func (tr *GeoMatchSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this GeoMatchSet +func (tr *GeoMatchSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this GeoMatchSet +func (tr *GeoMatchSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this GeoMatchSet +func (tr *GeoMatchSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this GeoMatchSet +func (tr *GeoMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GeoMatchSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GeoMatchSet) LateInitialize(attrs []byte) (bool, error) { + params := &GeoMatchSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *GeoMatchSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafregional/v1beta1/zz_geomatchset_types.go b/apis/wafregional/v1beta1/zz_geomatchset_types.go index 953ba752be..61e40bdafc 100755 --- a/apis/wafregional/v1beta1/zz_geomatchset_types.go +++ b/apis/wafregional/v1beta1/zz_geomatchset_types.go @@ -113,13 +113,14 @@ type GeoMatchSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // GeoMatchSet is the Schema for the GeoMatchSets API. Provides a AWS WAF Regional Geo Match Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type GeoMatchSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafregional/v1beta1/zz_ipset_terraformed.go b/apis/wafregional/v1beta1/zz_ipset_terraformed.go new file mode 100755 index 0000000000..44391bc131 --- /dev/null +++ b/apis/wafregional/v1beta1/zz_ipset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this IPSet +func (mg *IPSet) GetTerraformResourceType() string { + return "aws_wafregional_ipset" +} + +// GetConnectionDetailsMapping for this IPSet +func (tr *IPSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this IPSet +func (tr *IPSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this IPSet +func (tr *IPSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this IPSet +func (tr *IPSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this IPSet +func (tr *IPSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this IPSet +func (tr *IPSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this IPSet +func (tr *IPSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this IPSet +func (tr *IPSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this IPSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *IPSet) LateInitialize(attrs []byte) (bool, error) { + params := &IPSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *IPSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafregional/v1beta1/zz_ipset_types.go b/apis/wafregional/v1beta1/zz_ipset_types.go index ecc338754b..77a875a601 100755 --- a/apis/wafregional/v1beta1/zz_ipset_types.go +++ b/apis/wafregional/v1beta1/zz_ipset_types.go @@ -110,13 +110,14 @@ type IPSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IPSet is the Schema for the IPSets API. Provides a AWS WAF Regional IPSet resource for use with ALB. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type IPSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafregional/v1beta1/zz_ratebasedrule_terraformed.go b/apis/wafregional/v1beta1/zz_ratebasedrule_terraformed.go new file mode 100755 index 0000000000..d6aaa01107 --- /dev/null +++ b/apis/wafregional/v1beta1/zz_ratebasedrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RateBasedRule +func (mg *RateBasedRule) GetTerraformResourceType() string { + return "aws_wafregional_rate_based_rule" +} + +// GetConnectionDetailsMapping for this RateBasedRule +func (tr *RateBasedRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RateBasedRule +func (tr *RateBasedRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RateBasedRule +func (tr *RateBasedRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RateBasedRule +func (tr *RateBasedRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RateBasedRule +func (tr *RateBasedRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RateBasedRule +func (tr *RateBasedRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RateBasedRule +func (tr *RateBasedRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RateBasedRule +func (tr *RateBasedRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RateBasedRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RateBasedRule) LateInitialize(attrs []byte) (bool, error) { + params := &RateBasedRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RateBasedRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafregional/v1beta1/zz_ratebasedrule_types.go b/apis/wafregional/v1beta1/zz_ratebasedrule_types.go index b3bd8d8d44..f2e60fdd1c 100755 --- a/apis/wafregional/v1beta1/zz_ratebasedrule_types.go +++ b/apis/wafregional/v1beta1/zz_ratebasedrule_types.go @@ -196,13 +196,14 @@ type RateBasedRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RateBasedRule is the Schema for the RateBasedRules API. Provides a AWS WAF Regional rate based rule resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RateBasedRule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafregional/v1beta1/zz_regexmatchset_terraformed.go b/apis/wafregional/v1beta1/zz_regexmatchset_terraformed.go new file mode 100755 index 0000000000..e2bb9d0528 --- /dev/null +++ b/apis/wafregional/v1beta1/zz_regexmatchset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RegexMatchSet +func (mg *RegexMatchSet) GetTerraformResourceType() string { + return "aws_wafregional_regex_match_set" +} + +// GetConnectionDetailsMapping for this RegexMatchSet +func (tr *RegexMatchSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RegexMatchSet +func (tr *RegexMatchSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RegexMatchSet +func (tr *RegexMatchSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RegexMatchSet +func (tr *RegexMatchSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RegexMatchSet +func (tr *RegexMatchSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RegexMatchSet +func (tr *RegexMatchSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RegexMatchSet +func (tr *RegexMatchSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RegexMatchSet +func (tr *RegexMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RegexMatchSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RegexMatchSet) LateInitialize(attrs []byte) (bool, error) { + params := &RegexMatchSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RegexMatchSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafregional/v1beta1/zz_regexmatchset_types.go b/apis/wafregional/v1beta1/zz_regexmatchset_types.go index cb481757fd..f836f6f438 100755 --- a/apis/wafregional/v1beta1/zz_regexmatchset_types.go +++ b/apis/wafregional/v1beta1/zz_regexmatchset_types.go @@ -187,13 +187,14 @@ type RegexMatchSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RegexMatchSet is the Schema for the RegexMatchSets API. Provides a AWS WAF Regional Regex Match Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RegexMatchSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafregional/v1beta1/zz_regexpatternset_terraformed.go b/apis/wafregional/v1beta1/zz_regexpatternset_terraformed.go new file mode 100755 index 0000000000..c0b6b3dd03 --- /dev/null +++ b/apis/wafregional/v1beta1/zz_regexpatternset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this RegexPatternSet +func (mg *RegexPatternSet) GetTerraformResourceType() string { + return "aws_wafregional_regex_pattern_set" +} + +// GetConnectionDetailsMapping for this RegexPatternSet +func (tr *RegexPatternSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this RegexPatternSet +func (tr *RegexPatternSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this RegexPatternSet +func (tr *RegexPatternSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this RegexPatternSet +func (tr *RegexPatternSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this RegexPatternSet +func (tr *RegexPatternSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this RegexPatternSet +func (tr *RegexPatternSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this RegexPatternSet +func (tr *RegexPatternSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this RegexPatternSet +func (tr *RegexPatternSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this RegexPatternSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *RegexPatternSet) LateInitialize(attrs []byte) (bool, error) { + params := &RegexPatternSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *RegexPatternSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafregional/v1beta1/zz_regexpatternset_types.go b/apis/wafregional/v1beta1/zz_regexpatternset_types.go index 1631231e4a..e1a6c831f2 100755 --- a/apis/wafregional/v1beta1/zz_regexpatternset_types.go +++ b/apis/wafregional/v1beta1/zz_regexpatternset_types.go @@ -81,13 +81,14 @@ type RegexPatternSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RegexPatternSet is the Schema for the RegexPatternSets API. Provides a AWS WAF Regional Regex Pattern Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RegexPatternSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafregional/v1beta1/zz_rule_terraformed.go b/apis/wafregional/v1beta1/zz_rule_terraformed.go new file mode 100755 index 0000000000..b0e123f4f9 --- /dev/null +++ b/apis/wafregional/v1beta1/zz_rule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Rule +func (mg *Rule) GetTerraformResourceType() string { + return "aws_wafregional_rule" +} + +// GetConnectionDetailsMapping for this Rule +func (tr *Rule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Rule +func (tr *Rule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Rule +func (tr *Rule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Rule +func (tr *Rule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Rule +func (tr *Rule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Rule +func (tr *Rule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Rule +func (tr *Rule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Rule +func (tr *Rule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Rule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Rule) LateInitialize(attrs []byte) (bool, error) { + params := &RuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Rule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafregional/v1beta1/zz_rule_types.go b/apis/wafregional/v1beta1/zz_rule_types.go index cc01113f70..3b8ee70fea 100755 --- a/apis/wafregional/v1beta1/zz_rule_types.go +++ b/apis/wafregional/v1beta1/zz_rule_types.go @@ -167,13 +167,14 @@ type RuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Rule is the Schema for the Rules API. Provides an AWS WAF Regional rule resource for use with ALB. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Rule struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafregional/v1beta1/zz_sizeconstraintset_terraformed.go b/apis/wafregional/v1beta1/zz_sizeconstraintset_terraformed.go new file mode 100755 index 0000000000..64cbd12c03 --- /dev/null +++ b/apis/wafregional/v1beta1/zz_sizeconstraintset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SizeConstraintSet +func (mg *SizeConstraintSet) GetTerraformResourceType() string { + return "aws_wafregional_size_constraint_set" +} + +// GetConnectionDetailsMapping for this SizeConstraintSet +func (tr *SizeConstraintSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SizeConstraintSet +func (tr *SizeConstraintSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SizeConstraintSet +func (tr *SizeConstraintSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SizeConstraintSet +func (tr *SizeConstraintSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SizeConstraintSet +func (tr *SizeConstraintSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SizeConstraintSet +func (tr *SizeConstraintSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SizeConstraintSet +func (tr *SizeConstraintSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SizeConstraintSet +func (tr *SizeConstraintSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SizeConstraintSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SizeConstraintSet) LateInitialize(attrs []byte) (bool, error) { + params := &SizeConstraintSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SizeConstraintSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafregional/v1beta1/zz_sizeconstraintset_types.go b/apis/wafregional/v1beta1/zz_sizeconstraintset_types.go index 9320cb87b2..ede3429b1c 100755 --- a/apis/wafregional/v1beta1/zz_sizeconstraintset_types.go +++ b/apis/wafregional/v1beta1/zz_sizeconstraintset_types.go @@ -193,13 +193,14 @@ type SizeConstraintSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SizeConstraintSet is the Schema for the SizeConstraintSets API. Provides an AWS WAF Regional Size Constraint Set resource for use with ALB. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SizeConstraintSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafregional/v1beta1/zz_sqlinjectionmatchset_terraformed.go b/apis/wafregional/v1beta1/zz_sqlinjectionmatchset_terraformed.go new file mode 100755 index 0000000000..fce90061f5 --- /dev/null +++ b/apis/wafregional/v1beta1/zz_sqlinjectionmatchset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SQLInjectionMatchSet +func (mg *SQLInjectionMatchSet) GetTerraformResourceType() string { + return "aws_wafregional_sql_injection_match_set" +} + +// GetConnectionDetailsMapping for this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SQLInjectionMatchSet +func (tr *SQLInjectionMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SQLInjectionMatchSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SQLInjectionMatchSet) LateInitialize(attrs []byte) (bool, error) { + params := &SQLInjectionMatchSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SQLInjectionMatchSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafregional/v1beta1/zz_sqlinjectionmatchset_types.go b/apis/wafregional/v1beta1/zz_sqlinjectionmatchset_types.go index 549222804f..ef2b05284f 100755 --- a/apis/wafregional/v1beta1/zz_sqlinjectionmatchset_types.go +++ b/apis/wafregional/v1beta1/zz_sqlinjectionmatchset_types.go @@ -160,13 +160,14 @@ type SQLInjectionMatchSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SQLInjectionMatchSet is the Schema for the SQLInjectionMatchSets API. Provides a AWS WAF Regional SqlInjectionMatchSet resource for use with ALB. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SQLInjectionMatchSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafregional/v1beta1/zz_webacl_terraformed.go b/apis/wafregional/v1beta1/zz_webacl_terraformed.go new file mode 100755 index 0000000000..e78bab7797 --- /dev/null +++ b/apis/wafregional/v1beta1/zz_webacl_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this WebACL +func (mg *WebACL) GetTerraformResourceType() string { + return "aws_wafregional_web_acl" +} + +// GetConnectionDetailsMapping for this WebACL +func (tr *WebACL) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this WebACL +func (tr *WebACL) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this WebACL +func (tr *WebACL) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this WebACL +func (tr *WebACL) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this WebACL +func (tr *WebACL) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this WebACL +func (tr *WebACL) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this WebACL +func (tr *WebACL) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this WebACL +func (tr *WebACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this WebACL using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *WebACL) LateInitialize(attrs []byte) (bool, error) { + params := &WebACLParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *WebACL) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafregional/v1beta1/zz_webacl_types.go b/apis/wafregional/v1beta1/zz_webacl_types.go index c90d460ada..d1bc1117e1 100755 --- a/apis/wafregional/v1beta1/zz_webacl_types.go +++ b/apis/wafregional/v1beta1/zz_webacl_types.go @@ -364,13 +364,14 @@ type WebACLStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // WebACL is the Schema for the WebACLs API. Provides a AWS WAF Regional web access control group (ACL) resource for use with ALB. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type WebACL struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafregional/v1beta1/zz_xssmatchset_terraformed.go b/apis/wafregional/v1beta1/zz_xssmatchset_terraformed.go new file mode 100755 index 0000000000..52f6e86f61 --- /dev/null +++ b/apis/wafregional/v1beta1/zz_xssmatchset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this XSSMatchSet +func (mg *XSSMatchSet) GetTerraformResourceType() string { + return "aws_wafregional_xss_match_set" +} + +// GetConnectionDetailsMapping for this XSSMatchSet +func (tr *XSSMatchSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this XSSMatchSet +func (tr *XSSMatchSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this XSSMatchSet +func (tr *XSSMatchSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this XSSMatchSet +func (tr *XSSMatchSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this XSSMatchSet +func (tr *XSSMatchSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this XSSMatchSet +func (tr *XSSMatchSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this XSSMatchSet +func (tr *XSSMatchSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this XSSMatchSet +func (tr *XSSMatchSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this XSSMatchSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *XSSMatchSet) LateInitialize(attrs []byte) (bool, error) { + params := &XSSMatchSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *XSSMatchSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafregional/v1beta1/zz_xssmatchset_types.go b/apis/wafregional/v1beta1/zz_xssmatchset_types.go index a489cf8cad..4962f3da22 100755 --- a/apis/wafregional/v1beta1/zz_xssmatchset_types.go +++ b/apis/wafregional/v1beta1/zz_xssmatchset_types.go @@ -136,13 +136,14 @@ type XSSMatchSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // XSSMatchSet is the Schema for the XSSMatchSets API. Provides an AWS WAF Regional XSS Match Set resource for use with ALB. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type XSSMatchSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafv2/v1beta1/zz_generated.conversion_hubs.go b/apis/wafv2/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..52a9099745 --- /dev/null +++ b/apis/wafv2/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *IPSet) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *RegexPatternSet) Hub() {} diff --git a/apis/wafv2/v1beta1/zz_ipset_terraformed.go b/apis/wafv2/v1beta1/zz_ipset_terraformed.go new file mode 100755 index 0000000000..b0e95b89b8 --- /dev/null +++ b/apis/wafv2/v1beta1/zz_ipset_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this IPSet +func (mg *IPSet) GetTerraformResourceType() string { + return "aws_wafv2_ip_set" +} + +// GetConnectionDetailsMapping for this IPSet +func (tr *IPSet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this IPSet +func (tr *IPSet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this IPSet +func (tr *IPSet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this IPSet +func (tr *IPSet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this IPSet +func (tr *IPSet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this IPSet +func (tr *IPSet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this IPSet +func (tr *IPSet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this IPSet +func (tr *IPSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this IPSet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *IPSet) LateInitialize(attrs []byte) (bool, error) { + params := &IPSetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *IPSet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/wafv2/v1beta1/zz_ipset_types.go b/apis/wafv2/v1beta1/zz_ipset_types.go index e3452b0739..deb43c6aa1 100755 --- a/apis/wafv2/v1beta1/zz_ipset_types.go +++ b/apis/wafv2/v1beta1/zz_ipset_types.go @@ -133,13 +133,14 @@ type IPSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IPSet is the Schema for the IPSets API. Provides an AWS WAFv2 IP Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type IPSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/wafv2/v1beta1/zz_generated_terraformed.go b/apis/wafv2/v1beta1/zz_regexpatternset_terraformed.go similarity index 53% rename from apis/wafv2/v1beta1/zz_generated_terraformed.go rename to apis/wafv2/v1beta1/zz_regexpatternset_terraformed.go index bfc961655c..48f88e3216 100755 --- a/apis/wafv2/v1beta1/zz_generated_terraformed.go +++ b/apis/wafv2/v1beta1/zz_regexpatternset_terraformed.go @@ -18,120 +18,6 @@ import ( "github.com/crossplane/upjet/pkg/resource/json" ) -// GetTerraformResourceType returns Terraform resource type for this IPSet -func (mg *IPSet) GetTerraformResourceType() string { - return "aws_wafv2_ip_set" -} - -// GetConnectionDetailsMapping for this IPSet -func (tr *IPSet) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this IPSet -func (tr *IPSet) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this IPSet -func (tr *IPSet) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this IPSet -func (tr *IPSet) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this IPSet -func (tr *IPSet) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this IPSet -func (tr *IPSet) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this IPSet -func (tr *IPSet) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this IPSet -func (tr *IPSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this IPSet using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *IPSet) LateInitialize(attrs []byte) (bool, error) { - params := &IPSetParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *IPSet) GetTerraformSchemaVersion() int { - return 0 -} - // GetTerraformResourceType returns Terraform resource type for this RegexPatternSet func (mg *RegexPatternSet) GetTerraformResourceType() string { return "aws_wafv2_regex_pattern_set" diff --git a/apis/wafv2/v1beta1/zz_regexpatternset_types.go b/apis/wafv2/v1beta1/zz_regexpatternset_types.go index d0c9e137a3..cd9c5f0cc4 100755 --- a/apis/wafv2/v1beta1/zz_regexpatternset_types.go +++ b/apis/wafv2/v1beta1/zz_regexpatternset_types.go @@ -139,13 +139,14 @@ type RegexPatternSetStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // RegexPatternSet is the Schema for the RegexPatternSets API. Provides an AWS WAFv2 Regex Pattern Set resource. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type RegexPatternSet struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/workspaces/v1beta1/zz_generated_terraformed.go b/apis/workspaces/v1beta1/zz_directory_terraformed.go similarity index 52% rename from apis/workspaces/v1beta1/zz_generated_terraformed.go rename to apis/workspaces/v1beta1/zz_directory_terraformed.go index 03d9e4c41d..515acec546 100755 --- a/apis/workspaces/v1beta1/zz_generated_terraformed.go +++ b/apis/workspaces/v1beta1/zz_directory_terraformed.go @@ -131,117 +131,3 @@ func (tr *Directory) LateInitialize(attrs []byte) (bool, error) { func (tr *Directory) GetTerraformSchemaVersion() int { return 0 } - -// GetTerraformResourceType returns Terraform resource type for this IPGroup -func (mg *IPGroup) GetTerraformResourceType() string { - return "aws_workspaces_ip_group" -} - -// GetConnectionDetailsMapping for this IPGroup -func (tr *IPGroup) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this IPGroup -func (tr *IPGroup) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this IPGroup -func (tr *IPGroup) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this IPGroup -func (tr *IPGroup) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this IPGroup -func (tr *IPGroup) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this IPGroup -func (tr *IPGroup) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this IPGroup -func (tr *IPGroup) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this IPGroup -func (tr *IPGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this IPGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *IPGroup) LateInitialize(attrs []byte) (bool, error) { - params := &IPGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *IPGroup) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/workspaces/v1beta1/zz_directory_types.go b/apis/workspaces/v1beta1/zz_directory_types.go index 0e72ba7df8..3a1528c874 100755 --- a/apis/workspaces/v1beta1/zz_directory_types.go +++ b/apis/workspaces/v1beta1/zz_directory_types.go @@ -435,13 +435,14 @@ type DirectoryStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Directory is the Schema for the Directorys API. Provides a WorkSpaces directory in AWS WorkSpaces Service. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Directory struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/workspaces/v1beta1/zz_generated.conversion_hubs.go b/apis/workspaces/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..fdc359e970 --- /dev/null +++ b/apis/workspaces/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *Directory) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *IPGroup) Hub() {} diff --git a/apis/workspaces/v1beta1/zz_ipgroup_terraformed.go b/apis/workspaces/v1beta1/zz_ipgroup_terraformed.go new file mode 100755 index 0000000000..f89b0412cd --- /dev/null +++ b/apis/workspaces/v1beta1/zz_ipgroup_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this IPGroup +func (mg *IPGroup) GetTerraformResourceType() string { + return "aws_workspaces_ip_group" +} + +// GetConnectionDetailsMapping for this IPGroup +func (tr *IPGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this IPGroup +func (tr *IPGroup) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this IPGroup +func (tr *IPGroup) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this IPGroup +func (tr *IPGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this IPGroup +func (tr *IPGroup) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this IPGroup +func (tr *IPGroup) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this IPGroup +func (tr *IPGroup) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this IPGroup +func (tr *IPGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this IPGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *IPGroup) LateInitialize(attrs []byte) (bool, error) { + params := &IPGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *IPGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/workspaces/v1beta1/zz_ipgroup_types.go b/apis/workspaces/v1beta1/zz_ipgroup_types.go index 3f46a4584e..f424960fa6 100755 --- a/apis/workspaces/v1beta1/zz_ipgroup_types.go +++ b/apis/workspaces/v1beta1/zz_ipgroup_types.go @@ -134,13 +134,14 @@ type IPGroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // IPGroup is the Schema for the IPGroups API. Provides an IP access control group in AWS WorkSpaces Service. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type IPGroup struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/xray/v1beta1/zz_encryptionconfig_terraformed.go b/apis/xray/v1beta1/zz_encryptionconfig_terraformed.go new file mode 100755 index 0000000000..c1e7d40839 --- /dev/null +++ b/apis/xray/v1beta1/zz_encryptionconfig_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this EncryptionConfig +func (mg *EncryptionConfig) GetTerraformResourceType() string { + return "aws_xray_encryption_config" +} + +// GetConnectionDetailsMapping for this EncryptionConfig +func (tr *EncryptionConfig) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this EncryptionConfig +func (tr *EncryptionConfig) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this EncryptionConfig +func (tr *EncryptionConfig) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this EncryptionConfig +func (tr *EncryptionConfig) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this EncryptionConfig +func (tr *EncryptionConfig) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this EncryptionConfig +func (tr *EncryptionConfig) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this EncryptionConfig +func (tr *EncryptionConfig) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this EncryptionConfig +func (tr *EncryptionConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this EncryptionConfig using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *EncryptionConfig) LateInitialize(attrs []byte) (bool, error) { + params := &EncryptionConfigParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *EncryptionConfig) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/xray/v1beta1/zz_encryptionconfig_types.go b/apis/xray/v1beta1/zz_encryptionconfig_types.go index 7666e28c95..507087c83f 100755 --- a/apis/xray/v1beta1/zz_encryptionconfig_types.go +++ b/apis/xray/v1beta1/zz_encryptionconfig_types.go @@ -98,13 +98,14 @@ type EncryptionConfigStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // EncryptionConfig is the Schema for the EncryptionConfigs API. Creates and manages an AWS XRay Encryption Config. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type EncryptionConfig struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/xray/v1beta1/zz_generated.conversion_hubs.go b/apis/xray/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 0000000000..669b0870d1 --- /dev/null +++ b/apis/xray/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *EncryptionConfig) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *Group) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *SamplingRule) Hub() {} diff --git a/apis/xray/v1beta1/zz_generated_terraformed.go b/apis/xray/v1beta1/zz_generated_terraformed.go deleted file mode 100755 index bdfcf30c8d..0000000000 --- a/apis/xray/v1beta1/zz_generated_terraformed.go +++ /dev/null @@ -1,361 +0,0 @@ -// SPDX-FileCopyrightText: 2023 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -/* -Copyright 2022 Upbound Inc. -*/ - -// Code generated by upjet. DO NOT EDIT. - -package v1beta1 - -import ( - "dario.cat/mergo" - "github.com/pkg/errors" - - "github.com/crossplane/upjet/pkg/resource" - "github.com/crossplane/upjet/pkg/resource/json" -) - -// GetTerraformResourceType returns Terraform resource type for this EncryptionConfig -func (mg *EncryptionConfig) GetTerraformResourceType() string { - return "aws_xray_encryption_config" -} - -// GetConnectionDetailsMapping for this EncryptionConfig -func (tr *EncryptionConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this EncryptionConfig -func (tr *EncryptionConfig) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this EncryptionConfig -func (tr *EncryptionConfig) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this EncryptionConfig -func (tr *EncryptionConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this EncryptionConfig -func (tr *EncryptionConfig) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this EncryptionConfig -func (tr *EncryptionConfig) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this EncryptionConfig -func (tr *EncryptionConfig) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this EncryptionConfig -func (tr *EncryptionConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this EncryptionConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *EncryptionConfig) LateInitialize(attrs []byte) (bool, error) { - params := &EncryptionConfigParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *EncryptionConfig) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this Group -func (mg *Group) GetTerraformResourceType() string { - return "aws_xray_group" -} - -// GetConnectionDetailsMapping for this Group -func (tr *Group) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this Group -func (tr *Group) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this Group -func (tr *Group) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this Group -func (tr *Group) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this Group -func (tr *Group) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this Group -func (tr *Group) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this Group -func (tr *Group) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this Group -func (tr *Group) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this Group using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *Group) LateInitialize(attrs []byte) (bool, error) { - params := &GroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Group) GetTerraformSchemaVersion() int { - return 0 -} - -// GetTerraformResourceType returns Terraform resource type for this SamplingRule -func (mg *SamplingRule) GetTerraformResourceType() string { - return "aws_xray_sampling_rule" -} - -// GetConnectionDetailsMapping for this SamplingRule -func (tr *SamplingRule) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SamplingRule -func (tr *SamplingRule) GetObservation() (map[string]any, error) { - o, err := json.TFParser.Marshal(tr.Status.AtProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(o, &base) -} - -// SetObservation for this SamplingRule -func (tr *SamplingRule) SetObservation(obs map[string]any) error { - p, err := json.TFParser.Marshal(obs) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) -} - -// GetID returns ID of underlying Terraform resource of this SamplingRule -func (tr *SamplingRule) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SamplingRule -func (tr *SamplingRule) GetParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.ForProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// SetParameters for this SamplingRule -func (tr *SamplingRule) SetParameters(params map[string]any) error { - p, err := json.TFParser.Marshal(params) - if err != nil { - return err - } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} - -// GetInitParameters of this SamplingRule -func (tr *SamplingRule) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) - if err != nil { - return nil, err - } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) -} - -// GetInitParameters of this SamplingRule -func (tr *SamplingRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { - params, err := tr.GetParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) - } - if !shouldMergeInitProvider { - return params, nil - } - - initParams, err := tr.GetInitParameters() - if err != nil { - return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) - } - - // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the - // slices from the initProvider to forProvider. As it also sets - // overwrite to true, we need to set it back to false, we don't - // want to overwrite the forProvider fields with the initProvider - // fields. - err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { - c.Overwrite = false - }) - if err != nil { - return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) - } - - return params, nil -} - -// LateInitialize this SamplingRule using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SamplingRule) LateInitialize(attrs []byte) (bool, error) { - params := &SamplingRuleParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") - } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} - - li := resource.NewGenericLateInitializer(opts...) - return li.LateInitialize(&tr.Spec.ForProvider, params) -} - -// GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *SamplingRule) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/xray/v1beta1/zz_group_terraformed.go b/apis/xray/v1beta1/zz_group_terraformed.go new file mode 100755 index 0000000000..79f9c37fbd --- /dev/null +++ b/apis/xray/v1beta1/zz_group_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Group +func (mg *Group) GetTerraformResourceType() string { + return "aws_xray_group" +} + +// GetConnectionDetailsMapping for this Group +func (tr *Group) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Group +func (tr *Group) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this Group +func (tr *Group) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this Group +func (tr *Group) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Group +func (tr *Group) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this Group +func (tr *Group) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this Group +func (tr *Group) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this Group +func (tr *Group) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this Group using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Group) LateInitialize(attrs []byte) (bool, error) { + params := &GroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *Group) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/xray/v1beta1/zz_group_types.go b/apis/xray/v1beta1/zz_group_types.go index d6f8bafa96..c4d8c312af 100755 --- a/apis/xray/v1beta1/zz_group_types.go +++ b/apis/xray/v1beta1/zz_group_types.go @@ -137,13 +137,14 @@ type GroupStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // Group is the Schema for the Groups API. Creates and manages an AWS XRay Group. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type Group struct { metav1.TypeMeta `json:",inline"` diff --git a/apis/xray/v1beta1/zz_samplingrule_terraformed.go b/apis/xray/v1beta1/zz_samplingrule_terraformed.go new file mode 100755 index 0000000000..688638392f --- /dev/null +++ b/apis/xray/v1beta1/zz_samplingrule_terraformed.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this SamplingRule +func (mg *SamplingRule) GetTerraformResourceType() string { + return "aws_xray_sampling_rule" +} + +// GetConnectionDetailsMapping for this SamplingRule +func (tr *SamplingRule) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this SamplingRule +func (tr *SamplingRule) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this SamplingRule +func (tr *SamplingRule) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this SamplingRule +func (tr *SamplingRule) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this SamplingRule +func (tr *SamplingRule) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this SamplingRule +func (tr *SamplingRule) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SamplingRule +func (tr *SamplingRule) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SamplingRule +func (tr *SamplingRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this SamplingRule using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *SamplingRule) LateInitialize(attrs []byte) (bool, error) { + params := &SamplingRuleParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *SamplingRule) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/xray/v1beta1/zz_samplingrule_types.go b/apis/xray/v1beta1/zz_samplingrule_types.go index 9c483952fb..f6d7431e14 100755 --- a/apis/xray/v1beta1/zz_samplingrule_types.go +++ b/apis/xray/v1beta1/zz_samplingrule_types.go @@ -191,13 +191,14 @@ type SamplingRuleStatus struct { } // +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion // SamplingRule is the Schema for the SamplingRules API. Creates and manages an AWS XRay Sampling Rule. // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} type SamplingRule struct { metav1.TypeMeta `json:",inline"` diff --git a/config/ec2/config.go b/config/ec2/config.go index 77c56bcf58..4cf89084cf 100644 --- a/config/ec2/config.go +++ b/config/ec2/config.go @@ -216,11 +216,12 @@ func Configure(p *config.Provider) { "source_security_group_id", }, } - r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) { + r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) error { // TODO: Has better be implemented via defaulting. if _, ok := jsonMap["self"]; !ok { params["self"] = false } + return nil } }) @@ -423,12 +424,13 @@ func Configure(p *config.Provider) { r.References["source_ami_id"] = config.Reference{ Type: "AMI", } - r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) { + r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) error { params["ebs_block_device"] = []any{} // TODO: Has better be implemented via defaulting. if _, ok := jsonMap["encrypted"]; !ok { params["encrypted"] = false } + return nil } r.TerraformCustomDiff = func(diff *terraform.InstanceDiff, _ *terraform.InstanceState, _ *terraform.ResourceConfig) (*terraform.InstanceDiff, error) { if diff != nil && diff.Attributes != nil { diff --git a/config/provider.go b/config/provider.go index be26bf8059..479f9294e7 100644 --- a/config/provider.go +++ b/config/provider.go @@ -187,7 +187,7 @@ func GetProvider(ctx context.Context, generationProvider bool) (*config.Provider config.WithShortName("aws"), config.WithRootGroup("aws.upbound.io"), config.WithIncludeList(CLIReconciledResourceList()), - config.WithNoForkIncludeList(NoForkResourceList()), + config.WithTerraformPluginSDKIncludeList(NoForkResourceList()), config.WithReferenceInjectors([]config.ReferenceInjector{reference.NewInjector(modulePath)}), config.WithSkipList(skipList), config.WithFeaturesPackage("internal/features"), diff --git a/config/s3/config.go b/config/s3/config.go index 5292078f24..7b6a06bd26 100644 --- a/config/s3/config.go +++ b/config/s3/config.go @@ -42,7 +42,7 @@ func Configure(p *config.Provider) { "logging", "object_lock_configuration", "policy", "replication_configuration", "request_payer", "server_side_encryption_configuration", "versioning", "website", "arn") r.MetaResource.ExternalName = registry.RandRFC1123Subdomain - r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) { + r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) error { params["region"] = jsonMap["region"] // TODO: added to prevent extra reconciliations due to // late-initialization or drift. Has better be implemented @@ -50,6 +50,7 @@ func Configure(p *config.Provider) { if _, ok := jsonMap["forceDestroy"]; !ok { params["force_destroy"] = false } + return nil } }) @@ -73,11 +74,12 @@ func Configure(p *config.Provider) { r.LateInitializer = config.LateInitializer{ IgnoredFields: []string{"etag", "kms_key_id"}, } - r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) { + r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) error { // TODO: Has better be implemented via defaulting. if _, ok := jsonMap["acl"]; !ok { params["acl"] = "private" } + return nil } }) diff --git a/config/secretsmanager/config.go b/config/secretsmanager/config.go index 6f3f8323ab..958658f5f7 100644 --- a/config/secretsmanager/config.go +++ b/config/secretsmanager/config.go @@ -10,8 +10,9 @@ func Configure(p *config.Provider) { // aws_secretsmanager_secret_policy. config.MoveToStatus(r.TerraformResource, "policy") // TODO: we had better do this for all resources... - r.TerraformConfigurationInjector = func(_ map[string]any, params map[string]any) { + r.TerraformConfigurationInjector = func(_ map[string]any, params map[string]any) error { params["name_prefix"] = "" + return nil } }) } diff --git a/examples-generated/accessanalyzer/analyzer.yaml b/examples-generated/accessanalyzer/v1beta1/analyzer.yaml similarity index 100% rename from examples-generated/accessanalyzer/analyzer.yaml rename to examples-generated/accessanalyzer/v1beta1/analyzer.yaml diff --git a/examples-generated/accessanalyzer/archiverule.yaml b/examples-generated/accessanalyzer/v1beta1/archiverule.yaml similarity index 100% rename from examples-generated/accessanalyzer/archiverule.yaml rename to examples-generated/accessanalyzer/v1beta1/archiverule.yaml diff --git a/examples-generated/account/alternatecontact.yaml b/examples-generated/account/v1beta1/alternatecontact.yaml similarity index 100% rename from examples-generated/account/alternatecontact.yaml rename to examples-generated/account/v1beta1/alternatecontact.yaml diff --git a/examples-generated/acm/certificate.yaml b/examples-generated/acm/v1beta1/certificate.yaml similarity index 100% rename from examples-generated/acm/certificate.yaml rename to examples-generated/acm/v1beta1/certificate.yaml diff --git a/examples-generated/acm/certificatevalidation.yaml b/examples-generated/acm/v1beta1/certificatevalidation.yaml similarity index 100% rename from examples-generated/acm/certificatevalidation.yaml rename to examples-generated/acm/v1beta1/certificatevalidation.yaml diff --git a/examples-generated/acmpca/certificate.yaml b/examples-generated/acmpca/v1beta1/certificate.yaml similarity index 100% rename from examples-generated/acmpca/certificate.yaml rename to examples-generated/acmpca/v1beta1/certificate.yaml diff --git a/examples-generated/acmpca/certificateauthority.yaml b/examples-generated/acmpca/v1beta1/certificateauthority.yaml similarity index 100% rename from examples-generated/acmpca/certificateauthority.yaml rename to examples-generated/acmpca/v1beta1/certificateauthority.yaml diff --git a/examples-generated/acmpca/certificateauthoritycertificate.yaml b/examples-generated/acmpca/v1beta1/certificateauthoritycertificate.yaml similarity index 100% rename from examples-generated/acmpca/certificateauthoritycertificate.yaml rename to examples-generated/acmpca/v1beta1/certificateauthoritycertificate.yaml diff --git a/examples-generated/acmpca/permission.yaml b/examples-generated/acmpca/v1beta1/permission.yaml similarity index 100% rename from examples-generated/acmpca/permission.yaml rename to examples-generated/acmpca/v1beta1/permission.yaml diff --git a/examples-generated/acmpca/policy.yaml b/examples-generated/acmpca/v1beta1/policy.yaml similarity index 100% rename from examples-generated/acmpca/policy.yaml rename to examples-generated/acmpca/v1beta1/policy.yaml diff --git a/examples-generated/amp/alertmanagerdefinition.yaml b/examples-generated/amp/v1beta1/alertmanagerdefinition.yaml similarity index 100% rename from examples-generated/amp/alertmanagerdefinition.yaml rename to examples-generated/amp/v1beta1/alertmanagerdefinition.yaml diff --git a/examples-generated/amp/rulegroupnamespace.yaml b/examples-generated/amp/v1beta1/rulegroupnamespace.yaml similarity index 100% rename from examples-generated/amp/rulegroupnamespace.yaml rename to examples-generated/amp/v1beta1/rulegroupnamespace.yaml diff --git a/examples-generated/amp/workspace.yaml b/examples-generated/amp/v1beta1/workspace.yaml similarity index 100% rename from examples-generated/amp/workspace.yaml rename to examples-generated/amp/v1beta1/workspace.yaml diff --git a/examples-generated/amplify/app.yaml b/examples-generated/amplify/v1beta1/app.yaml similarity index 100% rename from examples-generated/amplify/app.yaml rename to examples-generated/amplify/v1beta1/app.yaml diff --git a/examples-generated/amplify/backendenvironment.yaml b/examples-generated/amplify/v1beta1/backendenvironment.yaml similarity index 100% rename from examples-generated/amplify/backendenvironment.yaml rename to examples-generated/amplify/v1beta1/backendenvironment.yaml diff --git a/examples-generated/amplify/branch.yaml b/examples-generated/amplify/v1beta1/branch.yaml similarity index 100% rename from examples-generated/amplify/branch.yaml rename to examples-generated/amplify/v1beta1/branch.yaml diff --git a/examples-generated/amplify/webhook.yaml b/examples-generated/amplify/v1beta1/webhook.yaml similarity index 100% rename from examples-generated/amplify/webhook.yaml rename to examples-generated/amplify/v1beta1/webhook.yaml diff --git a/examples-generated/apigateway/account.yaml b/examples-generated/apigateway/v1beta1/account.yaml similarity index 100% rename from examples-generated/apigateway/account.yaml rename to examples-generated/apigateway/v1beta1/account.yaml diff --git a/examples-generated/apigateway/apikey.yaml b/examples-generated/apigateway/v1beta1/apikey.yaml similarity index 100% rename from examples-generated/apigateway/apikey.yaml rename to examples-generated/apigateway/v1beta1/apikey.yaml diff --git a/examples-generated/apigateway/authorizer.yaml b/examples-generated/apigateway/v1beta1/authorizer.yaml similarity index 100% rename from examples-generated/apigateway/authorizer.yaml rename to examples-generated/apigateway/v1beta1/authorizer.yaml diff --git a/examples-generated/apigateway/basepathmapping.yaml b/examples-generated/apigateway/v1beta1/basepathmapping.yaml similarity index 100% rename from examples-generated/apigateway/basepathmapping.yaml rename to examples-generated/apigateway/v1beta1/basepathmapping.yaml diff --git a/examples-generated/apigateway/clientcertificate.yaml b/examples-generated/apigateway/v1beta1/clientcertificate.yaml similarity index 100% rename from examples-generated/apigateway/clientcertificate.yaml rename to examples-generated/apigateway/v1beta1/clientcertificate.yaml diff --git a/examples-generated/apigateway/deployment.yaml b/examples-generated/apigateway/v1beta1/deployment.yaml similarity index 100% rename from examples-generated/apigateway/deployment.yaml rename to examples-generated/apigateway/v1beta1/deployment.yaml diff --git a/examples-generated/apigateway/documentationpart.yaml b/examples-generated/apigateway/v1beta1/documentationpart.yaml similarity index 100% rename from examples-generated/apigateway/documentationpart.yaml rename to examples-generated/apigateway/v1beta1/documentationpart.yaml diff --git a/examples-generated/apigateway/documentationversion.yaml b/examples-generated/apigateway/v1beta1/documentationversion.yaml similarity index 100% rename from examples-generated/apigateway/documentationversion.yaml rename to examples-generated/apigateway/v1beta1/documentationversion.yaml diff --git a/examples-generated/apigateway/domainname.yaml b/examples-generated/apigateway/v1beta1/domainname.yaml similarity index 100% rename from examples-generated/apigateway/domainname.yaml rename to examples-generated/apigateway/v1beta1/domainname.yaml diff --git a/examples-generated/apigateway/gatewayresponse.yaml b/examples-generated/apigateway/v1beta1/gatewayresponse.yaml similarity index 100% rename from examples-generated/apigateway/gatewayresponse.yaml rename to examples-generated/apigateway/v1beta1/gatewayresponse.yaml diff --git a/examples-generated/apigateway/integration.yaml b/examples-generated/apigateway/v1beta1/integration.yaml similarity index 100% rename from examples-generated/apigateway/integration.yaml rename to examples-generated/apigateway/v1beta1/integration.yaml diff --git a/examples-generated/apigateway/integrationresponse.yaml b/examples-generated/apigateway/v1beta1/integrationresponse.yaml similarity index 100% rename from examples-generated/apigateway/integrationresponse.yaml rename to examples-generated/apigateway/v1beta1/integrationresponse.yaml diff --git a/examples-generated/apigateway/method.yaml b/examples-generated/apigateway/v1beta1/method.yaml similarity index 100% rename from examples-generated/apigateway/method.yaml rename to examples-generated/apigateway/v1beta1/method.yaml diff --git a/examples-generated/apigateway/methodresponse.yaml b/examples-generated/apigateway/v1beta1/methodresponse.yaml similarity index 100% rename from examples-generated/apigateway/methodresponse.yaml rename to examples-generated/apigateway/v1beta1/methodresponse.yaml diff --git a/examples-generated/apigateway/methodsettings.yaml b/examples-generated/apigateway/v1beta1/methodsettings.yaml similarity index 100% rename from examples-generated/apigateway/methodsettings.yaml rename to examples-generated/apigateway/v1beta1/methodsettings.yaml diff --git a/examples-generated/apigateway/model.yaml b/examples-generated/apigateway/v1beta1/model.yaml similarity index 100% rename from examples-generated/apigateway/model.yaml rename to examples-generated/apigateway/v1beta1/model.yaml diff --git a/examples-generated/apigateway/requestvalidator.yaml b/examples-generated/apigateway/v1beta1/requestvalidator.yaml similarity index 100% rename from examples-generated/apigateway/requestvalidator.yaml rename to examples-generated/apigateway/v1beta1/requestvalidator.yaml diff --git a/examples-generated/apigateway/resource.yaml b/examples-generated/apigateway/v1beta1/resource.yaml similarity index 100% rename from examples-generated/apigateway/resource.yaml rename to examples-generated/apigateway/v1beta1/resource.yaml diff --git a/examples-generated/apigateway/restapi.yaml b/examples-generated/apigateway/v1beta1/restapi.yaml similarity index 100% rename from examples-generated/apigateway/restapi.yaml rename to examples-generated/apigateway/v1beta1/restapi.yaml diff --git a/examples-generated/apigateway/restapipolicy.yaml b/examples-generated/apigateway/v1beta1/restapipolicy.yaml similarity index 100% rename from examples-generated/apigateway/restapipolicy.yaml rename to examples-generated/apigateway/v1beta1/restapipolicy.yaml diff --git a/examples-generated/apigateway/stage.yaml b/examples-generated/apigateway/v1beta1/stage.yaml similarity index 100% rename from examples-generated/apigateway/stage.yaml rename to examples-generated/apigateway/v1beta1/stage.yaml diff --git a/examples-generated/apigateway/usageplan.yaml b/examples-generated/apigateway/v1beta1/usageplan.yaml similarity index 100% rename from examples-generated/apigateway/usageplan.yaml rename to examples-generated/apigateway/v1beta1/usageplan.yaml diff --git a/examples-generated/apigateway/usageplankey.yaml b/examples-generated/apigateway/v1beta1/usageplankey.yaml similarity index 100% rename from examples-generated/apigateway/usageplankey.yaml rename to examples-generated/apigateway/v1beta1/usageplankey.yaml diff --git a/examples-generated/apigateway/vpclink.yaml b/examples-generated/apigateway/v1beta1/vpclink.yaml similarity index 100% rename from examples-generated/apigateway/vpclink.yaml rename to examples-generated/apigateway/v1beta1/vpclink.yaml diff --git a/examples-generated/apigatewayv2/api.yaml b/examples-generated/apigatewayv2/v1beta1/api.yaml similarity index 100% rename from examples-generated/apigatewayv2/api.yaml rename to examples-generated/apigatewayv2/v1beta1/api.yaml diff --git a/examples-generated/apigatewayv2/apimapping.yaml b/examples-generated/apigatewayv2/v1beta1/apimapping.yaml similarity index 100% rename from examples-generated/apigatewayv2/apimapping.yaml rename to examples-generated/apigatewayv2/v1beta1/apimapping.yaml diff --git a/examples-generated/apigatewayv2/authorizer.yaml b/examples-generated/apigatewayv2/v1beta1/authorizer.yaml similarity index 100% rename from examples-generated/apigatewayv2/authorizer.yaml rename to examples-generated/apigatewayv2/v1beta1/authorizer.yaml diff --git a/examples-generated/apigatewayv2/deployment.yaml b/examples-generated/apigatewayv2/v1beta1/deployment.yaml similarity index 100% rename from examples-generated/apigatewayv2/deployment.yaml rename to examples-generated/apigatewayv2/v1beta1/deployment.yaml diff --git a/examples-generated/apigatewayv2/domainname.yaml b/examples-generated/apigatewayv2/v1beta1/domainname.yaml similarity index 100% rename from examples-generated/apigatewayv2/domainname.yaml rename to examples-generated/apigatewayv2/v1beta1/domainname.yaml diff --git a/examples-generated/apigatewayv2/integration.yaml b/examples-generated/apigatewayv2/v1beta1/integration.yaml similarity index 100% rename from examples-generated/apigatewayv2/integration.yaml rename to examples-generated/apigatewayv2/v1beta1/integration.yaml diff --git a/examples-generated/apigatewayv2/integrationresponse.yaml b/examples-generated/apigatewayv2/v1beta1/integrationresponse.yaml similarity index 100% rename from examples-generated/apigatewayv2/integrationresponse.yaml rename to examples-generated/apigatewayv2/v1beta1/integrationresponse.yaml diff --git a/examples-generated/apigatewayv2/model.yaml b/examples-generated/apigatewayv2/v1beta1/model.yaml similarity index 100% rename from examples-generated/apigatewayv2/model.yaml rename to examples-generated/apigatewayv2/v1beta1/model.yaml diff --git a/examples-generated/apigatewayv2/route.yaml b/examples-generated/apigatewayv2/v1beta1/route.yaml similarity index 100% rename from examples-generated/apigatewayv2/route.yaml rename to examples-generated/apigatewayv2/v1beta1/route.yaml diff --git a/examples-generated/apigatewayv2/routeresponse.yaml b/examples-generated/apigatewayv2/v1beta1/routeresponse.yaml similarity index 100% rename from examples-generated/apigatewayv2/routeresponse.yaml rename to examples-generated/apigatewayv2/v1beta1/routeresponse.yaml diff --git a/examples-generated/apigatewayv2/stage.yaml b/examples-generated/apigatewayv2/v1beta1/stage.yaml similarity index 100% rename from examples-generated/apigatewayv2/stage.yaml rename to examples-generated/apigatewayv2/v1beta1/stage.yaml diff --git a/examples-generated/apigatewayv2/vpclink.yaml b/examples-generated/apigatewayv2/v1beta1/vpclink.yaml similarity index 100% rename from examples-generated/apigatewayv2/vpclink.yaml rename to examples-generated/apigatewayv2/v1beta1/vpclink.yaml diff --git a/examples-generated/appautoscaling/policy.yaml b/examples-generated/appautoscaling/v1beta1/policy.yaml similarity index 100% rename from examples-generated/appautoscaling/policy.yaml rename to examples-generated/appautoscaling/v1beta1/policy.yaml diff --git a/examples-generated/appautoscaling/scheduledaction.yaml b/examples-generated/appautoscaling/v1beta1/scheduledaction.yaml similarity index 100% rename from examples-generated/appautoscaling/scheduledaction.yaml rename to examples-generated/appautoscaling/v1beta1/scheduledaction.yaml diff --git a/examples-generated/appautoscaling/target.yaml b/examples-generated/appautoscaling/v1beta1/target.yaml similarity index 100% rename from examples-generated/appautoscaling/target.yaml rename to examples-generated/appautoscaling/v1beta1/target.yaml diff --git a/examples-generated/appconfig/application.yaml b/examples-generated/appconfig/v1beta1/application.yaml similarity index 100% rename from examples-generated/appconfig/application.yaml rename to examples-generated/appconfig/v1beta1/application.yaml diff --git a/examples-generated/appconfig/configurationprofile.yaml b/examples-generated/appconfig/v1beta1/configurationprofile.yaml similarity index 100% rename from examples-generated/appconfig/configurationprofile.yaml rename to examples-generated/appconfig/v1beta1/configurationprofile.yaml diff --git a/examples-generated/appconfig/deployment.yaml b/examples-generated/appconfig/v1beta1/deployment.yaml similarity index 100% rename from examples-generated/appconfig/deployment.yaml rename to examples-generated/appconfig/v1beta1/deployment.yaml diff --git a/examples-generated/appconfig/deploymentstrategy.yaml b/examples-generated/appconfig/v1beta1/deploymentstrategy.yaml similarity index 100% rename from examples-generated/appconfig/deploymentstrategy.yaml rename to examples-generated/appconfig/v1beta1/deploymentstrategy.yaml diff --git a/examples-generated/appconfig/environment.yaml b/examples-generated/appconfig/v1beta1/environment.yaml similarity index 100% rename from examples-generated/appconfig/environment.yaml rename to examples-generated/appconfig/v1beta1/environment.yaml diff --git a/examples-generated/appconfig/extension.yaml b/examples-generated/appconfig/v1beta1/extension.yaml similarity index 100% rename from examples-generated/appconfig/extension.yaml rename to examples-generated/appconfig/v1beta1/extension.yaml diff --git a/examples-generated/appconfig/extensionassociation.yaml b/examples-generated/appconfig/v1beta1/extensionassociation.yaml similarity index 100% rename from examples-generated/appconfig/extensionassociation.yaml rename to examples-generated/appconfig/v1beta1/extensionassociation.yaml diff --git a/examples-generated/appconfig/hostedconfigurationversion.yaml b/examples-generated/appconfig/v1beta1/hostedconfigurationversion.yaml similarity index 100% rename from examples-generated/appconfig/hostedconfigurationversion.yaml rename to examples-generated/appconfig/v1beta1/hostedconfigurationversion.yaml diff --git a/examples-generated/appflow/flow.yaml b/examples-generated/appflow/v1beta1/flow.yaml similarity index 100% rename from examples-generated/appflow/flow.yaml rename to examples-generated/appflow/v1beta1/flow.yaml diff --git a/examples-generated/appintegrations/eventintegration.yaml b/examples-generated/appintegrations/v1beta1/eventintegration.yaml similarity index 100% rename from examples-generated/appintegrations/eventintegration.yaml rename to examples-generated/appintegrations/v1beta1/eventintegration.yaml diff --git a/examples-generated/applicationinsights/application.yaml b/examples-generated/applicationinsights/v1beta1/application.yaml similarity index 100% rename from examples-generated/applicationinsights/application.yaml rename to examples-generated/applicationinsights/v1beta1/application.yaml diff --git a/examples-generated/appmesh/gatewayroute.yaml b/examples-generated/appmesh/v1beta1/gatewayroute.yaml similarity index 100% rename from examples-generated/appmesh/gatewayroute.yaml rename to examples-generated/appmesh/v1beta1/gatewayroute.yaml diff --git a/examples-generated/appmesh/mesh.yaml b/examples-generated/appmesh/v1beta1/mesh.yaml similarity index 100% rename from examples-generated/appmesh/mesh.yaml rename to examples-generated/appmesh/v1beta1/mesh.yaml diff --git a/examples-generated/appmesh/route.yaml b/examples-generated/appmesh/v1beta1/route.yaml similarity index 100% rename from examples-generated/appmesh/route.yaml rename to examples-generated/appmesh/v1beta1/route.yaml diff --git a/examples-generated/appmesh/virtualgateway.yaml b/examples-generated/appmesh/v1beta1/virtualgateway.yaml similarity index 100% rename from examples-generated/appmesh/virtualgateway.yaml rename to examples-generated/appmesh/v1beta1/virtualgateway.yaml diff --git a/examples-generated/appmesh/virtualnode.yaml b/examples-generated/appmesh/v1beta1/virtualnode.yaml similarity index 100% rename from examples-generated/appmesh/virtualnode.yaml rename to examples-generated/appmesh/v1beta1/virtualnode.yaml diff --git a/examples-generated/appmesh/virtualrouter.yaml b/examples-generated/appmesh/v1beta1/virtualrouter.yaml similarity index 100% rename from examples-generated/appmesh/virtualrouter.yaml rename to examples-generated/appmesh/v1beta1/virtualrouter.yaml diff --git a/examples-generated/appmesh/virtualservice.yaml b/examples-generated/appmesh/v1beta1/virtualservice.yaml similarity index 100% rename from examples-generated/appmesh/virtualservice.yaml rename to examples-generated/appmesh/v1beta1/virtualservice.yaml diff --git a/examples-generated/apprunner/autoscalingconfigurationversion.yaml b/examples-generated/apprunner/v1beta1/autoscalingconfigurationversion.yaml similarity index 100% rename from examples-generated/apprunner/autoscalingconfigurationversion.yaml rename to examples-generated/apprunner/v1beta1/autoscalingconfigurationversion.yaml diff --git a/examples-generated/apprunner/connection.yaml b/examples-generated/apprunner/v1beta1/connection.yaml similarity index 100% rename from examples-generated/apprunner/connection.yaml rename to examples-generated/apprunner/v1beta1/connection.yaml diff --git a/examples-generated/apprunner/observabilityconfiguration.yaml b/examples-generated/apprunner/v1beta1/observabilityconfiguration.yaml similarity index 100% rename from examples-generated/apprunner/observabilityconfiguration.yaml rename to examples-generated/apprunner/v1beta1/observabilityconfiguration.yaml diff --git a/examples-generated/apprunner/service.yaml b/examples-generated/apprunner/v1beta1/service.yaml similarity index 100% rename from examples-generated/apprunner/service.yaml rename to examples-generated/apprunner/v1beta1/service.yaml diff --git a/examples-generated/apprunner/vpcconnector.yaml b/examples-generated/apprunner/v1beta1/vpcconnector.yaml similarity index 100% rename from examples-generated/apprunner/vpcconnector.yaml rename to examples-generated/apprunner/v1beta1/vpcconnector.yaml diff --git a/examples-generated/appstream/directoryconfig.yaml b/examples-generated/appstream/v1beta1/directoryconfig.yaml similarity index 100% rename from examples-generated/appstream/directoryconfig.yaml rename to examples-generated/appstream/v1beta1/directoryconfig.yaml diff --git a/examples-generated/appstream/fleet.yaml b/examples-generated/appstream/v1beta1/fleet.yaml similarity index 100% rename from examples-generated/appstream/fleet.yaml rename to examples-generated/appstream/v1beta1/fleet.yaml diff --git a/examples-generated/appstream/fleetstackassociation.yaml b/examples-generated/appstream/v1beta1/fleetstackassociation.yaml similarity index 100% rename from examples-generated/appstream/fleetstackassociation.yaml rename to examples-generated/appstream/v1beta1/fleetstackassociation.yaml diff --git a/examples-generated/appstream/imagebuilder.yaml b/examples-generated/appstream/v1beta1/imagebuilder.yaml similarity index 100% rename from examples-generated/appstream/imagebuilder.yaml rename to examples-generated/appstream/v1beta1/imagebuilder.yaml diff --git a/examples-generated/appstream/stack.yaml b/examples-generated/appstream/v1beta1/stack.yaml similarity index 100% rename from examples-generated/appstream/stack.yaml rename to examples-generated/appstream/v1beta1/stack.yaml diff --git a/examples-generated/appstream/user.yaml b/examples-generated/appstream/v1beta1/user.yaml similarity index 100% rename from examples-generated/appstream/user.yaml rename to examples-generated/appstream/v1beta1/user.yaml diff --git a/examples-generated/appstream/userstackassociation.yaml b/examples-generated/appstream/v1beta1/userstackassociation.yaml similarity index 100% rename from examples-generated/appstream/userstackassociation.yaml rename to examples-generated/appstream/v1beta1/userstackassociation.yaml diff --git a/examples-generated/appsync/apicache.yaml b/examples-generated/appsync/v1beta1/apicache.yaml similarity index 100% rename from examples-generated/appsync/apicache.yaml rename to examples-generated/appsync/v1beta1/apicache.yaml diff --git a/examples-generated/appsync/apikey.yaml b/examples-generated/appsync/v1beta1/apikey.yaml similarity index 100% rename from examples-generated/appsync/apikey.yaml rename to examples-generated/appsync/v1beta1/apikey.yaml diff --git a/examples-generated/appsync/datasource.yaml b/examples-generated/appsync/v1beta1/datasource.yaml similarity index 100% rename from examples-generated/appsync/datasource.yaml rename to examples-generated/appsync/v1beta1/datasource.yaml diff --git a/examples-generated/appsync/function.yaml b/examples-generated/appsync/v1beta1/function.yaml similarity index 100% rename from examples-generated/appsync/function.yaml rename to examples-generated/appsync/v1beta1/function.yaml diff --git a/examples-generated/appsync/graphqlapi.yaml b/examples-generated/appsync/v1beta1/graphqlapi.yaml similarity index 100% rename from examples-generated/appsync/graphqlapi.yaml rename to examples-generated/appsync/v1beta1/graphqlapi.yaml diff --git a/examples-generated/appsync/resolver.yaml b/examples-generated/appsync/v1beta1/resolver.yaml similarity index 100% rename from examples-generated/appsync/resolver.yaml rename to examples-generated/appsync/v1beta1/resolver.yaml diff --git a/examples-generated/athena/database.yaml b/examples-generated/athena/v1beta1/database.yaml similarity index 100% rename from examples-generated/athena/database.yaml rename to examples-generated/athena/v1beta1/database.yaml diff --git a/examples-generated/athena/datacatalog.yaml b/examples-generated/athena/v1beta1/datacatalog.yaml similarity index 100% rename from examples-generated/athena/datacatalog.yaml rename to examples-generated/athena/v1beta1/datacatalog.yaml diff --git a/examples-generated/athena/namedquery.yaml b/examples-generated/athena/v1beta1/namedquery.yaml similarity index 100% rename from examples-generated/athena/namedquery.yaml rename to examples-generated/athena/v1beta1/namedquery.yaml diff --git a/examples-generated/athena/workgroup.yaml b/examples-generated/athena/v1beta1/workgroup.yaml similarity index 100% rename from examples-generated/athena/workgroup.yaml rename to examples-generated/athena/v1beta1/workgroup.yaml diff --git a/examples-generated/autoscaling/attachment.yaml b/examples-generated/autoscaling/v1beta1/attachment.yaml similarity index 100% rename from examples-generated/autoscaling/attachment.yaml rename to examples-generated/autoscaling/v1beta1/attachment.yaml diff --git a/examples-generated/autoscaling/autoscalinggroup.yaml b/examples-generated/autoscaling/v1beta1/autoscalinggroup.yaml similarity index 100% rename from examples-generated/autoscaling/autoscalinggroup.yaml rename to examples-generated/autoscaling/v1beta1/autoscalinggroup.yaml diff --git a/examples-generated/autoscaling/grouptag.yaml b/examples-generated/autoscaling/v1beta1/grouptag.yaml similarity index 100% rename from examples-generated/autoscaling/grouptag.yaml rename to examples-generated/autoscaling/v1beta1/grouptag.yaml diff --git a/examples-generated/autoscaling/launchconfiguration.yaml b/examples-generated/autoscaling/v1beta1/launchconfiguration.yaml similarity index 100% rename from examples-generated/autoscaling/launchconfiguration.yaml rename to examples-generated/autoscaling/v1beta1/launchconfiguration.yaml diff --git a/examples-generated/autoscaling/lifecyclehook.yaml b/examples-generated/autoscaling/v1beta1/lifecyclehook.yaml similarity index 100% rename from examples-generated/autoscaling/lifecyclehook.yaml rename to examples-generated/autoscaling/v1beta1/lifecyclehook.yaml diff --git a/examples-generated/autoscaling/notification.yaml b/examples-generated/autoscaling/v1beta1/notification.yaml similarity index 100% rename from examples-generated/autoscaling/notification.yaml rename to examples-generated/autoscaling/v1beta1/notification.yaml diff --git a/examples-generated/autoscaling/policy.yaml b/examples-generated/autoscaling/v1beta1/policy.yaml similarity index 100% rename from examples-generated/autoscaling/policy.yaml rename to examples-generated/autoscaling/v1beta1/policy.yaml diff --git a/examples-generated/autoscaling/schedule.yaml b/examples-generated/autoscaling/v1beta1/schedule.yaml similarity index 100% rename from examples-generated/autoscaling/schedule.yaml rename to examples-generated/autoscaling/v1beta1/schedule.yaml diff --git a/examples-generated/autoscalingplans/scalingplan.yaml b/examples-generated/autoscalingplans/v1beta1/scalingplan.yaml similarity index 100% rename from examples-generated/autoscalingplans/scalingplan.yaml rename to examples-generated/autoscalingplans/v1beta1/scalingplan.yaml diff --git a/examples-generated/backup/framework.yaml b/examples-generated/backup/v1beta1/framework.yaml similarity index 100% rename from examples-generated/backup/framework.yaml rename to examples-generated/backup/v1beta1/framework.yaml diff --git a/examples-generated/backup/globalsettings.yaml b/examples-generated/backup/v1beta1/globalsettings.yaml similarity index 100% rename from examples-generated/backup/globalsettings.yaml rename to examples-generated/backup/v1beta1/globalsettings.yaml diff --git a/examples-generated/backup/plan.yaml b/examples-generated/backup/v1beta1/plan.yaml similarity index 100% rename from examples-generated/backup/plan.yaml rename to examples-generated/backup/v1beta1/plan.yaml diff --git a/examples-generated/backup/regionsettings.yaml b/examples-generated/backup/v1beta1/regionsettings.yaml similarity index 100% rename from examples-generated/backup/regionsettings.yaml rename to examples-generated/backup/v1beta1/regionsettings.yaml diff --git a/examples-generated/backup/reportplan.yaml b/examples-generated/backup/v1beta1/reportplan.yaml similarity index 100% rename from examples-generated/backup/reportplan.yaml rename to examples-generated/backup/v1beta1/reportplan.yaml diff --git a/examples-generated/backup/selection.yaml b/examples-generated/backup/v1beta1/selection.yaml similarity index 100% rename from examples-generated/backup/selection.yaml rename to examples-generated/backup/v1beta1/selection.yaml diff --git a/examples-generated/backup/vault.yaml b/examples-generated/backup/v1beta1/vault.yaml similarity index 100% rename from examples-generated/backup/vault.yaml rename to examples-generated/backup/v1beta1/vault.yaml diff --git a/examples-generated/backup/vaultlockconfiguration.yaml b/examples-generated/backup/v1beta1/vaultlockconfiguration.yaml similarity index 100% rename from examples-generated/backup/vaultlockconfiguration.yaml rename to examples-generated/backup/v1beta1/vaultlockconfiguration.yaml diff --git a/examples-generated/backup/vaultnotifications.yaml b/examples-generated/backup/v1beta1/vaultnotifications.yaml similarity index 100% rename from examples-generated/backup/vaultnotifications.yaml rename to examples-generated/backup/v1beta1/vaultnotifications.yaml diff --git a/examples-generated/backup/vaultpolicy.yaml b/examples-generated/backup/v1beta1/vaultpolicy.yaml similarity index 100% rename from examples-generated/backup/vaultpolicy.yaml rename to examples-generated/backup/v1beta1/vaultpolicy.yaml diff --git a/examples-generated/batch/jobdefinition.yaml b/examples-generated/batch/v1beta1/jobdefinition.yaml similarity index 100% rename from examples-generated/batch/jobdefinition.yaml rename to examples-generated/batch/v1beta1/jobdefinition.yaml diff --git a/examples-generated/batch/schedulingpolicy.yaml b/examples-generated/batch/v1beta1/schedulingpolicy.yaml similarity index 100% rename from examples-generated/batch/schedulingpolicy.yaml rename to examples-generated/batch/v1beta1/schedulingpolicy.yaml diff --git a/examples-generated/budgets/budget.yaml b/examples-generated/budgets/v1beta1/budget.yaml similarity index 100% rename from examples-generated/budgets/budget.yaml rename to examples-generated/budgets/v1beta1/budget.yaml diff --git a/examples-generated/budgets/budgetaction.yaml b/examples-generated/budgets/v1beta1/budgetaction.yaml similarity index 100% rename from examples-generated/budgets/budgetaction.yaml rename to examples-generated/budgets/v1beta1/budgetaction.yaml diff --git a/examples-generated/ce/anomalymonitor.yaml b/examples-generated/ce/v1beta1/anomalymonitor.yaml similarity index 100% rename from examples-generated/ce/anomalymonitor.yaml rename to examples-generated/ce/v1beta1/anomalymonitor.yaml diff --git a/examples-generated/chime/voiceconnector.yaml b/examples-generated/chime/v1beta1/voiceconnector.yaml similarity index 100% rename from examples-generated/chime/voiceconnector.yaml rename to examples-generated/chime/v1beta1/voiceconnector.yaml diff --git a/examples-generated/chime/voiceconnectorgroup.yaml b/examples-generated/chime/v1beta1/voiceconnectorgroup.yaml similarity index 100% rename from examples-generated/chime/voiceconnectorgroup.yaml rename to examples-generated/chime/v1beta1/voiceconnectorgroup.yaml diff --git a/examples-generated/chime/voiceconnectorlogging.yaml b/examples-generated/chime/v1beta1/voiceconnectorlogging.yaml similarity index 100% rename from examples-generated/chime/voiceconnectorlogging.yaml rename to examples-generated/chime/v1beta1/voiceconnectorlogging.yaml diff --git a/examples-generated/chime/voiceconnectororigination.yaml b/examples-generated/chime/v1beta1/voiceconnectororigination.yaml similarity index 100% rename from examples-generated/chime/voiceconnectororigination.yaml rename to examples-generated/chime/v1beta1/voiceconnectororigination.yaml diff --git a/examples-generated/chime/voiceconnectorstreaming.yaml b/examples-generated/chime/v1beta1/voiceconnectorstreaming.yaml similarity index 100% rename from examples-generated/chime/voiceconnectorstreaming.yaml rename to examples-generated/chime/v1beta1/voiceconnectorstreaming.yaml diff --git a/examples-generated/chime/voiceconnectortermination.yaml b/examples-generated/chime/v1beta1/voiceconnectortermination.yaml similarity index 100% rename from examples-generated/chime/voiceconnectortermination.yaml rename to examples-generated/chime/v1beta1/voiceconnectortermination.yaml diff --git a/examples-generated/chime/voiceconnectorterminationcredentials.yaml b/examples-generated/chime/v1beta1/voiceconnectorterminationcredentials.yaml similarity index 100% rename from examples-generated/chime/voiceconnectorterminationcredentials.yaml rename to examples-generated/chime/v1beta1/voiceconnectorterminationcredentials.yaml diff --git a/examples-generated/cloud9/environmentec2.yaml b/examples-generated/cloud9/v1beta1/environmentec2.yaml similarity index 100% rename from examples-generated/cloud9/environmentec2.yaml rename to examples-generated/cloud9/v1beta1/environmentec2.yaml diff --git a/examples-generated/cloud9/environmentmembership.yaml b/examples-generated/cloud9/v1beta1/environmentmembership.yaml similarity index 100% rename from examples-generated/cloud9/environmentmembership.yaml rename to examples-generated/cloud9/v1beta1/environmentmembership.yaml diff --git a/examples-generated/cloudcontrol/resource.yaml b/examples-generated/cloudcontrol/v1beta1/resource.yaml similarity index 100% rename from examples-generated/cloudcontrol/resource.yaml rename to examples-generated/cloudcontrol/v1beta1/resource.yaml diff --git a/examples-generated/cloudformation/stack.yaml b/examples-generated/cloudformation/v1beta1/stack.yaml similarity index 100% rename from examples-generated/cloudformation/stack.yaml rename to examples-generated/cloudformation/v1beta1/stack.yaml diff --git a/examples-generated/cloudformation/stackset.yaml b/examples-generated/cloudformation/v1beta1/stackset.yaml similarity index 100% rename from examples-generated/cloudformation/stackset.yaml rename to examples-generated/cloudformation/v1beta1/stackset.yaml diff --git a/examples-generated/cloudfront/cachepolicy.yaml b/examples-generated/cloudfront/v1beta1/cachepolicy.yaml similarity index 100% rename from examples-generated/cloudfront/cachepolicy.yaml rename to examples-generated/cloudfront/v1beta1/cachepolicy.yaml diff --git a/examples-generated/cloudfront/distribution.yaml b/examples-generated/cloudfront/v1beta1/distribution.yaml similarity index 100% rename from examples-generated/cloudfront/distribution.yaml rename to examples-generated/cloudfront/v1beta1/distribution.yaml diff --git a/examples-generated/cloudfront/fieldlevelencryptionconfig.yaml b/examples-generated/cloudfront/v1beta1/fieldlevelencryptionconfig.yaml similarity index 100% rename from examples-generated/cloudfront/fieldlevelencryptionconfig.yaml rename to examples-generated/cloudfront/v1beta1/fieldlevelencryptionconfig.yaml diff --git a/examples-generated/cloudfront/fieldlevelencryptionprofile.yaml b/examples-generated/cloudfront/v1beta1/fieldlevelencryptionprofile.yaml similarity index 100% rename from examples-generated/cloudfront/fieldlevelencryptionprofile.yaml rename to examples-generated/cloudfront/v1beta1/fieldlevelencryptionprofile.yaml diff --git a/examples-generated/cloudfront/function.yaml b/examples-generated/cloudfront/v1beta1/function.yaml similarity index 100% rename from examples-generated/cloudfront/function.yaml rename to examples-generated/cloudfront/v1beta1/function.yaml diff --git a/examples-generated/cloudfront/keygroup.yaml b/examples-generated/cloudfront/v1beta1/keygroup.yaml similarity index 100% rename from examples-generated/cloudfront/keygroup.yaml rename to examples-generated/cloudfront/v1beta1/keygroup.yaml diff --git a/examples-generated/cloudfront/monitoringsubscription.yaml b/examples-generated/cloudfront/v1beta1/monitoringsubscription.yaml similarity index 100% rename from examples-generated/cloudfront/monitoringsubscription.yaml rename to examples-generated/cloudfront/v1beta1/monitoringsubscription.yaml diff --git a/examples-generated/cloudfront/originaccesscontrol.yaml b/examples-generated/cloudfront/v1beta1/originaccesscontrol.yaml similarity index 100% rename from examples-generated/cloudfront/originaccesscontrol.yaml rename to examples-generated/cloudfront/v1beta1/originaccesscontrol.yaml diff --git a/examples-generated/cloudfront/originaccessidentity.yaml b/examples-generated/cloudfront/v1beta1/originaccessidentity.yaml similarity index 100% rename from examples-generated/cloudfront/originaccessidentity.yaml rename to examples-generated/cloudfront/v1beta1/originaccessidentity.yaml diff --git a/examples-generated/cloudfront/originrequestpolicy.yaml b/examples-generated/cloudfront/v1beta1/originrequestpolicy.yaml similarity index 100% rename from examples-generated/cloudfront/originrequestpolicy.yaml rename to examples-generated/cloudfront/v1beta1/originrequestpolicy.yaml diff --git a/examples-generated/cloudfront/publickey.yaml b/examples-generated/cloudfront/v1beta1/publickey.yaml similarity index 100% rename from examples-generated/cloudfront/publickey.yaml rename to examples-generated/cloudfront/v1beta1/publickey.yaml diff --git a/examples-generated/cloudfront/realtimelogconfig.yaml b/examples-generated/cloudfront/v1beta1/realtimelogconfig.yaml similarity index 100% rename from examples-generated/cloudfront/realtimelogconfig.yaml rename to examples-generated/cloudfront/v1beta1/realtimelogconfig.yaml diff --git a/examples-generated/cloudfront/responseheaderspolicy.yaml b/examples-generated/cloudfront/v1beta1/responseheaderspolicy.yaml similarity index 100% rename from examples-generated/cloudfront/responseheaderspolicy.yaml rename to examples-generated/cloudfront/v1beta1/responseheaderspolicy.yaml diff --git a/examples-generated/cloudsearch/domain.yaml b/examples-generated/cloudsearch/v1beta1/domain.yaml similarity index 100% rename from examples-generated/cloudsearch/domain.yaml rename to examples-generated/cloudsearch/v1beta1/domain.yaml diff --git a/examples-generated/cloudsearch/domainserviceaccesspolicy.yaml b/examples-generated/cloudsearch/v1beta1/domainserviceaccesspolicy.yaml similarity index 100% rename from examples-generated/cloudsearch/domainserviceaccesspolicy.yaml rename to examples-generated/cloudsearch/v1beta1/domainserviceaccesspolicy.yaml diff --git a/examples-generated/cloudtrail/eventdatastore.yaml b/examples-generated/cloudtrail/v1beta1/eventdatastore.yaml similarity index 100% rename from examples-generated/cloudtrail/eventdatastore.yaml rename to examples-generated/cloudtrail/v1beta1/eventdatastore.yaml diff --git a/examples-generated/cloudtrail/trail.yaml b/examples-generated/cloudtrail/v1beta1/trail.yaml similarity index 100% rename from examples-generated/cloudtrail/trail.yaml rename to examples-generated/cloudtrail/v1beta1/trail.yaml diff --git a/examples-generated/cloudwatch/compositealarm.yaml b/examples-generated/cloudwatch/v1beta1/compositealarm.yaml similarity index 100% rename from examples-generated/cloudwatch/compositealarm.yaml rename to examples-generated/cloudwatch/v1beta1/compositealarm.yaml diff --git a/examples-generated/cloudwatch/dashboard.yaml b/examples-generated/cloudwatch/v1beta1/dashboard.yaml similarity index 100% rename from examples-generated/cloudwatch/dashboard.yaml rename to examples-generated/cloudwatch/v1beta1/dashboard.yaml diff --git a/examples-generated/cloudwatch/metricalarm.yaml b/examples-generated/cloudwatch/v1beta1/metricalarm.yaml similarity index 100% rename from examples-generated/cloudwatch/metricalarm.yaml rename to examples-generated/cloudwatch/v1beta1/metricalarm.yaml diff --git a/examples-generated/cloudwatch/metricstream.yaml b/examples-generated/cloudwatch/v1beta1/metricstream.yaml similarity index 100% rename from examples-generated/cloudwatch/metricstream.yaml rename to examples-generated/cloudwatch/v1beta1/metricstream.yaml diff --git a/examples-generated/cloudwatchevents/apidestination.yaml b/examples-generated/cloudwatchevents/v1beta1/apidestination.yaml similarity index 100% rename from examples-generated/cloudwatchevents/apidestination.yaml rename to examples-generated/cloudwatchevents/v1beta1/apidestination.yaml diff --git a/examples-generated/cloudwatchevents/archive.yaml b/examples-generated/cloudwatchevents/v1beta1/archive.yaml similarity index 100% rename from examples-generated/cloudwatchevents/archive.yaml rename to examples-generated/cloudwatchevents/v1beta1/archive.yaml diff --git a/examples-generated/cloudwatchevents/bus.yaml b/examples-generated/cloudwatchevents/v1beta1/bus.yaml similarity index 100% rename from examples-generated/cloudwatchevents/bus.yaml rename to examples-generated/cloudwatchevents/v1beta1/bus.yaml diff --git a/examples-generated/cloudwatchevents/buspolicy.yaml b/examples-generated/cloudwatchevents/v1beta1/buspolicy.yaml similarity index 100% rename from examples-generated/cloudwatchevents/buspolicy.yaml rename to examples-generated/cloudwatchevents/v1beta1/buspolicy.yaml diff --git a/examples-generated/cloudwatchevents/connection.yaml b/examples-generated/cloudwatchevents/v1beta1/connection.yaml similarity index 100% rename from examples-generated/cloudwatchevents/connection.yaml rename to examples-generated/cloudwatchevents/v1beta1/connection.yaml diff --git a/examples-generated/cloudwatchevents/permission.yaml b/examples-generated/cloudwatchevents/v1beta1/permission.yaml similarity index 100% rename from examples-generated/cloudwatchevents/permission.yaml rename to examples-generated/cloudwatchevents/v1beta1/permission.yaml diff --git a/examples-generated/cloudwatchevents/rule.yaml b/examples-generated/cloudwatchevents/v1beta1/rule.yaml similarity index 100% rename from examples-generated/cloudwatchevents/rule.yaml rename to examples-generated/cloudwatchevents/v1beta1/rule.yaml diff --git a/examples-generated/cloudwatchevents/target.yaml b/examples-generated/cloudwatchevents/v1beta1/target.yaml similarity index 100% rename from examples-generated/cloudwatchevents/target.yaml rename to examples-generated/cloudwatchevents/v1beta1/target.yaml diff --git a/examples-generated/cloudwatchlogs/definition.yaml b/examples-generated/cloudwatchlogs/v1beta1/definition.yaml similarity index 100% rename from examples-generated/cloudwatchlogs/definition.yaml rename to examples-generated/cloudwatchlogs/v1beta1/definition.yaml diff --git a/examples-generated/cloudwatchlogs/destination.yaml b/examples-generated/cloudwatchlogs/v1beta1/destination.yaml similarity index 100% rename from examples-generated/cloudwatchlogs/destination.yaml rename to examples-generated/cloudwatchlogs/v1beta1/destination.yaml diff --git a/examples-generated/cloudwatchlogs/destinationpolicy.yaml b/examples-generated/cloudwatchlogs/v1beta1/destinationpolicy.yaml similarity index 100% rename from examples-generated/cloudwatchlogs/destinationpolicy.yaml rename to examples-generated/cloudwatchlogs/v1beta1/destinationpolicy.yaml diff --git a/examples-generated/cloudwatchlogs/group.yaml b/examples-generated/cloudwatchlogs/v1beta1/group.yaml similarity index 100% rename from examples-generated/cloudwatchlogs/group.yaml rename to examples-generated/cloudwatchlogs/v1beta1/group.yaml diff --git a/examples-generated/cloudwatchlogs/metricfilter.yaml b/examples-generated/cloudwatchlogs/v1beta1/metricfilter.yaml similarity index 100% rename from examples-generated/cloudwatchlogs/metricfilter.yaml rename to examples-generated/cloudwatchlogs/v1beta1/metricfilter.yaml diff --git a/examples-generated/cloudwatchlogs/resourcepolicy.yaml b/examples-generated/cloudwatchlogs/v1beta1/resourcepolicy.yaml similarity index 100% rename from examples-generated/cloudwatchlogs/resourcepolicy.yaml rename to examples-generated/cloudwatchlogs/v1beta1/resourcepolicy.yaml diff --git a/examples-generated/cloudwatchlogs/stream.yaml b/examples-generated/cloudwatchlogs/v1beta1/stream.yaml similarity index 100% rename from examples-generated/cloudwatchlogs/stream.yaml rename to examples-generated/cloudwatchlogs/v1beta1/stream.yaml diff --git a/examples-generated/cloudwatchlogs/subscriptionfilter.yaml b/examples-generated/cloudwatchlogs/v1beta1/subscriptionfilter.yaml similarity index 100% rename from examples-generated/cloudwatchlogs/subscriptionfilter.yaml rename to examples-generated/cloudwatchlogs/v1beta1/subscriptionfilter.yaml diff --git a/examples-generated/codecommit/approvalruletemplate.yaml b/examples-generated/codecommit/v1beta1/approvalruletemplate.yaml similarity index 100% rename from examples-generated/codecommit/approvalruletemplate.yaml rename to examples-generated/codecommit/v1beta1/approvalruletemplate.yaml diff --git a/examples-generated/codecommit/approvalruletemplateassociation.yaml b/examples-generated/codecommit/v1beta1/approvalruletemplateassociation.yaml similarity index 100% rename from examples-generated/codecommit/approvalruletemplateassociation.yaml rename to examples-generated/codecommit/v1beta1/approvalruletemplateassociation.yaml diff --git a/examples-generated/codecommit/repository.yaml b/examples-generated/codecommit/v1beta1/repository.yaml similarity index 100% rename from examples-generated/codecommit/repository.yaml rename to examples-generated/codecommit/v1beta1/repository.yaml diff --git a/examples-generated/codecommit/trigger.yaml b/examples-generated/codecommit/v1beta1/trigger.yaml similarity index 100% rename from examples-generated/codecommit/trigger.yaml rename to examples-generated/codecommit/v1beta1/trigger.yaml diff --git a/examples-generated/codepipeline/codepipeline.yaml b/examples-generated/codepipeline/v1beta1/codepipeline.yaml similarity index 100% rename from examples-generated/codepipeline/codepipeline.yaml rename to examples-generated/codepipeline/v1beta1/codepipeline.yaml diff --git a/examples-generated/codepipeline/customactiontype.yaml b/examples-generated/codepipeline/v1beta1/customactiontype.yaml similarity index 100% rename from examples-generated/codepipeline/customactiontype.yaml rename to examples-generated/codepipeline/v1beta1/customactiontype.yaml diff --git a/examples-generated/codepipeline/webhook.yaml b/examples-generated/codepipeline/v1beta1/webhook.yaml similarity index 100% rename from examples-generated/codepipeline/webhook.yaml rename to examples-generated/codepipeline/v1beta1/webhook.yaml diff --git a/examples-generated/codestarconnections/connection.yaml b/examples-generated/codestarconnections/v1beta1/connection.yaml similarity index 100% rename from examples-generated/codestarconnections/connection.yaml rename to examples-generated/codestarconnections/v1beta1/connection.yaml diff --git a/examples-generated/codestarconnections/host.yaml b/examples-generated/codestarconnections/v1beta1/host.yaml similarity index 100% rename from examples-generated/codestarconnections/host.yaml rename to examples-generated/codestarconnections/v1beta1/host.yaml diff --git a/examples-generated/codestarnotifications/notificationrule.yaml b/examples-generated/codestarnotifications/v1beta1/notificationrule.yaml similarity index 100% rename from examples-generated/codestarnotifications/notificationrule.yaml rename to examples-generated/codestarnotifications/v1beta1/notificationrule.yaml diff --git a/examples-generated/cognitoidentity/cognitoidentitypoolproviderprincipaltag.yaml b/examples-generated/cognitoidentity/v1beta1/cognitoidentitypoolproviderprincipaltag.yaml similarity index 100% rename from examples-generated/cognitoidentity/cognitoidentitypoolproviderprincipaltag.yaml rename to examples-generated/cognitoidentity/v1beta1/cognitoidentitypoolproviderprincipaltag.yaml diff --git a/examples-generated/cognitoidentity/pool.yaml b/examples-generated/cognitoidentity/v1beta1/pool.yaml similarity index 100% rename from examples-generated/cognitoidentity/pool.yaml rename to examples-generated/cognitoidentity/v1beta1/pool.yaml diff --git a/examples-generated/cognitoidentity/poolrolesattachment.yaml b/examples-generated/cognitoidentity/v1beta1/poolrolesattachment.yaml similarity index 100% rename from examples-generated/cognitoidentity/poolrolesattachment.yaml rename to examples-generated/cognitoidentity/v1beta1/poolrolesattachment.yaml diff --git a/examples-generated/cognitoidp/identityprovider.yaml b/examples-generated/cognitoidp/v1beta1/identityprovider.yaml similarity index 100% rename from examples-generated/cognitoidp/identityprovider.yaml rename to examples-generated/cognitoidp/v1beta1/identityprovider.yaml diff --git a/examples-generated/cognitoidp/resourceserver.yaml b/examples-generated/cognitoidp/v1beta1/resourceserver.yaml similarity index 100% rename from examples-generated/cognitoidp/resourceserver.yaml rename to examples-generated/cognitoidp/v1beta1/resourceserver.yaml diff --git a/examples-generated/cognitoidp/riskconfiguration.yaml b/examples-generated/cognitoidp/v1beta1/riskconfiguration.yaml similarity index 100% rename from examples-generated/cognitoidp/riskconfiguration.yaml rename to examples-generated/cognitoidp/v1beta1/riskconfiguration.yaml diff --git a/examples-generated/cognitoidp/user.yaml b/examples-generated/cognitoidp/v1beta1/user.yaml similarity index 100% rename from examples-generated/cognitoidp/user.yaml rename to examples-generated/cognitoidp/v1beta1/user.yaml diff --git a/examples-generated/cognitoidp/usergroup.yaml b/examples-generated/cognitoidp/v1beta1/usergroup.yaml similarity index 100% rename from examples-generated/cognitoidp/usergroup.yaml rename to examples-generated/cognitoidp/v1beta1/usergroup.yaml diff --git a/examples-generated/cognitoidp/useringroup.yaml b/examples-generated/cognitoidp/v1beta1/useringroup.yaml similarity index 100% rename from examples-generated/cognitoidp/useringroup.yaml rename to examples-generated/cognitoidp/v1beta1/useringroup.yaml diff --git a/examples-generated/cognitoidp/userpool.yaml b/examples-generated/cognitoidp/v1beta1/userpool.yaml similarity index 100% rename from examples-generated/cognitoidp/userpool.yaml rename to examples-generated/cognitoidp/v1beta1/userpool.yaml diff --git a/examples-generated/cognitoidp/userpoolclient.yaml b/examples-generated/cognitoidp/v1beta1/userpoolclient.yaml similarity index 100% rename from examples-generated/cognitoidp/userpoolclient.yaml rename to examples-generated/cognitoidp/v1beta1/userpoolclient.yaml diff --git a/examples-generated/cognitoidp/userpooldomain.yaml b/examples-generated/cognitoidp/v1beta1/userpooldomain.yaml similarity index 100% rename from examples-generated/cognitoidp/userpooldomain.yaml rename to examples-generated/cognitoidp/v1beta1/userpooldomain.yaml diff --git a/examples-generated/cognitoidp/userpooluicustomization.yaml b/examples-generated/cognitoidp/v1beta1/userpooluicustomization.yaml similarity index 100% rename from examples-generated/cognitoidp/userpooluicustomization.yaml rename to examples-generated/cognitoidp/v1beta1/userpooluicustomization.yaml diff --git a/examples-generated/configservice/awsconfigurationrecorderstatus.yaml b/examples-generated/configservice/v1beta1/awsconfigurationrecorderstatus.yaml similarity index 100% rename from examples-generated/configservice/awsconfigurationrecorderstatus.yaml rename to examples-generated/configservice/v1beta1/awsconfigurationrecorderstatus.yaml diff --git a/examples-generated/configservice/configrule.yaml b/examples-generated/configservice/v1beta1/configrule.yaml similarity index 100% rename from examples-generated/configservice/configrule.yaml rename to examples-generated/configservice/v1beta1/configrule.yaml diff --git a/examples-generated/configservice/configurationaggregator.yaml b/examples-generated/configservice/v1beta1/configurationaggregator.yaml similarity index 100% rename from examples-generated/configservice/configurationaggregator.yaml rename to examples-generated/configservice/v1beta1/configurationaggregator.yaml diff --git a/examples-generated/configservice/configurationrecorder.yaml b/examples-generated/configservice/v1beta1/configurationrecorder.yaml similarity index 100% rename from examples-generated/configservice/configurationrecorder.yaml rename to examples-generated/configservice/v1beta1/configurationrecorder.yaml diff --git a/examples-generated/configservice/conformancepack.yaml b/examples-generated/configservice/v1beta1/conformancepack.yaml similarity index 100% rename from examples-generated/configservice/conformancepack.yaml rename to examples-generated/configservice/v1beta1/conformancepack.yaml diff --git a/examples-generated/configservice/deliverychannel.yaml b/examples-generated/configservice/v1beta1/deliverychannel.yaml similarity index 100% rename from examples-generated/configservice/deliverychannel.yaml rename to examples-generated/configservice/v1beta1/deliverychannel.yaml diff --git a/examples-generated/configservice/remediationconfiguration.yaml b/examples-generated/configservice/v1beta1/remediationconfiguration.yaml similarity index 100% rename from examples-generated/configservice/remediationconfiguration.yaml rename to examples-generated/configservice/v1beta1/remediationconfiguration.yaml diff --git a/examples-generated/connect/botassociation.yaml b/examples-generated/connect/v1beta1/botassociation.yaml similarity index 100% rename from examples-generated/connect/botassociation.yaml rename to examples-generated/connect/v1beta1/botassociation.yaml diff --git a/examples-generated/connect/contactflow.yaml b/examples-generated/connect/v1beta1/contactflow.yaml similarity index 100% rename from examples-generated/connect/contactflow.yaml rename to examples-generated/connect/v1beta1/contactflow.yaml diff --git a/examples-generated/connect/contactflowmodule.yaml b/examples-generated/connect/v1beta1/contactflowmodule.yaml similarity index 100% rename from examples-generated/connect/contactflowmodule.yaml rename to examples-generated/connect/v1beta1/contactflowmodule.yaml diff --git a/examples-generated/connect/hoursofoperation.yaml b/examples-generated/connect/v1beta1/hoursofoperation.yaml similarity index 100% rename from examples-generated/connect/hoursofoperation.yaml rename to examples-generated/connect/v1beta1/hoursofoperation.yaml diff --git a/examples-generated/connect/instance.yaml b/examples-generated/connect/v1beta1/instance.yaml similarity index 100% rename from examples-generated/connect/instance.yaml rename to examples-generated/connect/v1beta1/instance.yaml diff --git a/examples-generated/connect/instancestorageconfig.yaml b/examples-generated/connect/v1beta1/instancestorageconfig.yaml similarity index 100% rename from examples-generated/connect/instancestorageconfig.yaml rename to examples-generated/connect/v1beta1/instancestorageconfig.yaml diff --git a/examples-generated/connect/lambdafunctionassociation.yaml b/examples-generated/connect/v1beta1/lambdafunctionassociation.yaml similarity index 100% rename from examples-generated/connect/lambdafunctionassociation.yaml rename to examples-generated/connect/v1beta1/lambdafunctionassociation.yaml diff --git a/examples-generated/connect/phonenumber.yaml b/examples-generated/connect/v1beta1/phonenumber.yaml similarity index 100% rename from examples-generated/connect/phonenumber.yaml rename to examples-generated/connect/v1beta1/phonenumber.yaml diff --git a/examples-generated/connect/queue.yaml b/examples-generated/connect/v1beta1/queue.yaml similarity index 100% rename from examples-generated/connect/queue.yaml rename to examples-generated/connect/v1beta1/queue.yaml diff --git a/examples-generated/connect/quickconnect.yaml b/examples-generated/connect/v1beta1/quickconnect.yaml similarity index 100% rename from examples-generated/connect/quickconnect.yaml rename to examples-generated/connect/v1beta1/quickconnect.yaml diff --git a/examples-generated/connect/routingprofile.yaml b/examples-generated/connect/v1beta1/routingprofile.yaml similarity index 100% rename from examples-generated/connect/routingprofile.yaml rename to examples-generated/connect/v1beta1/routingprofile.yaml diff --git a/examples-generated/connect/securityprofile.yaml b/examples-generated/connect/v1beta1/securityprofile.yaml similarity index 100% rename from examples-generated/connect/securityprofile.yaml rename to examples-generated/connect/v1beta1/securityprofile.yaml diff --git a/examples-generated/connect/user.yaml b/examples-generated/connect/v1beta1/user.yaml similarity index 100% rename from examples-generated/connect/user.yaml rename to examples-generated/connect/v1beta1/user.yaml diff --git a/examples-generated/connect/userhierarchystructure.yaml b/examples-generated/connect/v1beta1/userhierarchystructure.yaml similarity index 100% rename from examples-generated/connect/userhierarchystructure.yaml rename to examples-generated/connect/v1beta1/userhierarchystructure.yaml diff --git a/examples-generated/connect/vocabulary.yaml b/examples-generated/connect/v1beta1/vocabulary.yaml similarity index 100% rename from examples-generated/connect/vocabulary.yaml rename to examples-generated/connect/v1beta1/vocabulary.yaml diff --git a/examples-generated/cur/reportdefinition.yaml b/examples-generated/cur/v1beta1/reportdefinition.yaml similarity index 100% rename from examples-generated/cur/reportdefinition.yaml rename to examples-generated/cur/v1beta1/reportdefinition.yaml diff --git a/examples-generated/dataexchange/dataset.yaml b/examples-generated/dataexchange/v1beta1/dataset.yaml similarity index 100% rename from examples-generated/dataexchange/dataset.yaml rename to examples-generated/dataexchange/v1beta1/dataset.yaml diff --git a/examples-generated/dataexchange/revision.yaml b/examples-generated/dataexchange/v1beta1/revision.yaml similarity index 100% rename from examples-generated/dataexchange/revision.yaml rename to examples-generated/dataexchange/v1beta1/revision.yaml diff --git a/examples-generated/datapipeline/pipeline.yaml b/examples-generated/datapipeline/v1beta1/pipeline.yaml similarity index 100% rename from examples-generated/datapipeline/pipeline.yaml rename to examples-generated/datapipeline/v1beta1/pipeline.yaml diff --git a/examples-generated/datasync/locations3.yaml b/examples-generated/datasync/v1beta1/locations3.yaml similarity index 100% rename from examples-generated/datasync/locations3.yaml rename to examples-generated/datasync/v1beta1/locations3.yaml diff --git a/examples-generated/datasync/task.yaml b/examples-generated/datasync/v1beta1/task.yaml similarity index 100% rename from examples-generated/datasync/task.yaml rename to examples-generated/datasync/v1beta1/task.yaml diff --git a/examples-generated/dax/cluster.yaml b/examples-generated/dax/v1beta1/cluster.yaml similarity index 100% rename from examples-generated/dax/cluster.yaml rename to examples-generated/dax/v1beta1/cluster.yaml diff --git a/examples-generated/dax/parametergroup.yaml b/examples-generated/dax/v1beta1/parametergroup.yaml similarity index 100% rename from examples-generated/dax/parametergroup.yaml rename to examples-generated/dax/v1beta1/parametergroup.yaml diff --git a/examples-generated/dax/subnetgroup.yaml b/examples-generated/dax/v1beta1/subnetgroup.yaml similarity index 100% rename from examples-generated/dax/subnetgroup.yaml rename to examples-generated/dax/v1beta1/subnetgroup.yaml diff --git a/examples-generated/deploy/app.yaml b/examples-generated/deploy/v1beta1/app.yaml similarity index 100% rename from examples-generated/deploy/app.yaml rename to examples-generated/deploy/v1beta1/app.yaml diff --git a/examples-generated/deploy/deploymentconfig.yaml b/examples-generated/deploy/v1beta1/deploymentconfig.yaml similarity index 100% rename from examples-generated/deploy/deploymentconfig.yaml rename to examples-generated/deploy/v1beta1/deploymentconfig.yaml diff --git a/examples-generated/deploy/deploymentgroup.yaml b/examples-generated/deploy/v1beta1/deploymentgroup.yaml similarity index 100% rename from examples-generated/deploy/deploymentgroup.yaml rename to examples-generated/deploy/v1beta1/deploymentgroup.yaml diff --git a/examples-generated/detective/graph.yaml b/examples-generated/detective/v1beta1/graph.yaml similarity index 100% rename from examples-generated/detective/graph.yaml rename to examples-generated/detective/v1beta1/graph.yaml diff --git a/examples-generated/detective/invitationaccepter.yaml b/examples-generated/detective/v1beta1/invitationaccepter.yaml similarity index 100% rename from examples-generated/detective/invitationaccepter.yaml rename to examples-generated/detective/v1beta1/invitationaccepter.yaml diff --git a/examples-generated/detective/member.yaml b/examples-generated/detective/v1beta1/member.yaml similarity index 100% rename from examples-generated/detective/member.yaml rename to examples-generated/detective/v1beta1/member.yaml diff --git a/examples-generated/devicefarm/devicepool.yaml b/examples-generated/devicefarm/v1beta1/devicepool.yaml similarity index 100% rename from examples-generated/devicefarm/devicepool.yaml rename to examples-generated/devicefarm/v1beta1/devicepool.yaml diff --git a/examples-generated/devicefarm/instanceprofile.yaml b/examples-generated/devicefarm/v1beta1/instanceprofile.yaml similarity index 100% rename from examples-generated/devicefarm/instanceprofile.yaml rename to examples-generated/devicefarm/v1beta1/instanceprofile.yaml diff --git a/examples-generated/devicefarm/networkprofile.yaml b/examples-generated/devicefarm/v1beta1/networkprofile.yaml similarity index 100% rename from examples-generated/devicefarm/networkprofile.yaml rename to examples-generated/devicefarm/v1beta1/networkprofile.yaml diff --git a/examples-generated/devicefarm/project.yaml b/examples-generated/devicefarm/v1beta1/project.yaml similarity index 100% rename from examples-generated/devicefarm/project.yaml rename to examples-generated/devicefarm/v1beta1/project.yaml diff --git a/examples-generated/devicefarm/testgridproject.yaml b/examples-generated/devicefarm/v1beta1/testgridproject.yaml similarity index 100% rename from examples-generated/devicefarm/testgridproject.yaml rename to examples-generated/devicefarm/v1beta1/testgridproject.yaml diff --git a/examples-generated/devicefarm/upload.yaml b/examples-generated/devicefarm/v1beta1/upload.yaml similarity index 100% rename from examples-generated/devicefarm/upload.yaml rename to examples-generated/devicefarm/v1beta1/upload.yaml diff --git a/examples-generated/directconnect/bgppeer.yaml b/examples-generated/directconnect/v1beta1/bgppeer.yaml similarity index 100% rename from examples-generated/directconnect/bgppeer.yaml rename to examples-generated/directconnect/v1beta1/bgppeer.yaml diff --git a/examples-generated/directconnect/connection.yaml b/examples-generated/directconnect/v1beta1/connection.yaml similarity index 100% rename from examples-generated/directconnect/connection.yaml rename to examples-generated/directconnect/v1beta1/connection.yaml diff --git a/examples-generated/directconnect/connectionassociation.yaml b/examples-generated/directconnect/v1beta1/connectionassociation.yaml similarity index 100% rename from examples-generated/directconnect/connectionassociation.yaml rename to examples-generated/directconnect/v1beta1/connectionassociation.yaml diff --git a/examples-generated/directconnect/gateway.yaml b/examples-generated/directconnect/v1beta1/gateway.yaml similarity index 100% rename from examples-generated/directconnect/gateway.yaml rename to examples-generated/directconnect/v1beta1/gateway.yaml diff --git a/examples-generated/directconnect/gatewayassociation.yaml b/examples-generated/directconnect/v1beta1/gatewayassociation.yaml similarity index 100% rename from examples-generated/directconnect/gatewayassociation.yaml rename to examples-generated/directconnect/v1beta1/gatewayassociation.yaml diff --git a/examples-generated/directconnect/gatewayassociationproposal.yaml b/examples-generated/directconnect/v1beta1/gatewayassociationproposal.yaml similarity index 100% rename from examples-generated/directconnect/gatewayassociationproposal.yaml rename to examples-generated/directconnect/v1beta1/gatewayassociationproposal.yaml diff --git a/examples-generated/directconnect/hostedprivatevirtualinterface.yaml b/examples-generated/directconnect/v1beta1/hostedprivatevirtualinterface.yaml similarity index 100% rename from examples-generated/directconnect/hostedprivatevirtualinterface.yaml rename to examples-generated/directconnect/v1beta1/hostedprivatevirtualinterface.yaml diff --git a/examples-generated/directconnect/hostedprivatevirtualinterfaceaccepter.yaml b/examples-generated/directconnect/v1beta1/hostedprivatevirtualinterfaceaccepter.yaml similarity index 100% rename from examples-generated/directconnect/hostedprivatevirtualinterfaceaccepter.yaml rename to examples-generated/directconnect/v1beta1/hostedprivatevirtualinterfaceaccepter.yaml diff --git a/examples-generated/directconnect/hostedpublicvirtualinterface.yaml b/examples-generated/directconnect/v1beta1/hostedpublicvirtualinterface.yaml similarity index 100% rename from examples-generated/directconnect/hostedpublicvirtualinterface.yaml rename to examples-generated/directconnect/v1beta1/hostedpublicvirtualinterface.yaml diff --git a/examples-generated/directconnect/hostedpublicvirtualinterfaceaccepter.yaml b/examples-generated/directconnect/v1beta1/hostedpublicvirtualinterfaceaccepter.yaml similarity index 100% rename from examples-generated/directconnect/hostedpublicvirtualinterfaceaccepter.yaml rename to examples-generated/directconnect/v1beta1/hostedpublicvirtualinterfaceaccepter.yaml diff --git a/examples-generated/directconnect/hostedtransitvirtualinterface.yaml b/examples-generated/directconnect/v1beta1/hostedtransitvirtualinterface.yaml similarity index 100% rename from examples-generated/directconnect/hostedtransitvirtualinterface.yaml rename to examples-generated/directconnect/v1beta1/hostedtransitvirtualinterface.yaml diff --git a/examples-generated/directconnect/hostedtransitvirtualinterfaceaccepter.yaml b/examples-generated/directconnect/v1beta1/hostedtransitvirtualinterfaceaccepter.yaml similarity index 100% rename from examples-generated/directconnect/hostedtransitvirtualinterfaceaccepter.yaml rename to examples-generated/directconnect/v1beta1/hostedtransitvirtualinterfaceaccepter.yaml diff --git a/examples-generated/directconnect/lag.yaml b/examples-generated/directconnect/v1beta1/lag.yaml similarity index 100% rename from examples-generated/directconnect/lag.yaml rename to examples-generated/directconnect/v1beta1/lag.yaml diff --git a/examples-generated/directconnect/privatevirtualinterface.yaml b/examples-generated/directconnect/v1beta1/privatevirtualinterface.yaml similarity index 100% rename from examples-generated/directconnect/privatevirtualinterface.yaml rename to examples-generated/directconnect/v1beta1/privatevirtualinterface.yaml diff --git a/examples-generated/directconnect/publicvirtualinterface.yaml b/examples-generated/directconnect/v1beta1/publicvirtualinterface.yaml similarity index 100% rename from examples-generated/directconnect/publicvirtualinterface.yaml rename to examples-generated/directconnect/v1beta1/publicvirtualinterface.yaml diff --git a/examples-generated/directconnect/transitvirtualinterface.yaml b/examples-generated/directconnect/v1beta1/transitvirtualinterface.yaml similarity index 100% rename from examples-generated/directconnect/transitvirtualinterface.yaml rename to examples-generated/directconnect/v1beta1/transitvirtualinterface.yaml diff --git a/examples-generated/dlm/lifecyclepolicy.yaml b/examples-generated/dlm/v1beta1/lifecyclepolicy.yaml similarity index 100% rename from examples-generated/dlm/lifecyclepolicy.yaml rename to examples-generated/dlm/v1beta1/lifecyclepolicy.yaml diff --git a/examples-generated/dms/certificate.yaml b/examples-generated/dms/v1beta1/certificate.yaml similarity index 100% rename from examples-generated/dms/certificate.yaml rename to examples-generated/dms/v1beta1/certificate.yaml diff --git a/examples-generated/dms/endpoint.yaml b/examples-generated/dms/v1beta1/endpoint.yaml similarity index 100% rename from examples-generated/dms/endpoint.yaml rename to examples-generated/dms/v1beta1/endpoint.yaml diff --git a/examples-generated/dms/eventsubscription.yaml b/examples-generated/dms/v1beta1/eventsubscription.yaml similarity index 100% rename from examples-generated/dms/eventsubscription.yaml rename to examples-generated/dms/v1beta1/eventsubscription.yaml diff --git a/examples-generated/dms/replicationinstance.yaml b/examples-generated/dms/v1beta1/replicationinstance.yaml similarity index 100% rename from examples-generated/dms/replicationinstance.yaml rename to examples-generated/dms/v1beta1/replicationinstance.yaml diff --git a/examples-generated/dms/replicationsubnetgroup.yaml b/examples-generated/dms/v1beta1/replicationsubnetgroup.yaml similarity index 100% rename from examples-generated/dms/replicationsubnetgroup.yaml rename to examples-generated/dms/v1beta1/replicationsubnetgroup.yaml diff --git a/examples-generated/dms/replicationtask.yaml b/examples-generated/dms/v1beta1/replicationtask.yaml similarity index 100% rename from examples-generated/dms/replicationtask.yaml rename to examples-generated/dms/v1beta1/replicationtask.yaml diff --git a/examples-generated/dms/s3endpoint.yaml b/examples-generated/dms/v1beta1/s3endpoint.yaml similarity index 100% rename from examples-generated/dms/s3endpoint.yaml rename to examples-generated/dms/v1beta1/s3endpoint.yaml diff --git a/examples-generated/docdb/cluster.yaml b/examples-generated/docdb/v1beta1/cluster.yaml similarity index 100% rename from examples-generated/docdb/cluster.yaml rename to examples-generated/docdb/v1beta1/cluster.yaml diff --git a/examples-generated/docdb/clusterinstance.yaml b/examples-generated/docdb/v1beta1/clusterinstance.yaml similarity index 100% rename from examples-generated/docdb/clusterinstance.yaml rename to examples-generated/docdb/v1beta1/clusterinstance.yaml diff --git a/examples-generated/docdb/clusterparametergroup.yaml b/examples-generated/docdb/v1beta1/clusterparametergroup.yaml similarity index 100% rename from examples-generated/docdb/clusterparametergroup.yaml rename to examples-generated/docdb/v1beta1/clusterparametergroup.yaml diff --git a/examples-generated/docdb/clustersnapshot.yaml b/examples-generated/docdb/v1beta1/clustersnapshot.yaml similarity index 100% rename from examples-generated/docdb/clustersnapshot.yaml rename to examples-generated/docdb/v1beta1/clustersnapshot.yaml diff --git a/examples-generated/docdb/eventsubscription.yaml b/examples-generated/docdb/v1beta1/eventsubscription.yaml similarity index 100% rename from examples-generated/docdb/eventsubscription.yaml rename to examples-generated/docdb/v1beta1/eventsubscription.yaml diff --git a/examples-generated/docdb/globalcluster.yaml b/examples-generated/docdb/v1beta1/globalcluster.yaml similarity index 100% rename from examples-generated/docdb/globalcluster.yaml rename to examples-generated/docdb/v1beta1/globalcluster.yaml diff --git a/examples-generated/docdb/subnetgroup.yaml b/examples-generated/docdb/v1beta1/subnetgroup.yaml similarity index 100% rename from examples-generated/docdb/subnetgroup.yaml rename to examples-generated/docdb/v1beta1/subnetgroup.yaml diff --git a/examples-generated/ds/conditionalforwarder.yaml b/examples-generated/ds/v1beta1/conditionalforwarder.yaml similarity index 100% rename from examples-generated/ds/conditionalforwarder.yaml rename to examples-generated/ds/v1beta1/conditionalforwarder.yaml diff --git a/examples-generated/ds/directory.yaml b/examples-generated/ds/v1beta1/directory.yaml similarity index 100% rename from examples-generated/ds/directory.yaml rename to examples-generated/ds/v1beta1/directory.yaml diff --git a/examples-generated/ds/shareddirectory.yaml b/examples-generated/ds/v1beta1/shareddirectory.yaml similarity index 100% rename from examples-generated/ds/shareddirectory.yaml rename to examples-generated/ds/v1beta1/shareddirectory.yaml diff --git a/examples-generated/dynamodb/contributorinsights.yaml b/examples-generated/dynamodb/v1beta1/contributorinsights.yaml similarity index 100% rename from examples-generated/dynamodb/contributorinsights.yaml rename to examples-generated/dynamodb/v1beta1/contributorinsights.yaml diff --git a/examples-generated/dynamodb/globaltable.yaml b/examples-generated/dynamodb/v1beta1/globaltable.yaml similarity index 100% rename from examples-generated/dynamodb/globaltable.yaml rename to examples-generated/dynamodb/v1beta1/globaltable.yaml diff --git a/examples-generated/dynamodb/kinesisstreamingdestination.yaml b/examples-generated/dynamodb/v1beta1/kinesisstreamingdestination.yaml similarity index 100% rename from examples-generated/dynamodb/kinesisstreamingdestination.yaml rename to examples-generated/dynamodb/v1beta1/kinesisstreamingdestination.yaml diff --git a/examples-generated/dynamodb/table.yaml b/examples-generated/dynamodb/v1beta1/table.yaml similarity index 100% rename from examples-generated/dynamodb/table.yaml rename to examples-generated/dynamodb/v1beta1/table.yaml diff --git a/examples-generated/dynamodb/tableitem.yaml b/examples-generated/dynamodb/v1beta1/tableitem.yaml similarity index 100% rename from examples-generated/dynamodb/tableitem.yaml rename to examples-generated/dynamodb/v1beta1/tableitem.yaml diff --git a/examples-generated/dynamodb/tablereplica.yaml b/examples-generated/dynamodb/v1beta1/tablereplica.yaml similarity index 100% rename from examples-generated/dynamodb/tablereplica.yaml rename to examples-generated/dynamodb/v1beta1/tablereplica.yaml diff --git a/examples-generated/dynamodb/tag.yaml b/examples-generated/dynamodb/v1beta1/tag.yaml similarity index 100% rename from examples-generated/dynamodb/tag.yaml rename to examples-generated/dynamodb/v1beta1/tag.yaml diff --git a/examples-generated/ec2/ami.yaml b/examples-generated/ec2/v1beta1/ami.yaml similarity index 100% rename from examples-generated/ec2/ami.yaml rename to examples-generated/ec2/v1beta1/ami.yaml diff --git a/examples-generated/ec2/amicopy.yaml b/examples-generated/ec2/v1beta1/amicopy.yaml similarity index 100% rename from examples-generated/ec2/amicopy.yaml rename to examples-generated/ec2/v1beta1/amicopy.yaml diff --git a/examples-generated/ec2/amilaunchpermission.yaml b/examples-generated/ec2/v1beta1/amilaunchpermission.yaml similarity index 100% rename from examples-generated/ec2/amilaunchpermission.yaml rename to examples-generated/ec2/v1beta1/amilaunchpermission.yaml diff --git a/examples-generated/ec2/availabilityzonegroup.yaml b/examples-generated/ec2/v1beta1/availabilityzonegroup.yaml similarity index 100% rename from examples-generated/ec2/availabilityzonegroup.yaml rename to examples-generated/ec2/v1beta1/availabilityzonegroup.yaml diff --git a/examples-generated/ec2/capacityreservation.yaml b/examples-generated/ec2/v1beta1/capacityreservation.yaml similarity index 100% rename from examples-generated/ec2/capacityreservation.yaml rename to examples-generated/ec2/v1beta1/capacityreservation.yaml diff --git a/examples-generated/ec2/carriergateway.yaml b/examples-generated/ec2/v1beta1/carriergateway.yaml similarity index 100% rename from examples-generated/ec2/carriergateway.yaml rename to examples-generated/ec2/v1beta1/carriergateway.yaml diff --git a/examples-generated/ec2/customergateway.yaml b/examples-generated/ec2/v1beta1/customergateway.yaml similarity index 100% rename from examples-generated/ec2/customergateway.yaml rename to examples-generated/ec2/v1beta1/customergateway.yaml diff --git a/examples-generated/ec2/defaultnetworkacl.yaml b/examples-generated/ec2/v1beta1/defaultnetworkacl.yaml similarity index 100% rename from examples-generated/ec2/defaultnetworkacl.yaml rename to examples-generated/ec2/v1beta1/defaultnetworkacl.yaml diff --git a/examples-generated/ec2/defaultroutetable.yaml b/examples-generated/ec2/v1beta1/defaultroutetable.yaml similarity index 100% rename from examples-generated/ec2/defaultroutetable.yaml rename to examples-generated/ec2/v1beta1/defaultroutetable.yaml diff --git a/examples-generated/ec2/defaultsecuritygroup.yaml b/examples-generated/ec2/v1beta1/defaultsecuritygroup.yaml similarity index 100% rename from examples-generated/ec2/defaultsecuritygroup.yaml rename to examples-generated/ec2/v1beta1/defaultsecuritygroup.yaml diff --git a/examples-generated/ec2/defaultsubnet.yaml b/examples-generated/ec2/v1beta1/defaultsubnet.yaml similarity index 100% rename from examples-generated/ec2/defaultsubnet.yaml rename to examples-generated/ec2/v1beta1/defaultsubnet.yaml diff --git a/examples-generated/ec2/defaultvpc.yaml b/examples-generated/ec2/v1beta1/defaultvpc.yaml similarity index 100% rename from examples-generated/ec2/defaultvpc.yaml rename to examples-generated/ec2/v1beta1/defaultvpc.yaml diff --git a/examples-generated/ec2/defaultvpcdhcpoptions.yaml b/examples-generated/ec2/v1beta1/defaultvpcdhcpoptions.yaml similarity index 100% rename from examples-generated/ec2/defaultvpcdhcpoptions.yaml rename to examples-generated/ec2/v1beta1/defaultvpcdhcpoptions.yaml diff --git a/examples-generated/ec2/ebsdefaultkmskey.yaml b/examples-generated/ec2/v1beta1/ebsdefaultkmskey.yaml similarity index 100% rename from examples-generated/ec2/ebsdefaultkmskey.yaml rename to examples-generated/ec2/v1beta1/ebsdefaultkmskey.yaml diff --git a/examples-generated/ec2/ebsencryptionbydefault.yaml b/examples-generated/ec2/v1beta1/ebsencryptionbydefault.yaml similarity index 100% rename from examples-generated/ec2/ebsencryptionbydefault.yaml rename to examples-generated/ec2/v1beta1/ebsencryptionbydefault.yaml diff --git a/examples-generated/ec2/ebssnapshot.yaml b/examples-generated/ec2/v1beta1/ebssnapshot.yaml similarity index 100% rename from examples-generated/ec2/ebssnapshot.yaml rename to examples-generated/ec2/v1beta1/ebssnapshot.yaml diff --git a/examples-generated/ec2/ebssnapshotcopy.yaml b/examples-generated/ec2/v1beta1/ebssnapshotcopy.yaml similarity index 100% rename from examples-generated/ec2/ebssnapshotcopy.yaml rename to examples-generated/ec2/v1beta1/ebssnapshotcopy.yaml diff --git a/examples-generated/ec2/ebssnapshotimport.yaml b/examples-generated/ec2/v1beta1/ebssnapshotimport.yaml similarity index 100% rename from examples-generated/ec2/ebssnapshotimport.yaml rename to examples-generated/ec2/v1beta1/ebssnapshotimport.yaml diff --git a/examples-generated/ec2/ebsvolume.yaml b/examples-generated/ec2/v1beta1/ebsvolume.yaml similarity index 100% rename from examples-generated/ec2/ebsvolume.yaml rename to examples-generated/ec2/v1beta1/ebsvolume.yaml diff --git a/examples-generated/ec2/egressonlyinternetgateway.yaml b/examples-generated/ec2/v1beta1/egressonlyinternetgateway.yaml similarity index 100% rename from examples-generated/ec2/egressonlyinternetgateway.yaml rename to examples-generated/ec2/v1beta1/egressonlyinternetgateway.yaml diff --git a/examples-generated/ec2/eip.yaml b/examples-generated/ec2/v1beta1/eip.yaml similarity index 100% rename from examples-generated/ec2/eip.yaml rename to examples-generated/ec2/v1beta1/eip.yaml diff --git a/examples-generated/ec2/eipassociation.yaml b/examples-generated/ec2/v1beta1/eipassociation.yaml similarity index 100% rename from examples-generated/ec2/eipassociation.yaml rename to examples-generated/ec2/v1beta1/eipassociation.yaml diff --git a/examples-generated/ec2/flowlog.yaml b/examples-generated/ec2/v1beta1/flowlog.yaml similarity index 100% rename from examples-generated/ec2/flowlog.yaml rename to examples-generated/ec2/v1beta1/flowlog.yaml diff --git a/examples-generated/ec2/host.yaml b/examples-generated/ec2/v1beta1/host.yaml similarity index 100% rename from examples-generated/ec2/host.yaml rename to examples-generated/ec2/v1beta1/host.yaml diff --git a/examples-generated/ec2/instance.yaml b/examples-generated/ec2/v1beta1/instance.yaml similarity index 100% rename from examples-generated/ec2/instance.yaml rename to examples-generated/ec2/v1beta1/instance.yaml diff --git a/examples-generated/ec2/instancestate.yaml b/examples-generated/ec2/v1beta1/instancestate.yaml similarity index 100% rename from examples-generated/ec2/instancestate.yaml rename to examples-generated/ec2/v1beta1/instancestate.yaml diff --git a/examples-generated/ec2/internetgateway.yaml b/examples-generated/ec2/v1beta1/internetgateway.yaml similarity index 100% rename from examples-generated/ec2/internetgateway.yaml rename to examples-generated/ec2/v1beta1/internetgateway.yaml diff --git a/examples-generated/ec2/keypair.yaml b/examples-generated/ec2/v1beta1/keypair.yaml similarity index 100% rename from examples-generated/ec2/keypair.yaml rename to examples-generated/ec2/v1beta1/keypair.yaml diff --git a/examples-generated/ec2/launchtemplate.yaml b/examples-generated/ec2/v1beta1/launchtemplate.yaml similarity index 100% rename from examples-generated/ec2/launchtemplate.yaml rename to examples-generated/ec2/v1beta1/launchtemplate.yaml diff --git a/examples-generated/ec2/mainroutetableassociation.yaml b/examples-generated/ec2/v1beta1/mainroutetableassociation.yaml similarity index 100% rename from examples-generated/ec2/mainroutetableassociation.yaml rename to examples-generated/ec2/v1beta1/mainroutetableassociation.yaml diff --git a/examples-generated/ec2/managedprefixlist.yaml b/examples-generated/ec2/v1beta1/managedprefixlist.yaml similarity index 100% rename from examples-generated/ec2/managedprefixlist.yaml rename to examples-generated/ec2/v1beta1/managedprefixlist.yaml diff --git a/examples-generated/ec2/managedprefixlistentry.yaml b/examples-generated/ec2/v1beta1/managedprefixlistentry.yaml similarity index 100% rename from examples-generated/ec2/managedprefixlistentry.yaml rename to examples-generated/ec2/v1beta1/managedprefixlistentry.yaml diff --git a/examples-generated/ec2/natgateway.yaml b/examples-generated/ec2/v1beta1/natgateway.yaml similarity index 100% rename from examples-generated/ec2/natgateway.yaml rename to examples-generated/ec2/v1beta1/natgateway.yaml diff --git a/examples-generated/ec2/networkacl.yaml b/examples-generated/ec2/v1beta1/networkacl.yaml similarity index 100% rename from examples-generated/ec2/networkacl.yaml rename to examples-generated/ec2/v1beta1/networkacl.yaml diff --git a/examples-generated/ec2/networkaclrule.yaml b/examples-generated/ec2/v1beta1/networkaclrule.yaml similarity index 100% rename from examples-generated/ec2/networkaclrule.yaml rename to examples-generated/ec2/v1beta1/networkaclrule.yaml diff --git a/examples-generated/ec2/networkinsightsanalysis.yaml b/examples-generated/ec2/v1beta1/networkinsightsanalysis.yaml similarity index 100% rename from examples-generated/ec2/networkinsightsanalysis.yaml rename to examples-generated/ec2/v1beta1/networkinsightsanalysis.yaml diff --git a/examples-generated/ec2/networkinsightspath.yaml b/examples-generated/ec2/v1beta1/networkinsightspath.yaml similarity index 100% rename from examples-generated/ec2/networkinsightspath.yaml rename to examples-generated/ec2/v1beta1/networkinsightspath.yaml diff --git a/examples-generated/ec2/networkinterface.yaml b/examples-generated/ec2/v1beta1/networkinterface.yaml similarity index 100% rename from examples-generated/ec2/networkinterface.yaml rename to examples-generated/ec2/v1beta1/networkinterface.yaml diff --git a/examples-generated/ec2/networkinterfaceattachment.yaml b/examples-generated/ec2/v1beta1/networkinterfaceattachment.yaml similarity index 100% rename from examples-generated/ec2/networkinterfaceattachment.yaml rename to examples-generated/ec2/v1beta1/networkinterfaceattachment.yaml diff --git a/examples-generated/ec2/networkinterfacesgattachment.yaml b/examples-generated/ec2/v1beta1/networkinterfacesgattachment.yaml similarity index 100% rename from examples-generated/ec2/networkinterfacesgattachment.yaml rename to examples-generated/ec2/v1beta1/networkinterfacesgattachment.yaml diff --git a/examples-generated/ec2/placementgroup.yaml b/examples-generated/ec2/v1beta1/placementgroup.yaml similarity index 100% rename from examples-generated/ec2/placementgroup.yaml rename to examples-generated/ec2/v1beta1/placementgroup.yaml diff --git a/examples-generated/ec2/route.yaml b/examples-generated/ec2/v1beta1/route.yaml similarity index 100% rename from examples-generated/ec2/route.yaml rename to examples-generated/ec2/v1beta1/route.yaml diff --git a/examples-generated/ec2/routetable.yaml b/examples-generated/ec2/v1beta1/routetable.yaml similarity index 100% rename from examples-generated/ec2/routetable.yaml rename to examples-generated/ec2/v1beta1/routetable.yaml diff --git a/examples-generated/ec2/routetableassociation.yaml b/examples-generated/ec2/v1beta1/routetableassociation.yaml similarity index 100% rename from examples-generated/ec2/routetableassociation.yaml rename to examples-generated/ec2/v1beta1/routetableassociation.yaml diff --git a/examples-generated/ec2/securitygroup.yaml b/examples-generated/ec2/v1beta1/securitygroup.yaml similarity index 100% rename from examples-generated/ec2/securitygroup.yaml rename to examples-generated/ec2/v1beta1/securitygroup.yaml diff --git a/examples-generated/ec2/securitygroupegressrule.yaml b/examples-generated/ec2/v1beta1/securitygroupegressrule.yaml similarity index 100% rename from examples-generated/ec2/securitygroupegressrule.yaml rename to examples-generated/ec2/v1beta1/securitygroupegressrule.yaml diff --git a/examples-generated/ec2/securitygroupingressrule.yaml b/examples-generated/ec2/v1beta1/securitygroupingressrule.yaml similarity index 100% rename from examples-generated/ec2/securitygroupingressrule.yaml rename to examples-generated/ec2/v1beta1/securitygroupingressrule.yaml diff --git a/examples-generated/ec2/securitygrouprule.yaml b/examples-generated/ec2/v1beta1/securitygrouprule.yaml similarity index 100% rename from examples-generated/ec2/securitygrouprule.yaml rename to examples-generated/ec2/v1beta1/securitygrouprule.yaml diff --git a/examples-generated/ec2/serialconsoleaccess.yaml b/examples-generated/ec2/v1beta1/serialconsoleaccess.yaml similarity index 100% rename from examples-generated/ec2/serialconsoleaccess.yaml rename to examples-generated/ec2/v1beta1/serialconsoleaccess.yaml diff --git a/examples-generated/ec2/snapshotcreatevolumepermission.yaml b/examples-generated/ec2/v1beta1/snapshotcreatevolumepermission.yaml similarity index 100% rename from examples-generated/ec2/snapshotcreatevolumepermission.yaml rename to examples-generated/ec2/v1beta1/snapshotcreatevolumepermission.yaml diff --git a/examples-generated/ec2/spotdatafeedsubscription.yaml b/examples-generated/ec2/v1beta1/spotdatafeedsubscription.yaml similarity index 100% rename from examples-generated/ec2/spotdatafeedsubscription.yaml rename to examples-generated/ec2/v1beta1/spotdatafeedsubscription.yaml diff --git a/examples-generated/ec2/spotfleetrequest.yaml b/examples-generated/ec2/v1beta1/spotfleetrequest.yaml similarity index 100% rename from examples-generated/ec2/spotfleetrequest.yaml rename to examples-generated/ec2/v1beta1/spotfleetrequest.yaml diff --git a/examples-generated/ec2/spotinstancerequest.yaml b/examples-generated/ec2/v1beta1/spotinstancerequest.yaml similarity index 100% rename from examples-generated/ec2/spotinstancerequest.yaml rename to examples-generated/ec2/v1beta1/spotinstancerequest.yaml diff --git a/examples-generated/ec2/subnet.yaml b/examples-generated/ec2/v1beta1/subnet.yaml similarity index 100% rename from examples-generated/ec2/subnet.yaml rename to examples-generated/ec2/v1beta1/subnet.yaml diff --git a/examples-generated/ec2/subnetcidrreservation.yaml b/examples-generated/ec2/v1beta1/subnetcidrreservation.yaml similarity index 100% rename from examples-generated/ec2/subnetcidrreservation.yaml rename to examples-generated/ec2/v1beta1/subnetcidrreservation.yaml diff --git a/examples-generated/ec2/tag.yaml b/examples-generated/ec2/v1beta1/tag.yaml similarity index 100% rename from examples-generated/ec2/tag.yaml rename to examples-generated/ec2/v1beta1/tag.yaml diff --git a/examples-generated/ec2/trafficmirrorfilter.yaml b/examples-generated/ec2/v1beta1/trafficmirrorfilter.yaml similarity index 100% rename from examples-generated/ec2/trafficmirrorfilter.yaml rename to examples-generated/ec2/v1beta1/trafficmirrorfilter.yaml diff --git a/examples-generated/ec2/trafficmirrorfilterrule.yaml b/examples-generated/ec2/v1beta1/trafficmirrorfilterrule.yaml similarity index 100% rename from examples-generated/ec2/trafficmirrorfilterrule.yaml rename to examples-generated/ec2/v1beta1/trafficmirrorfilterrule.yaml diff --git a/examples-generated/ec2/transitgateway.yaml b/examples-generated/ec2/v1beta1/transitgateway.yaml similarity index 100% rename from examples-generated/ec2/transitgateway.yaml rename to examples-generated/ec2/v1beta1/transitgateway.yaml diff --git a/examples-generated/ec2/transitgatewayconnect.yaml b/examples-generated/ec2/v1beta1/transitgatewayconnect.yaml similarity index 100% rename from examples-generated/ec2/transitgatewayconnect.yaml rename to examples-generated/ec2/v1beta1/transitgatewayconnect.yaml diff --git a/examples-generated/ec2/transitgatewayconnectpeer.yaml b/examples-generated/ec2/v1beta1/transitgatewayconnectpeer.yaml similarity index 100% rename from examples-generated/ec2/transitgatewayconnectpeer.yaml rename to examples-generated/ec2/v1beta1/transitgatewayconnectpeer.yaml diff --git a/examples-generated/ec2/transitgatewaymulticastdomain.yaml b/examples-generated/ec2/v1beta1/transitgatewaymulticastdomain.yaml similarity index 100% rename from examples-generated/ec2/transitgatewaymulticastdomain.yaml rename to examples-generated/ec2/v1beta1/transitgatewaymulticastdomain.yaml diff --git a/examples-generated/ec2/transitgatewaymulticastdomainassociation.yaml b/examples-generated/ec2/v1beta1/transitgatewaymulticastdomainassociation.yaml similarity index 100% rename from examples-generated/ec2/transitgatewaymulticastdomainassociation.yaml rename to examples-generated/ec2/v1beta1/transitgatewaymulticastdomainassociation.yaml diff --git a/examples-generated/ec2/transitgatewaymulticastgroupmember.yaml b/examples-generated/ec2/v1beta1/transitgatewaymulticastgroupmember.yaml similarity index 100% rename from examples-generated/ec2/transitgatewaymulticastgroupmember.yaml rename to examples-generated/ec2/v1beta1/transitgatewaymulticastgroupmember.yaml diff --git a/examples-generated/ec2/transitgatewaymulticastgroupsource.yaml b/examples-generated/ec2/v1beta1/transitgatewaymulticastgroupsource.yaml similarity index 100% rename from examples-generated/ec2/transitgatewaymulticastgroupsource.yaml rename to examples-generated/ec2/v1beta1/transitgatewaymulticastgroupsource.yaml diff --git a/examples-generated/ec2/transitgatewaypeeringattachment.yaml b/examples-generated/ec2/v1beta1/transitgatewaypeeringattachment.yaml similarity index 100% rename from examples-generated/ec2/transitgatewaypeeringattachment.yaml rename to examples-generated/ec2/v1beta1/transitgatewaypeeringattachment.yaml diff --git a/examples-generated/ec2/transitgatewaypeeringattachmentaccepter.yaml b/examples-generated/ec2/v1beta1/transitgatewaypeeringattachmentaccepter.yaml similarity index 100% rename from examples-generated/ec2/transitgatewaypeeringattachmentaccepter.yaml rename to examples-generated/ec2/v1beta1/transitgatewaypeeringattachmentaccepter.yaml diff --git a/examples-generated/ec2/transitgatewaypolicytable.yaml b/examples-generated/ec2/v1beta1/transitgatewaypolicytable.yaml similarity index 100% rename from examples-generated/ec2/transitgatewaypolicytable.yaml rename to examples-generated/ec2/v1beta1/transitgatewaypolicytable.yaml diff --git a/examples-generated/ec2/transitgatewayprefixlistreference.yaml b/examples-generated/ec2/v1beta1/transitgatewayprefixlistreference.yaml similarity index 100% rename from examples-generated/ec2/transitgatewayprefixlistreference.yaml rename to examples-generated/ec2/v1beta1/transitgatewayprefixlistreference.yaml diff --git a/examples-generated/ec2/transitgatewayroute.yaml b/examples-generated/ec2/v1beta1/transitgatewayroute.yaml similarity index 100% rename from examples-generated/ec2/transitgatewayroute.yaml rename to examples-generated/ec2/v1beta1/transitgatewayroute.yaml diff --git a/examples-generated/ec2/transitgatewayroutetable.yaml b/examples-generated/ec2/v1beta1/transitgatewayroutetable.yaml similarity index 100% rename from examples-generated/ec2/transitgatewayroutetable.yaml rename to examples-generated/ec2/v1beta1/transitgatewayroutetable.yaml diff --git a/examples-generated/ec2/transitgatewayroutetableassociation.yaml b/examples-generated/ec2/v1beta1/transitgatewayroutetableassociation.yaml similarity index 100% rename from examples-generated/ec2/transitgatewayroutetableassociation.yaml rename to examples-generated/ec2/v1beta1/transitgatewayroutetableassociation.yaml diff --git a/examples-generated/ec2/transitgatewayroutetablepropagation.yaml b/examples-generated/ec2/v1beta1/transitgatewayroutetablepropagation.yaml similarity index 100% rename from examples-generated/ec2/transitgatewayroutetablepropagation.yaml rename to examples-generated/ec2/v1beta1/transitgatewayroutetablepropagation.yaml diff --git a/examples-generated/ec2/transitgatewayvpcattachment.yaml b/examples-generated/ec2/v1beta1/transitgatewayvpcattachment.yaml similarity index 100% rename from examples-generated/ec2/transitgatewayvpcattachment.yaml rename to examples-generated/ec2/v1beta1/transitgatewayvpcattachment.yaml diff --git a/examples-generated/ec2/transitgatewayvpcattachmentaccepter.yaml b/examples-generated/ec2/v1beta1/transitgatewayvpcattachmentaccepter.yaml similarity index 100% rename from examples-generated/ec2/transitgatewayvpcattachmentaccepter.yaml rename to examples-generated/ec2/v1beta1/transitgatewayvpcattachmentaccepter.yaml diff --git a/examples-generated/ec2/volumeattachment.yaml b/examples-generated/ec2/v1beta1/volumeattachment.yaml similarity index 100% rename from examples-generated/ec2/volumeattachment.yaml rename to examples-generated/ec2/v1beta1/volumeattachment.yaml diff --git a/examples-generated/ec2/vpc.yaml b/examples-generated/ec2/v1beta1/vpc.yaml similarity index 100% rename from examples-generated/ec2/vpc.yaml rename to examples-generated/ec2/v1beta1/vpc.yaml diff --git a/examples-generated/ec2/vpcdhcpoptions.yaml b/examples-generated/ec2/v1beta1/vpcdhcpoptions.yaml similarity index 100% rename from examples-generated/ec2/vpcdhcpoptions.yaml rename to examples-generated/ec2/v1beta1/vpcdhcpoptions.yaml diff --git a/examples-generated/ec2/vpcdhcpoptionsassociation.yaml b/examples-generated/ec2/v1beta1/vpcdhcpoptionsassociation.yaml similarity index 100% rename from examples-generated/ec2/vpcdhcpoptionsassociation.yaml rename to examples-generated/ec2/v1beta1/vpcdhcpoptionsassociation.yaml diff --git a/examples-generated/ec2/vpcendpoint.yaml b/examples-generated/ec2/v1beta1/vpcendpoint.yaml similarity index 100% rename from examples-generated/ec2/vpcendpoint.yaml rename to examples-generated/ec2/v1beta1/vpcendpoint.yaml diff --git a/examples-generated/ec2/vpcendpointconnectionnotification.yaml b/examples-generated/ec2/v1beta1/vpcendpointconnectionnotification.yaml similarity index 100% rename from examples-generated/ec2/vpcendpointconnectionnotification.yaml rename to examples-generated/ec2/v1beta1/vpcendpointconnectionnotification.yaml diff --git a/examples-generated/ec2/vpcendpointroutetableassociation.yaml b/examples-generated/ec2/v1beta1/vpcendpointroutetableassociation.yaml similarity index 100% rename from examples-generated/ec2/vpcendpointroutetableassociation.yaml rename to examples-generated/ec2/v1beta1/vpcendpointroutetableassociation.yaml diff --git a/examples-generated/ec2/vpcendpointsecuritygroupassociation.yaml b/examples-generated/ec2/v1beta1/vpcendpointsecuritygroupassociation.yaml similarity index 100% rename from examples-generated/ec2/vpcendpointsecuritygroupassociation.yaml rename to examples-generated/ec2/v1beta1/vpcendpointsecuritygroupassociation.yaml diff --git a/examples-generated/ec2/vpcendpointservice.yaml b/examples-generated/ec2/v1beta1/vpcendpointservice.yaml similarity index 100% rename from examples-generated/ec2/vpcendpointservice.yaml rename to examples-generated/ec2/v1beta1/vpcendpointservice.yaml diff --git a/examples-generated/ec2/vpcendpointserviceallowedprincipal.yaml b/examples-generated/ec2/v1beta1/vpcendpointserviceallowedprincipal.yaml similarity index 100% rename from examples-generated/ec2/vpcendpointserviceallowedprincipal.yaml rename to examples-generated/ec2/v1beta1/vpcendpointserviceallowedprincipal.yaml diff --git a/examples-generated/ec2/vpcendpointsubnetassociation.yaml b/examples-generated/ec2/v1beta1/vpcendpointsubnetassociation.yaml similarity index 100% rename from examples-generated/ec2/vpcendpointsubnetassociation.yaml rename to examples-generated/ec2/v1beta1/vpcendpointsubnetassociation.yaml diff --git a/examples-generated/ec2/vpcipam.yaml b/examples-generated/ec2/v1beta1/vpcipam.yaml similarity index 100% rename from examples-generated/ec2/vpcipam.yaml rename to examples-generated/ec2/v1beta1/vpcipam.yaml diff --git a/examples-generated/ec2/vpcipampool.yaml b/examples-generated/ec2/v1beta1/vpcipampool.yaml similarity index 100% rename from examples-generated/ec2/vpcipampool.yaml rename to examples-generated/ec2/v1beta1/vpcipampool.yaml diff --git a/examples-generated/ec2/vpcipampoolcidr.yaml b/examples-generated/ec2/v1beta1/vpcipampoolcidr.yaml similarity index 100% rename from examples-generated/ec2/vpcipampoolcidr.yaml rename to examples-generated/ec2/v1beta1/vpcipampoolcidr.yaml diff --git a/examples-generated/ec2/vpcipampoolcidrallocation.yaml b/examples-generated/ec2/v1beta1/vpcipampoolcidrallocation.yaml similarity index 100% rename from examples-generated/ec2/vpcipampoolcidrallocation.yaml rename to examples-generated/ec2/v1beta1/vpcipampoolcidrallocation.yaml diff --git a/examples-generated/ec2/vpcipamscope.yaml b/examples-generated/ec2/v1beta1/vpcipamscope.yaml similarity index 100% rename from examples-generated/ec2/vpcipamscope.yaml rename to examples-generated/ec2/v1beta1/vpcipamscope.yaml diff --git a/examples-generated/ec2/vpcipv4cidrblockassociation.yaml b/examples-generated/ec2/v1beta1/vpcipv4cidrblockassociation.yaml similarity index 100% rename from examples-generated/ec2/vpcipv4cidrblockassociation.yaml rename to examples-generated/ec2/v1beta1/vpcipv4cidrblockassociation.yaml diff --git a/examples-generated/ec2/vpcpeeringconnection.yaml b/examples-generated/ec2/v1beta1/vpcpeeringconnection.yaml similarity index 100% rename from examples-generated/ec2/vpcpeeringconnection.yaml rename to examples-generated/ec2/v1beta1/vpcpeeringconnection.yaml diff --git a/examples-generated/ec2/vpcpeeringconnectionaccepter.yaml b/examples-generated/ec2/v1beta1/vpcpeeringconnectionaccepter.yaml similarity index 100% rename from examples-generated/ec2/vpcpeeringconnectionaccepter.yaml rename to examples-generated/ec2/v1beta1/vpcpeeringconnectionaccepter.yaml diff --git a/examples-generated/ec2/vpcpeeringconnectionoptions.yaml b/examples-generated/ec2/v1beta1/vpcpeeringconnectionoptions.yaml similarity index 100% rename from examples-generated/ec2/vpcpeeringconnectionoptions.yaml rename to examples-generated/ec2/v1beta1/vpcpeeringconnectionoptions.yaml diff --git a/examples-generated/ec2/vpnconnection.yaml b/examples-generated/ec2/v1beta1/vpnconnection.yaml similarity index 100% rename from examples-generated/ec2/vpnconnection.yaml rename to examples-generated/ec2/v1beta1/vpnconnection.yaml diff --git a/examples-generated/ec2/vpnconnectionroute.yaml b/examples-generated/ec2/v1beta1/vpnconnectionroute.yaml similarity index 100% rename from examples-generated/ec2/vpnconnectionroute.yaml rename to examples-generated/ec2/v1beta1/vpnconnectionroute.yaml diff --git a/examples-generated/ec2/vpngateway.yaml b/examples-generated/ec2/v1beta1/vpngateway.yaml similarity index 100% rename from examples-generated/ec2/vpngateway.yaml rename to examples-generated/ec2/v1beta1/vpngateway.yaml diff --git a/examples-generated/ec2/vpngatewayattachment.yaml b/examples-generated/ec2/v1beta1/vpngatewayattachment.yaml similarity index 100% rename from examples-generated/ec2/vpngatewayattachment.yaml rename to examples-generated/ec2/v1beta1/vpngatewayattachment.yaml diff --git a/examples-generated/ec2/vpngatewayroutepropagation.yaml b/examples-generated/ec2/v1beta1/vpngatewayroutepropagation.yaml similarity index 100% rename from examples-generated/ec2/vpngatewayroutepropagation.yaml rename to examples-generated/ec2/v1beta1/vpngatewayroutepropagation.yaml diff --git a/examples-generated/ecr/lifecyclepolicy.yaml b/examples-generated/ecr/v1beta1/lifecyclepolicy.yaml similarity index 100% rename from examples-generated/ecr/lifecyclepolicy.yaml rename to examples-generated/ecr/v1beta1/lifecyclepolicy.yaml diff --git a/examples-generated/ecr/pullthroughcacherule.yaml b/examples-generated/ecr/v1beta1/pullthroughcacherule.yaml similarity index 100% rename from examples-generated/ecr/pullthroughcacherule.yaml rename to examples-generated/ecr/v1beta1/pullthroughcacherule.yaml diff --git a/examples-generated/ecr/registrypolicy.yaml b/examples-generated/ecr/v1beta1/registrypolicy.yaml similarity index 100% rename from examples-generated/ecr/registrypolicy.yaml rename to examples-generated/ecr/v1beta1/registrypolicy.yaml diff --git a/examples-generated/ecr/registryscanningconfiguration.yaml b/examples-generated/ecr/v1beta1/registryscanningconfiguration.yaml similarity index 100% rename from examples-generated/ecr/registryscanningconfiguration.yaml rename to examples-generated/ecr/v1beta1/registryscanningconfiguration.yaml diff --git a/examples-generated/ecr/replicationconfiguration.yaml b/examples-generated/ecr/v1beta1/replicationconfiguration.yaml similarity index 100% rename from examples-generated/ecr/replicationconfiguration.yaml rename to examples-generated/ecr/v1beta1/replicationconfiguration.yaml diff --git a/examples-generated/ecr/repository.yaml b/examples-generated/ecr/v1beta1/repository.yaml similarity index 100% rename from examples-generated/ecr/repository.yaml rename to examples-generated/ecr/v1beta1/repository.yaml diff --git a/examples-generated/ecr/repositorypolicy.yaml b/examples-generated/ecr/v1beta1/repositorypolicy.yaml similarity index 100% rename from examples-generated/ecr/repositorypolicy.yaml rename to examples-generated/ecr/v1beta1/repositorypolicy.yaml diff --git a/examples-generated/ecrpublic/repository.yaml b/examples-generated/ecrpublic/v1beta1/repository.yaml similarity index 100% rename from examples-generated/ecrpublic/repository.yaml rename to examples-generated/ecrpublic/v1beta1/repository.yaml diff --git a/examples-generated/ecrpublic/repositorypolicy.yaml b/examples-generated/ecrpublic/v1beta1/repositorypolicy.yaml similarity index 100% rename from examples-generated/ecrpublic/repositorypolicy.yaml rename to examples-generated/ecrpublic/v1beta1/repositorypolicy.yaml diff --git a/examples-generated/ecs/accountsettingdefault.yaml b/examples-generated/ecs/v1beta1/accountsettingdefault.yaml similarity index 100% rename from examples-generated/ecs/accountsettingdefault.yaml rename to examples-generated/ecs/v1beta1/accountsettingdefault.yaml diff --git a/examples-generated/ecs/capacityprovider.yaml b/examples-generated/ecs/v1beta1/capacityprovider.yaml similarity index 100% rename from examples-generated/ecs/capacityprovider.yaml rename to examples-generated/ecs/v1beta1/capacityprovider.yaml diff --git a/examples-generated/ecs/cluster.yaml b/examples-generated/ecs/v1beta1/cluster.yaml similarity index 100% rename from examples-generated/ecs/cluster.yaml rename to examples-generated/ecs/v1beta1/cluster.yaml diff --git a/examples-generated/ecs/clustercapacityproviders.yaml b/examples-generated/ecs/v1beta1/clustercapacityproviders.yaml similarity index 100% rename from examples-generated/ecs/clustercapacityproviders.yaml rename to examples-generated/ecs/v1beta1/clustercapacityproviders.yaml diff --git a/examples-generated/ecs/service.yaml b/examples-generated/ecs/v1beta1/service.yaml similarity index 100% rename from examples-generated/ecs/service.yaml rename to examples-generated/ecs/v1beta1/service.yaml diff --git a/examples-generated/ecs/taskdefinition.yaml b/examples-generated/ecs/v1beta1/taskdefinition.yaml similarity index 100% rename from examples-generated/ecs/taskdefinition.yaml rename to examples-generated/ecs/v1beta1/taskdefinition.yaml diff --git a/examples-generated/efs/accesspoint.yaml b/examples-generated/efs/v1beta1/accesspoint.yaml similarity index 100% rename from examples-generated/efs/accesspoint.yaml rename to examples-generated/efs/v1beta1/accesspoint.yaml diff --git a/examples-generated/efs/backuppolicy.yaml b/examples-generated/efs/v1beta1/backuppolicy.yaml similarity index 100% rename from examples-generated/efs/backuppolicy.yaml rename to examples-generated/efs/v1beta1/backuppolicy.yaml diff --git a/examples-generated/efs/filesystem.yaml b/examples-generated/efs/v1beta1/filesystem.yaml similarity index 100% rename from examples-generated/efs/filesystem.yaml rename to examples-generated/efs/v1beta1/filesystem.yaml diff --git a/examples-generated/efs/filesystempolicy.yaml b/examples-generated/efs/v1beta1/filesystempolicy.yaml similarity index 100% rename from examples-generated/efs/filesystempolicy.yaml rename to examples-generated/efs/v1beta1/filesystempolicy.yaml diff --git a/examples-generated/efs/mounttarget.yaml b/examples-generated/efs/v1beta1/mounttarget.yaml similarity index 100% rename from examples-generated/efs/mounttarget.yaml rename to examples-generated/efs/v1beta1/mounttarget.yaml diff --git a/examples-generated/efs/replicationconfiguration.yaml b/examples-generated/efs/v1beta1/replicationconfiguration.yaml similarity index 100% rename from examples-generated/efs/replicationconfiguration.yaml rename to examples-generated/efs/v1beta1/replicationconfiguration.yaml diff --git a/examples-generated/eks/addon.yaml b/examples-generated/eks/v1beta1/addon.yaml similarity index 100% rename from examples-generated/eks/addon.yaml rename to examples-generated/eks/v1beta1/addon.yaml diff --git a/examples-generated/eks/cluster.yaml b/examples-generated/eks/v1beta1/cluster.yaml similarity index 100% rename from examples-generated/eks/cluster.yaml rename to examples-generated/eks/v1beta1/cluster.yaml diff --git a/examples-generated/eks/fargateprofile.yaml b/examples-generated/eks/v1beta1/fargateprofile.yaml similarity index 100% rename from examples-generated/eks/fargateprofile.yaml rename to examples-generated/eks/v1beta1/fargateprofile.yaml diff --git a/examples-generated/eks/identityproviderconfig.yaml b/examples-generated/eks/v1beta1/identityproviderconfig.yaml similarity index 100% rename from examples-generated/eks/identityproviderconfig.yaml rename to examples-generated/eks/v1beta1/identityproviderconfig.yaml diff --git a/examples-generated/eks/nodegroup.yaml b/examples-generated/eks/v1beta1/nodegroup.yaml similarity index 100% rename from examples-generated/eks/nodegroup.yaml rename to examples-generated/eks/v1beta1/nodegroup.yaml diff --git a/examples-generated/elasticache/cluster.yaml b/examples-generated/elasticache/v1beta1/cluster.yaml similarity index 100% rename from examples-generated/elasticache/cluster.yaml rename to examples-generated/elasticache/v1beta1/cluster.yaml diff --git a/examples-generated/elasticache/parametergroup.yaml b/examples-generated/elasticache/v1beta1/parametergroup.yaml similarity index 100% rename from examples-generated/elasticache/parametergroup.yaml rename to examples-generated/elasticache/v1beta1/parametergroup.yaml diff --git a/examples-generated/elasticache/replicationgroup.yaml b/examples-generated/elasticache/v1beta1/replicationgroup.yaml similarity index 100% rename from examples-generated/elasticache/replicationgroup.yaml rename to examples-generated/elasticache/v1beta1/replicationgroup.yaml diff --git a/examples-generated/elasticache/subnetgroup.yaml b/examples-generated/elasticache/v1beta1/subnetgroup.yaml similarity index 100% rename from examples-generated/elasticache/subnetgroup.yaml rename to examples-generated/elasticache/v1beta1/subnetgroup.yaml diff --git a/examples-generated/elasticache/user.yaml b/examples-generated/elasticache/v1beta1/user.yaml similarity index 100% rename from examples-generated/elasticache/user.yaml rename to examples-generated/elasticache/v1beta1/user.yaml diff --git a/examples-generated/elasticache/usergroup.yaml b/examples-generated/elasticache/v1beta1/usergroup.yaml similarity index 100% rename from examples-generated/elasticache/usergroup.yaml rename to examples-generated/elasticache/v1beta1/usergroup.yaml diff --git a/examples-generated/elasticbeanstalk/application.yaml b/examples-generated/elasticbeanstalk/v1beta1/application.yaml similarity index 100% rename from examples-generated/elasticbeanstalk/application.yaml rename to examples-generated/elasticbeanstalk/v1beta1/application.yaml diff --git a/examples-generated/elasticbeanstalk/applicationversion.yaml b/examples-generated/elasticbeanstalk/v1beta1/applicationversion.yaml similarity index 100% rename from examples-generated/elasticbeanstalk/applicationversion.yaml rename to examples-generated/elasticbeanstalk/v1beta1/applicationversion.yaml diff --git a/examples-generated/elasticbeanstalk/configurationtemplate.yaml b/examples-generated/elasticbeanstalk/v1beta1/configurationtemplate.yaml similarity index 100% rename from examples-generated/elasticbeanstalk/configurationtemplate.yaml rename to examples-generated/elasticbeanstalk/v1beta1/configurationtemplate.yaml diff --git a/examples-generated/elasticsearch/domain.yaml b/examples-generated/elasticsearch/v1beta1/domain.yaml similarity index 100% rename from examples-generated/elasticsearch/domain.yaml rename to examples-generated/elasticsearch/v1beta1/domain.yaml diff --git a/examples-generated/elasticsearch/domainpolicy.yaml b/examples-generated/elasticsearch/v1beta1/domainpolicy.yaml similarity index 100% rename from examples-generated/elasticsearch/domainpolicy.yaml rename to examples-generated/elasticsearch/v1beta1/domainpolicy.yaml diff --git a/examples-generated/elasticsearch/domainsamloptions.yaml b/examples-generated/elasticsearch/v1beta1/domainsamloptions.yaml similarity index 100% rename from examples-generated/elasticsearch/domainsamloptions.yaml rename to examples-generated/elasticsearch/v1beta1/domainsamloptions.yaml diff --git a/examples-generated/elastictranscoder/pipeline.yaml b/examples-generated/elastictranscoder/v1beta1/pipeline.yaml similarity index 100% rename from examples-generated/elastictranscoder/pipeline.yaml rename to examples-generated/elastictranscoder/v1beta1/pipeline.yaml diff --git a/examples-generated/elastictranscoder/preset.yaml b/examples-generated/elastictranscoder/v1beta1/preset.yaml similarity index 100% rename from examples-generated/elastictranscoder/preset.yaml rename to examples-generated/elastictranscoder/v1beta1/preset.yaml diff --git a/examples-generated/elb/appcookiestickinesspolicy.yaml b/examples-generated/elb/v1beta1/appcookiestickinesspolicy.yaml similarity index 100% rename from examples-generated/elb/appcookiestickinesspolicy.yaml rename to examples-generated/elb/v1beta1/appcookiestickinesspolicy.yaml diff --git a/examples-generated/elb/attachment.yaml b/examples-generated/elb/v1beta1/attachment.yaml similarity index 100% rename from examples-generated/elb/attachment.yaml rename to examples-generated/elb/v1beta1/attachment.yaml diff --git a/examples-generated/elb/backendserverpolicy.yaml b/examples-generated/elb/v1beta1/backendserverpolicy.yaml similarity index 100% rename from examples-generated/elb/backendserverpolicy.yaml rename to examples-generated/elb/v1beta1/backendserverpolicy.yaml diff --git a/examples-generated/elb/elb.yaml b/examples-generated/elb/v1beta1/elb.yaml similarity index 100% rename from examples-generated/elb/elb.yaml rename to examples-generated/elb/v1beta1/elb.yaml diff --git a/examples-generated/elb/lbcookiestickinesspolicy.yaml b/examples-generated/elb/v1beta1/lbcookiestickinesspolicy.yaml similarity index 100% rename from examples-generated/elb/lbcookiestickinesspolicy.yaml rename to examples-generated/elb/v1beta1/lbcookiestickinesspolicy.yaml diff --git a/examples-generated/elb/lbsslnegotiationpolicy.yaml b/examples-generated/elb/v1beta1/lbsslnegotiationpolicy.yaml similarity index 100% rename from examples-generated/elb/lbsslnegotiationpolicy.yaml rename to examples-generated/elb/v1beta1/lbsslnegotiationpolicy.yaml diff --git a/examples-generated/elb/listenerpolicy.yaml b/examples-generated/elb/v1beta1/listenerpolicy.yaml similarity index 100% rename from examples-generated/elb/listenerpolicy.yaml rename to examples-generated/elb/v1beta1/listenerpolicy.yaml diff --git a/examples-generated/elb/policy.yaml b/examples-generated/elb/v1beta1/policy.yaml similarity index 100% rename from examples-generated/elb/policy.yaml rename to examples-generated/elb/v1beta1/policy.yaml diff --git a/examples-generated/elb/proxyprotocolpolicy.yaml b/examples-generated/elb/v1beta1/proxyprotocolpolicy.yaml similarity index 100% rename from examples-generated/elb/proxyprotocolpolicy.yaml rename to examples-generated/elb/v1beta1/proxyprotocolpolicy.yaml diff --git a/examples-generated/elbv2/lb.yaml b/examples-generated/elbv2/v1beta1/lb.yaml similarity index 100% rename from examples-generated/elbv2/lb.yaml rename to examples-generated/elbv2/v1beta1/lb.yaml diff --git a/examples-generated/elbv2/lblistener.yaml b/examples-generated/elbv2/v1beta1/lblistener.yaml similarity index 100% rename from examples-generated/elbv2/lblistener.yaml rename to examples-generated/elbv2/v1beta1/lblistener.yaml diff --git a/examples-generated/elbv2/lblistenercertificate.yaml b/examples-generated/elbv2/v1beta1/lblistenercertificate.yaml similarity index 100% rename from examples-generated/elbv2/lblistenercertificate.yaml rename to examples-generated/elbv2/v1beta1/lblistenercertificate.yaml diff --git a/examples-generated/elbv2/lblistenerrule.yaml b/examples-generated/elbv2/v1beta1/lblistenerrule.yaml similarity index 100% rename from examples-generated/elbv2/lblistenerrule.yaml rename to examples-generated/elbv2/v1beta1/lblistenerrule.yaml diff --git a/examples-generated/elbv2/lbtargetgroup.yaml b/examples-generated/elbv2/v1beta1/lbtargetgroup.yaml similarity index 100% rename from examples-generated/elbv2/lbtargetgroup.yaml rename to examples-generated/elbv2/v1beta1/lbtargetgroup.yaml diff --git a/examples-generated/elbv2/lbtargetgroupattachment.yaml b/examples-generated/elbv2/v1beta1/lbtargetgroupattachment.yaml similarity index 100% rename from examples-generated/elbv2/lbtargetgroupattachment.yaml rename to examples-generated/elbv2/v1beta1/lbtargetgroupattachment.yaml diff --git a/examples-generated/emr/securityconfiguration.yaml b/examples-generated/emr/v1beta1/securityconfiguration.yaml similarity index 100% rename from examples-generated/emr/securityconfiguration.yaml rename to examples-generated/emr/v1beta1/securityconfiguration.yaml diff --git a/examples-generated/emrserverless/application.yaml b/examples-generated/emrserverless/v1beta1/application.yaml similarity index 100% rename from examples-generated/emrserverless/application.yaml rename to examples-generated/emrserverless/v1beta1/application.yaml diff --git a/examples-generated/evidently/feature.yaml b/examples-generated/evidently/v1beta1/feature.yaml similarity index 100% rename from examples-generated/evidently/feature.yaml rename to examples-generated/evidently/v1beta1/feature.yaml diff --git a/examples-generated/evidently/project.yaml b/examples-generated/evidently/v1beta1/project.yaml similarity index 100% rename from examples-generated/evidently/project.yaml rename to examples-generated/evidently/v1beta1/project.yaml diff --git a/examples-generated/evidently/segment.yaml b/examples-generated/evidently/v1beta1/segment.yaml similarity index 100% rename from examples-generated/evidently/segment.yaml rename to examples-generated/evidently/v1beta1/segment.yaml diff --git a/examples-generated/firehose/deliverystream.yaml b/examples-generated/firehose/v1beta1/deliverystream.yaml similarity index 100% rename from examples-generated/firehose/deliverystream.yaml rename to examples-generated/firehose/v1beta1/deliverystream.yaml diff --git a/examples-generated/fis/experimenttemplate.yaml b/examples-generated/fis/v1beta1/experimenttemplate.yaml similarity index 100% rename from examples-generated/fis/experimenttemplate.yaml rename to examples-generated/fis/v1beta1/experimenttemplate.yaml diff --git a/examples-generated/fsx/backup.yaml b/examples-generated/fsx/v1beta1/backup.yaml similarity index 100% rename from examples-generated/fsx/backup.yaml rename to examples-generated/fsx/v1beta1/backup.yaml diff --git a/examples-generated/fsx/datarepositoryassociation.yaml b/examples-generated/fsx/v1beta1/datarepositoryassociation.yaml similarity index 100% rename from examples-generated/fsx/datarepositoryassociation.yaml rename to examples-generated/fsx/v1beta1/datarepositoryassociation.yaml diff --git a/examples-generated/fsx/lustrefilesystem.yaml b/examples-generated/fsx/v1beta1/lustrefilesystem.yaml similarity index 100% rename from examples-generated/fsx/lustrefilesystem.yaml rename to examples-generated/fsx/v1beta1/lustrefilesystem.yaml diff --git a/examples-generated/fsx/ontapfilesystem.yaml b/examples-generated/fsx/v1beta1/ontapfilesystem.yaml similarity index 100% rename from examples-generated/fsx/ontapfilesystem.yaml rename to examples-generated/fsx/v1beta1/ontapfilesystem.yaml diff --git a/examples-generated/fsx/ontapstoragevirtualmachine.yaml b/examples-generated/fsx/v1beta1/ontapstoragevirtualmachine.yaml similarity index 100% rename from examples-generated/fsx/ontapstoragevirtualmachine.yaml rename to examples-generated/fsx/v1beta1/ontapstoragevirtualmachine.yaml diff --git a/examples-generated/fsx/windowsfilesystem.yaml b/examples-generated/fsx/v1beta1/windowsfilesystem.yaml similarity index 100% rename from examples-generated/fsx/windowsfilesystem.yaml rename to examples-generated/fsx/v1beta1/windowsfilesystem.yaml diff --git a/examples-generated/gamelift/alias.yaml b/examples-generated/gamelift/v1beta1/alias.yaml similarity index 100% rename from examples-generated/gamelift/alias.yaml rename to examples-generated/gamelift/v1beta1/alias.yaml diff --git a/examples-generated/gamelift/build.yaml b/examples-generated/gamelift/v1beta1/build.yaml similarity index 100% rename from examples-generated/gamelift/build.yaml rename to examples-generated/gamelift/v1beta1/build.yaml diff --git a/examples-generated/gamelift/fleet.yaml b/examples-generated/gamelift/v1beta1/fleet.yaml similarity index 100% rename from examples-generated/gamelift/fleet.yaml rename to examples-generated/gamelift/v1beta1/fleet.yaml diff --git a/examples-generated/gamelift/gamesessionqueue.yaml b/examples-generated/gamelift/v1beta1/gamesessionqueue.yaml similarity index 100% rename from examples-generated/gamelift/gamesessionqueue.yaml rename to examples-generated/gamelift/v1beta1/gamesessionqueue.yaml diff --git a/examples-generated/gamelift/script.yaml b/examples-generated/gamelift/v1beta1/script.yaml similarity index 100% rename from examples-generated/gamelift/script.yaml rename to examples-generated/gamelift/v1beta1/script.yaml diff --git a/examples-generated/glacier/vault.yaml b/examples-generated/glacier/v1beta1/vault.yaml similarity index 100% rename from examples-generated/glacier/vault.yaml rename to examples-generated/glacier/v1beta1/vault.yaml diff --git a/examples-generated/glacier/vaultlock.yaml b/examples-generated/glacier/v1beta1/vaultlock.yaml similarity index 100% rename from examples-generated/glacier/vaultlock.yaml rename to examples-generated/glacier/v1beta1/vaultlock.yaml diff --git a/examples-generated/globalaccelerator/accelerator.yaml b/examples-generated/globalaccelerator/v1beta1/accelerator.yaml similarity index 100% rename from examples-generated/globalaccelerator/accelerator.yaml rename to examples-generated/globalaccelerator/v1beta1/accelerator.yaml diff --git a/examples-generated/globalaccelerator/endpointgroup.yaml b/examples-generated/globalaccelerator/v1beta1/endpointgroup.yaml similarity index 100% rename from examples-generated/globalaccelerator/endpointgroup.yaml rename to examples-generated/globalaccelerator/v1beta1/endpointgroup.yaml diff --git a/examples-generated/globalaccelerator/listener.yaml b/examples-generated/globalaccelerator/v1beta1/listener.yaml similarity index 100% rename from examples-generated/globalaccelerator/listener.yaml rename to examples-generated/globalaccelerator/v1beta1/listener.yaml diff --git a/examples-generated/glue/catalogdatabase.yaml b/examples-generated/glue/v1beta1/catalogdatabase.yaml similarity index 100% rename from examples-generated/glue/catalogdatabase.yaml rename to examples-generated/glue/v1beta1/catalogdatabase.yaml diff --git a/examples-generated/glue/catalogtable.yaml b/examples-generated/glue/v1beta1/catalogtable.yaml similarity index 100% rename from examples-generated/glue/catalogtable.yaml rename to examples-generated/glue/v1beta1/catalogtable.yaml diff --git a/examples-generated/glue/classifier.yaml b/examples-generated/glue/v1beta1/classifier.yaml similarity index 100% rename from examples-generated/glue/classifier.yaml rename to examples-generated/glue/v1beta1/classifier.yaml diff --git a/examples-generated/glue/connection.yaml b/examples-generated/glue/v1beta1/connection.yaml similarity index 100% rename from examples-generated/glue/connection.yaml rename to examples-generated/glue/v1beta1/connection.yaml diff --git a/examples-generated/glue/crawler.yaml b/examples-generated/glue/v1beta1/crawler.yaml similarity index 100% rename from examples-generated/glue/crawler.yaml rename to examples-generated/glue/v1beta1/crawler.yaml diff --git a/examples-generated/glue/datacatalogencryptionsettings.yaml b/examples-generated/glue/v1beta1/datacatalogencryptionsettings.yaml similarity index 100% rename from examples-generated/glue/datacatalogencryptionsettings.yaml rename to examples-generated/glue/v1beta1/datacatalogencryptionsettings.yaml diff --git a/examples-generated/glue/job.yaml b/examples-generated/glue/v1beta1/job.yaml similarity index 100% rename from examples-generated/glue/job.yaml rename to examples-generated/glue/v1beta1/job.yaml diff --git a/examples-generated/glue/registry.yaml b/examples-generated/glue/v1beta1/registry.yaml similarity index 100% rename from examples-generated/glue/registry.yaml rename to examples-generated/glue/v1beta1/registry.yaml diff --git a/examples-generated/glue/resourcepolicy.yaml b/examples-generated/glue/v1beta1/resourcepolicy.yaml similarity index 100% rename from examples-generated/glue/resourcepolicy.yaml rename to examples-generated/glue/v1beta1/resourcepolicy.yaml diff --git a/examples-generated/glue/schema.yaml b/examples-generated/glue/v1beta1/schema.yaml similarity index 100% rename from examples-generated/glue/schema.yaml rename to examples-generated/glue/v1beta1/schema.yaml diff --git a/examples-generated/glue/securityconfiguration.yaml b/examples-generated/glue/v1beta1/securityconfiguration.yaml similarity index 100% rename from examples-generated/glue/securityconfiguration.yaml rename to examples-generated/glue/v1beta1/securityconfiguration.yaml diff --git a/examples-generated/glue/trigger.yaml b/examples-generated/glue/v1beta1/trigger.yaml similarity index 100% rename from examples-generated/glue/trigger.yaml rename to examples-generated/glue/v1beta1/trigger.yaml diff --git a/examples-generated/glue/userdefinedfunction.yaml b/examples-generated/glue/v1beta1/userdefinedfunction.yaml similarity index 100% rename from examples-generated/glue/userdefinedfunction.yaml rename to examples-generated/glue/v1beta1/userdefinedfunction.yaml diff --git a/examples-generated/glue/workflow.yaml b/examples-generated/glue/v1beta1/workflow.yaml similarity index 100% rename from examples-generated/glue/workflow.yaml rename to examples-generated/glue/v1beta1/workflow.yaml diff --git a/examples-generated/grafana/licenseassociation.yaml b/examples-generated/grafana/v1beta1/licenseassociation.yaml similarity index 100% rename from examples-generated/grafana/licenseassociation.yaml rename to examples-generated/grafana/v1beta1/licenseassociation.yaml diff --git a/examples-generated/grafana/roleassociation.yaml b/examples-generated/grafana/v1beta1/roleassociation.yaml similarity index 100% rename from examples-generated/grafana/roleassociation.yaml rename to examples-generated/grafana/v1beta1/roleassociation.yaml diff --git a/examples-generated/grafana/workspace.yaml b/examples-generated/grafana/v1beta1/workspace.yaml similarity index 100% rename from examples-generated/grafana/workspace.yaml rename to examples-generated/grafana/v1beta1/workspace.yaml diff --git a/examples-generated/grafana/workspaceapikey.yaml b/examples-generated/grafana/v1beta1/workspaceapikey.yaml similarity index 100% rename from examples-generated/grafana/workspaceapikey.yaml rename to examples-generated/grafana/v1beta1/workspaceapikey.yaml diff --git a/examples-generated/grafana/workspacesamlconfiguration.yaml b/examples-generated/grafana/v1beta1/workspacesamlconfiguration.yaml similarity index 100% rename from examples-generated/grafana/workspacesamlconfiguration.yaml rename to examples-generated/grafana/v1beta1/workspacesamlconfiguration.yaml diff --git a/examples-generated/guardduty/detector.yaml b/examples-generated/guardduty/v1beta1/detector.yaml similarity index 100% rename from examples-generated/guardduty/detector.yaml rename to examples-generated/guardduty/v1beta1/detector.yaml diff --git a/examples-generated/guardduty/filter.yaml b/examples-generated/guardduty/v1beta1/filter.yaml similarity index 100% rename from examples-generated/guardduty/filter.yaml rename to examples-generated/guardduty/v1beta1/filter.yaml diff --git a/examples-generated/guardduty/member.yaml b/examples-generated/guardduty/v1beta1/member.yaml similarity index 100% rename from examples-generated/guardduty/member.yaml rename to examples-generated/guardduty/v1beta1/member.yaml diff --git a/examples-generated/iam/accesskey.yaml b/examples-generated/iam/v1beta1/accesskey.yaml similarity index 100% rename from examples-generated/iam/accesskey.yaml rename to examples-generated/iam/v1beta1/accesskey.yaml diff --git a/examples-generated/iam/accountalias.yaml b/examples-generated/iam/v1beta1/accountalias.yaml similarity index 100% rename from examples-generated/iam/accountalias.yaml rename to examples-generated/iam/v1beta1/accountalias.yaml diff --git a/examples-generated/iam/accountpasswordpolicy.yaml b/examples-generated/iam/v1beta1/accountpasswordpolicy.yaml similarity index 100% rename from examples-generated/iam/accountpasswordpolicy.yaml rename to examples-generated/iam/v1beta1/accountpasswordpolicy.yaml diff --git a/examples-generated/iam/group.yaml b/examples-generated/iam/v1beta1/group.yaml similarity index 100% rename from examples-generated/iam/group.yaml rename to examples-generated/iam/v1beta1/group.yaml diff --git a/examples-generated/iam/groupmembership.yaml b/examples-generated/iam/v1beta1/groupmembership.yaml similarity index 100% rename from examples-generated/iam/groupmembership.yaml rename to examples-generated/iam/v1beta1/groupmembership.yaml diff --git a/examples-generated/iam/grouppolicyattachment.yaml b/examples-generated/iam/v1beta1/grouppolicyattachment.yaml similarity index 100% rename from examples-generated/iam/grouppolicyattachment.yaml rename to examples-generated/iam/v1beta1/grouppolicyattachment.yaml diff --git a/examples-generated/iam/instanceprofile.yaml b/examples-generated/iam/v1beta1/instanceprofile.yaml similarity index 100% rename from examples-generated/iam/instanceprofile.yaml rename to examples-generated/iam/v1beta1/instanceprofile.yaml diff --git a/examples-generated/iam/openidconnectprovider.yaml b/examples-generated/iam/v1beta1/openidconnectprovider.yaml similarity index 100% rename from examples-generated/iam/openidconnectprovider.yaml rename to examples-generated/iam/v1beta1/openidconnectprovider.yaml diff --git a/examples-generated/iam/policy.yaml b/examples-generated/iam/v1beta1/policy.yaml similarity index 100% rename from examples-generated/iam/policy.yaml rename to examples-generated/iam/v1beta1/policy.yaml diff --git a/examples-generated/iam/role.yaml b/examples-generated/iam/v1beta1/role.yaml similarity index 100% rename from examples-generated/iam/role.yaml rename to examples-generated/iam/v1beta1/role.yaml diff --git a/examples-generated/iam/rolepolicy.yaml b/examples-generated/iam/v1beta1/rolepolicy.yaml similarity index 100% rename from examples-generated/iam/rolepolicy.yaml rename to examples-generated/iam/v1beta1/rolepolicy.yaml diff --git a/examples-generated/iam/rolepolicyattachment.yaml b/examples-generated/iam/v1beta1/rolepolicyattachment.yaml similarity index 100% rename from examples-generated/iam/rolepolicyattachment.yaml rename to examples-generated/iam/v1beta1/rolepolicyattachment.yaml diff --git a/examples-generated/iam/samlprovider.yaml b/examples-generated/iam/v1beta1/samlprovider.yaml similarity index 100% rename from examples-generated/iam/samlprovider.yaml rename to examples-generated/iam/v1beta1/samlprovider.yaml diff --git a/examples-generated/iam/servercertificate.yaml b/examples-generated/iam/v1beta1/servercertificate.yaml similarity index 100% rename from examples-generated/iam/servercertificate.yaml rename to examples-generated/iam/v1beta1/servercertificate.yaml diff --git a/examples-generated/iam/servicelinkedrole.yaml b/examples-generated/iam/v1beta1/servicelinkedrole.yaml similarity index 100% rename from examples-generated/iam/servicelinkedrole.yaml rename to examples-generated/iam/v1beta1/servicelinkedrole.yaml diff --git a/examples-generated/iam/servicespecificcredential.yaml b/examples-generated/iam/v1beta1/servicespecificcredential.yaml similarity index 100% rename from examples-generated/iam/servicespecificcredential.yaml rename to examples-generated/iam/v1beta1/servicespecificcredential.yaml diff --git a/examples-generated/iam/signingcertificate.yaml b/examples-generated/iam/v1beta1/signingcertificate.yaml similarity index 100% rename from examples-generated/iam/signingcertificate.yaml rename to examples-generated/iam/v1beta1/signingcertificate.yaml diff --git a/examples-generated/iam/user.yaml b/examples-generated/iam/v1beta1/user.yaml similarity index 100% rename from examples-generated/iam/user.yaml rename to examples-generated/iam/v1beta1/user.yaml diff --git a/examples-generated/iam/usergroupmembership.yaml b/examples-generated/iam/v1beta1/usergroupmembership.yaml similarity index 100% rename from examples-generated/iam/usergroupmembership.yaml rename to examples-generated/iam/v1beta1/usergroupmembership.yaml diff --git a/examples-generated/iam/userloginprofile.yaml b/examples-generated/iam/v1beta1/userloginprofile.yaml similarity index 100% rename from examples-generated/iam/userloginprofile.yaml rename to examples-generated/iam/v1beta1/userloginprofile.yaml diff --git a/examples-generated/iam/userpolicyattachment.yaml b/examples-generated/iam/v1beta1/userpolicyattachment.yaml similarity index 100% rename from examples-generated/iam/userpolicyattachment.yaml rename to examples-generated/iam/v1beta1/userpolicyattachment.yaml diff --git a/examples-generated/iam/usersshkey.yaml b/examples-generated/iam/v1beta1/usersshkey.yaml similarity index 100% rename from examples-generated/iam/usersshkey.yaml rename to examples-generated/iam/v1beta1/usersshkey.yaml diff --git a/examples-generated/iam/virtualmfadevice.yaml b/examples-generated/iam/v1beta1/virtualmfadevice.yaml similarity index 100% rename from examples-generated/iam/virtualmfadevice.yaml rename to examples-generated/iam/v1beta1/virtualmfadevice.yaml diff --git a/examples-generated/identitystore/group.yaml b/examples-generated/identitystore/v1beta1/group.yaml similarity index 100% rename from examples-generated/identitystore/group.yaml rename to examples-generated/identitystore/v1beta1/group.yaml diff --git a/examples-generated/identitystore/groupmembership.yaml b/examples-generated/identitystore/v1beta1/groupmembership.yaml similarity index 100% rename from examples-generated/identitystore/groupmembership.yaml rename to examples-generated/identitystore/v1beta1/groupmembership.yaml diff --git a/examples-generated/identitystore/user.yaml b/examples-generated/identitystore/v1beta1/user.yaml similarity index 100% rename from examples-generated/identitystore/user.yaml rename to examples-generated/identitystore/v1beta1/user.yaml diff --git a/examples-generated/imagebuilder/component.yaml b/examples-generated/imagebuilder/v1beta1/component.yaml similarity index 100% rename from examples-generated/imagebuilder/component.yaml rename to examples-generated/imagebuilder/v1beta1/component.yaml diff --git a/examples-generated/imagebuilder/containerrecipe.yaml b/examples-generated/imagebuilder/v1beta1/containerrecipe.yaml similarity index 100% rename from examples-generated/imagebuilder/containerrecipe.yaml rename to examples-generated/imagebuilder/v1beta1/containerrecipe.yaml diff --git a/examples-generated/imagebuilder/distributionconfiguration.yaml b/examples-generated/imagebuilder/v1beta1/distributionconfiguration.yaml similarity index 100% rename from examples-generated/imagebuilder/distributionconfiguration.yaml rename to examples-generated/imagebuilder/v1beta1/distributionconfiguration.yaml diff --git a/examples-generated/imagebuilder/image.yaml b/examples-generated/imagebuilder/v1beta1/image.yaml similarity index 100% rename from examples-generated/imagebuilder/image.yaml rename to examples-generated/imagebuilder/v1beta1/image.yaml diff --git a/examples-generated/imagebuilder/imagepipeline.yaml b/examples-generated/imagebuilder/v1beta1/imagepipeline.yaml similarity index 100% rename from examples-generated/imagebuilder/imagepipeline.yaml rename to examples-generated/imagebuilder/v1beta1/imagepipeline.yaml diff --git a/examples-generated/imagebuilder/imagerecipe.yaml b/examples-generated/imagebuilder/v1beta1/imagerecipe.yaml similarity index 100% rename from examples-generated/imagebuilder/imagerecipe.yaml rename to examples-generated/imagebuilder/v1beta1/imagerecipe.yaml diff --git a/examples-generated/imagebuilder/infrastructureconfiguration.yaml b/examples-generated/imagebuilder/v1beta1/infrastructureconfiguration.yaml similarity index 100% rename from examples-generated/imagebuilder/infrastructureconfiguration.yaml rename to examples-generated/imagebuilder/v1beta1/infrastructureconfiguration.yaml diff --git a/examples-generated/inspector/assessmenttarget.yaml b/examples-generated/inspector/v1beta1/assessmenttarget.yaml similarity index 100% rename from examples-generated/inspector/assessmenttarget.yaml rename to examples-generated/inspector/v1beta1/assessmenttarget.yaml diff --git a/examples-generated/inspector/assessmenttemplate.yaml b/examples-generated/inspector/v1beta1/assessmenttemplate.yaml similarity index 100% rename from examples-generated/inspector/assessmenttemplate.yaml rename to examples-generated/inspector/v1beta1/assessmenttemplate.yaml diff --git a/examples-generated/inspector/resourcegroup.yaml b/examples-generated/inspector/v1beta1/resourcegroup.yaml similarity index 100% rename from examples-generated/inspector/resourcegroup.yaml rename to examples-generated/inspector/v1beta1/resourcegroup.yaml diff --git a/examples-generated/inspector2/enabler.yaml b/examples-generated/inspector2/v1beta1/enabler.yaml similarity index 100% rename from examples-generated/inspector2/enabler.yaml rename to examples-generated/inspector2/v1beta1/enabler.yaml diff --git a/examples-generated/iot/certificate.yaml b/examples-generated/iot/v1beta1/certificate.yaml similarity index 100% rename from examples-generated/iot/certificate.yaml rename to examples-generated/iot/v1beta1/certificate.yaml diff --git a/examples-generated/iot/indexingconfiguration.yaml b/examples-generated/iot/v1beta1/indexingconfiguration.yaml similarity index 100% rename from examples-generated/iot/indexingconfiguration.yaml rename to examples-generated/iot/v1beta1/indexingconfiguration.yaml diff --git a/examples-generated/iot/loggingoptions.yaml b/examples-generated/iot/v1beta1/loggingoptions.yaml similarity index 100% rename from examples-generated/iot/loggingoptions.yaml rename to examples-generated/iot/v1beta1/loggingoptions.yaml diff --git a/examples-generated/iot/policy.yaml b/examples-generated/iot/v1beta1/policy.yaml similarity index 100% rename from examples-generated/iot/policy.yaml rename to examples-generated/iot/v1beta1/policy.yaml diff --git a/examples-generated/iot/policyattachment.yaml b/examples-generated/iot/v1beta1/policyattachment.yaml similarity index 100% rename from examples-generated/iot/policyattachment.yaml rename to examples-generated/iot/v1beta1/policyattachment.yaml diff --git a/examples-generated/iot/provisioningtemplate.yaml b/examples-generated/iot/v1beta1/provisioningtemplate.yaml similarity index 100% rename from examples-generated/iot/provisioningtemplate.yaml rename to examples-generated/iot/v1beta1/provisioningtemplate.yaml diff --git a/examples-generated/iot/rolealias.yaml b/examples-generated/iot/v1beta1/rolealias.yaml similarity index 100% rename from examples-generated/iot/rolealias.yaml rename to examples-generated/iot/v1beta1/rolealias.yaml diff --git a/examples-generated/iot/thing.yaml b/examples-generated/iot/v1beta1/thing.yaml similarity index 100% rename from examples-generated/iot/thing.yaml rename to examples-generated/iot/v1beta1/thing.yaml diff --git a/examples-generated/iot/thinggroup.yaml b/examples-generated/iot/v1beta1/thinggroup.yaml similarity index 100% rename from examples-generated/iot/thinggroup.yaml rename to examples-generated/iot/v1beta1/thinggroup.yaml diff --git a/examples-generated/iot/thinggroupmembership.yaml b/examples-generated/iot/v1beta1/thinggroupmembership.yaml similarity index 100% rename from examples-generated/iot/thinggroupmembership.yaml rename to examples-generated/iot/v1beta1/thinggroupmembership.yaml diff --git a/examples-generated/iot/thingprincipalattachment.yaml b/examples-generated/iot/v1beta1/thingprincipalattachment.yaml similarity index 100% rename from examples-generated/iot/thingprincipalattachment.yaml rename to examples-generated/iot/v1beta1/thingprincipalattachment.yaml diff --git a/examples-generated/iot/thingtype.yaml b/examples-generated/iot/v1beta1/thingtype.yaml similarity index 100% rename from examples-generated/iot/thingtype.yaml rename to examples-generated/iot/v1beta1/thingtype.yaml diff --git a/examples-generated/iot/topicrule.yaml b/examples-generated/iot/v1beta1/topicrule.yaml similarity index 100% rename from examples-generated/iot/topicrule.yaml rename to examples-generated/iot/v1beta1/topicrule.yaml diff --git a/examples-generated/iot/topicruledestination.yaml b/examples-generated/iot/v1beta1/topicruledestination.yaml similarity index 100% rename from examples-generated/iot/topicruledestination.yaml rename to examples-generated/iot/v1beta1/topicruledestination.yaml diff --git a/examples-generated/ivs/channel.yaml b/examples-generated/ivs/v1beta1/channel.yaml similarity index 100% rename from examples-generated/ivs/channel.yaml rename to examples-generated/ivs/v1beta1/channel.yaml diff --git a/examples-generated/ivs/recordingconfiguration.yaml b/examples-generated/ivs/v1beta1/recordingconfiguration.yaml similarity index 100% rename from examples-generated/ivs/recordingconfiguration.yaml rename to examples-generated/ivs/v1beta1/recordingconfiguration.yaml diff --git a/examples-generated/kafka/cluster.yaml b/examples-generated/kafka/v1beta1/cluster.yaml similarity index 100% rename from examples-generated/kafka/cluster.yaml rename to examples-generated/kafka/v1beta1/cluster.yaml diff --git a/examples-generated/kafka/configuration.yaml b/examples-generated/kafka/v1beta1/configuration.yaml similarity index 100% rename from examples-generated/kafka/configuration.yaml rename to examples-generated/kafka/v1beta1/configuration.yaml diff --git a/examples-generated/kafka/scramsecretassociation.yaml b/examples-generated/kafka/v1beta1/scramsecretassociation.yaml similarity index 100% rename from examples-generated/kafka/scramsecretassociation.yaml rename to examples-generated/kafka/v1beta1/scramsecretassociation.yaml diff --git a/examples-generated/kafka/serverlesscluster.yaml b/examples-generated/kafka/v1beta1/serverlesscluster.yaml similarity index 100% rename from examples-generated/kafka/serverlesscluster.yaml rename to examples-generated/kafka/v1beta1/serverlesscluster.yaml diff --git a/examples-generated/kendra/datasource.yaml b/examples-generated/kendra/v1beta1/datasource.yaml similarity index 100% rename from examples-generated/kendra/datasource.yaml rename to examples-generated/kendra/v1beta1/datasource.yaml diff --git a/examples-generated/kendra/experience.yaml b/examples-generated/kendra/v1beta1/experience.yaml similarity index 100% rename from examples-generated/kendra/experience.yaml rename to examples-generated/kendra/v1beta1/experience.yaml diff --git a/examples-generated/kendra/index.yaml b/examples-generated/kendra/v1beta1/index.yaml similarity index 100% rename from examples-generated/kendra/index.yaml rename to examples-generated/kendra/v1beta1/index.yaml diff --git a/examples-generated/kendra/querysuggestionsblocklist.yaml b/examples-generated/kendra/v1beta1/querysuggestionsblocklist.yaml similarity index 100% rename from examples-generated/kendra/querysuggestionsblocklist.yaml rename to examples-generated/kendra/v1beta1/querysuggestionsblocklist.yaml diff --git a/examples-generated/kendra/thesaurus.yaml b/examples-generated/kendra/v1beta1/thesaurus.yaml similarity index 100% rename from examples-generated/kendra/thesaurus.yaml rename to examples-generated/kendra/v1beta1/thesaurus.yaml diff --git a/examples-generated/keyspaces/keyspace.yaml b/examples-generated/keyspaces/v1beta1/keyspace.yaml similarity index 100% rename from examples-generated/keyspaces/keyspace.yaml rename to examples-generated/keyspaces/v1beta1/keyspace.yaml diff --git a/examples-generated/keyspaces/table.yaml b/examples-generated/keyspaces/v1beta1/table.yaml similarity index 100% rename from examples-generated/keyspaces/table.yaml rename to examples-generated/keyspaces/v1beta1/table.yaml diff --git a/examples-generated/kinesis/stream.yaml b/examples-generated/kinesis/v1beta1/stream.yaml similarity index 100% rename from examples-generated/kinesis/stream.yaml rename to examples-generated/kinesis/v1beta1/stream.yaml diff --git a/examples-generated/kinesis/streamconsumer.yaml b/examples-generated/kinesis/v1beta1/streamconsumer.yaml similarity index 100% rename from examples-generated/kinesis/streamconsumer.yaml rename to examples-generated/kinesis/v1beta1/streamconsumer.yaml diff --git a/examples-generated/kinesisanalytics/application.yaml b/examples-generated/kinesisanalytics/v1beta1/application.yaml similarity index 100% rename from examples-generated/kinesisanalytics/application.yaml rename to examples-generated/kinesisanalytics/v1beta1/application.yaml diff --git a/examples-generated/kinesisanalyticsv2/application.yaml b/examples-generated/kinesisanalyticsv2/v1beta1/application.yaml similarity index 100% rename from examples-generated/kinesisanalyticsv2/application.yaml rename to examples-generated/kinesisanalyticsv2/v1beta1/application.yaml diff --git a/examples-generated/kinesisanalyticsv2/applicationsnapshot.yaml b/examples-generated/kinesisanalyticsv2/v1beta1/applicationsnapshot.yaml similarity index 100% rename from examples-generated/kinesisanalyticsv2/applicationsnapshot.yaml rename to examples-generated/kinesisanalyticsv2/v1beta1/applicationsnapshot.yaml diff --git a/examples-generated/kinesisvideo/stream.yaml b/examples-generated/kinesisvideo/v1beta1/stream.yaml similarity index 100% rename from examples-generated/kinesisvideo/stream.yaml rename to examples-generated/kinesisvideo/v1beta1/stream.yaml diff --git a/examples-generated/kms/alias.yaml b/examples-generated/kms/v1beta1/alias.yaml similarity index 100% rename from examples-generated/kms/alias.yaml rename to examples-generated/kms/v1beta1/alias.yaml diff --git a/examples-generated/kms/ciphertext.yaml b/examples-generated/kms/v1beta1/ciphertext.yaml similarity index 100% rename from examples-generated/kms/ciphertext.yaml rename to examples-generated/kms/v1beta1/ciphertext.yaml diff --git a/examples-generated/kms/externalkey.yaml b/examples-generated/kms/v1beta1/externalkey.yaml similarity index 100% rename from examples-generated/kms/externalkey.yaml rename to examples-generated/kms/v1beta1/externalkey.yaml diff --git a/examples-generated/kms/grant.yaml b/examples-generated/kms/v1beta1/grant.yaml similarity index 100% rename from examples-generated/kms/grant.yaml rename to examples-generated/kms/v1beta1/grant.yaml diff --git a/examples-generated/kms/key.yaml b/examples-generated/kms/v1beta1/key.yaml similarity index 100% rename from examples-generated/kms/key.yaml rename to examples-generated/kms/v1beta1/key.yaml diff --git a/examples-generated/kms/replicaexternalkey.yaml b/examples-generated/kms/v1beta1/replicaexternalkey.yaml similarity index 100% rename from examples-generated/kms/replicaexternalkey.yaml rename to examples-generated/kms/v1beta1/replicaexternalkey.yaml diff --git a/examples-generated/kms/replicakey.yaml b/examples-generated/kms/v1beta1/replicakey.yaml similarity index 100% rename from examples-generated/kms/replicakey.yaml rename to examples-generated/kms/v1beta1/replicakey.yaml diff --git a/examples-generated/lakeformation/datalakesettings.yaml b/examples-generated/lakeformation/v1beta1/datalakesettings.yaml similarity index 100% rename from examples-generated/lakeformation/datalakesettings.yaml rename to examples-generated/lakeformation/v1beta1/datalakesettings.yaml diff --git a/examples-generated/lakeformation/permissions.yaml b/examples-generated/lakeformation/v1beta1/permissions.yaml similarity index 100% rename from examples-generated/lakeformation/permissions.yaml rename to examples-generated/lakeformation/v1beta1/permissions.yaml diff --git a/examples-generated/lakeformation/resource.yaml b/examples-generated/lakeformation/v1beta1/resource.yaml similarity index 100% rename from examples-generated/lakeformation/resource.yaml rename to examples-generated/lakeformation/v1beta1/resource.yaml diff --git a/examples-generated/lambda/alias.yaml b/examples-generated/lambda/v1beta1/alias.yaml similarity index 100% rename from examples-generated/lambda/alias.yaml rename to examples-generated/lambda/v1beta1/alias.yaml diff --git a/examples-generated/lambda/codesigningconfig.yaml b/examples-generated/lambda/v1beta1/codesigningconfig.yaml similarity index 100% rename from examples-generated/lambda/codesigningconfig.yaml rename to examples-generated/lambda/v1beta1/codesigningconfig.yaml diff --git a/examples-generated/lambda/eventsourcemapping.yaml b/examples-generated/lambda/v1beta1/eventsourcemapping.yaml similarity index 100% rename from examples-generated/lambda/eventsourcemapping.yaml rename to examples-generated/lambda/v1beta1/eventsourcemapping.yaml diff --git a/examples-generated/lambda/function.yaml b/examples-generated/lambda/v1beta1/function.yaml similarity index 100% rename from examples-generated/lambda/function.yaml rename to examples-generated/lambda/v1beta1/function.yaml diff --git a/examples-generated/lambda/functioneventinvokeconfig.yaml b/examples-generated/lambda/v1beta1/functioneventinvokeconfig.yaml similarity index 100% rename from examples-generated/lambda/functioneventinvokeconfig.yaml rename to examples-generated/lambda/v1beta1/functioneventinvokeconfig.yaml diff --git a/examples-generated/lambda/functionurl.yaml b/examples-generated/lambda/v1beta1/functionurl.yaml similarity index 100% rename from examples-generated/lambda/functionurl.yaml rename to examples-generated/lambda/v1beta1/functionurl.yaml diff --git a/examples-generated/lambda/invocation.yaml b/examples-generated/lambda/v1beta1/invocation.yaml similarity index 100% rename from examples-generated/lambda/invocation.yaml rename to examples-generated/lambda/v1beta1/invocation.yaml diff --git a/examples-generated/lambda/layerversion.yaml b/examples-generated/lambda/v1beta1/layerversion.yaml similarity index 100% rename from examples-generated/lambda/layerversion.yaml rename to examples-generated/lambda/v1beta1/layerversion.yaml diff --git a/examples-generated/lambda/layerversionpermission.yaml b/examples-generated/lambda/v1beta1/layerversionpermission.yaml similarity index 100% rename from examples-generated/lambda/layerversionpermission.yaml rename to examples-generated/lambda/v1beta1/layerversionpermission.yaml diff --git a/examples-generated/lambda/permission.yaml b/examples-generated/lambda/v1beta1/permission.yaml similarity index 100% rename from examples-generated/lambda/permission.yaml rename to examples-generated/lambda/v1beta1/permission.yaml diff --git a/examples-generated/lambda/provisionedconcurrencyconfig.yaml b/examples-generated/lambda/v1beta1/provisionedconcurrencyconfig.yaml similarity index 100% rename from examples-generated/lambda/provisionedconcurrencyconfig.yaml rename to examples-generated/lambda/v1beta1/provisionedconcurrencyconfig.yaml diff --git a/examples-generated/lexmodels/bot.yaml b/examples-generated/lexmodels/v1beta1/bot.yaml similarity index 100% rename from examples-generated/lexmodels/bot.yaml rename to examples-generated/lexmodels/v1beta1/bot.yaml diff --git a/examples-generated/lexmodels/botalias.yaml b/examples-generated/lexmodels/v1beta1/botalias.yaml similarity index 100% rename from examples-generated/lexmodels/botalias.yaml rename to examples-generated/lexmodels/v1beta1/botalias.yaml diff --git a/examples-generated/lexmodels/intent.yaml b/examples-generated/lexmodels/v1beta1/intent.yaml similarity index 100% rename from examples-generated/lexmodels/intent.yaml rename to examples-generated/lexmodels/v1beta1/intent.yaml diff --git a/examples-generated/lexmodels/slottype.yaml b/examples-generated/lexmodels/v1beta1/slottype.yaml similarity index 100% rename from examples-generated/lexmodels/slottype.yaml rename to examples-generated/lexmodels/v1beta1/slottype.yaml diff --git a/examples-generated/licensemanager/association.yaml b/examples-generated/licensemanager/v1beta1/association.yaml similarity index 100% rename from examples-generated/licensemanager/association.yaml rename to examples-generated/licensemanager/v1beta1/association.yaml diff --git a/examples-generated/licensemanager/licenseconfiguration.yaml b/examples-generated/licensemanager/v1beta1/licenseconfiguration.yaml similarity index 100% rename from examples-generated/licensemanager/licenseconfiguration.yaml rename to examples-generated/licensemanager/v1beta1/licenseconfiguration.yaml diff --git a/examples-generated/lightsail/bucket.yaml b/examples-generated/lightsail/v1beta1/bucket.yaml similarity index 100% rename from examples-generated/lightsail/bucket.yaml rename to examples-generated/lightsail/v1beta1/bucket.yaml diff --git a/examples-generated/lightsail/certificate.yaml b/examples-generated/lightsail/v1beta1/certificate.yaml similarity index 100% rename from examples-generated/lightsail/certificate.yaml rename to examples-generated/lightsail/v1beta1/certificate.yaml diff --git a/examples-generated/lightsail/containerservice.yaml b/examples-generated/lightsail/v1beta1/containerservice.yaml similarity index 100% rename from examples-generated/lightsail/containerservice.yaml rename to examples-generated/lightsail/v1beta1/containerservice.yaml diff --git a/examples-generated/lightsail/disk.yaml b/examples-generated/lightsail/v1beta1/disk.yaml similarity index 100% rename from examples-generated/lightsail/disk.yaml rename to examples-generated/lightsail/v1beta1/disk.yaml diff --git a/examples-generated/lightsail/diskattachment.yaml b/examples-generated/lightsail/v1beta1/diskattachment.yaml similarity index 100% rename from examples-generated/lightsail/diskattachment.yaml rename to examples-generated/lightsail/v1beta1/diskattachment.yaml diff --git a/examples-generated/lightsail/domain.yaml b/examples-generated/lightsail/v1beta1/domain.yaml similarity index 100% rename from examples-generated/lightsail/domain.yaml rename to examples-generated/lightsail/v1beta1/domain.yaml diff --git a/examples-generated/lightsail/domainentry.yaml b/examples-generated/lightsail/v1beta1/domainentry.yaml similarity index 100% rename from examples-generated/lightsail/domainentry.yaml rename to examples-generated/lightsail/v1beta1/domainentry.yaml diff --git a/examples-generated/lightsail/instance.yaml b/examples-generated/lightsail/v1beta1/instance.yaml similarity index 100% rename from examples-generated/lightsail/instance.yaml rename to examples-generated/lightsail/v1beta1/instance.yaml diff --git a/examples-generated/lightsail/instancepublicports.yaml b/examples-generated/lightsail/v1beta1/instancepublicports.yaml similarity index 100% rename from examples-generated/lightsail/instancepublicports.yaml rename to examples-generated/lightsail/v1beta1/instancepublicports.yaml diff --git a/examples-generated/lightsail/keypair.yaml b/examples-generated/lightsail/v1beta1/keypair.yaml similarity index 100% rename from examples-generated/lightsail/keypair.yaml rename to examples-generated/lightsail/v1beta1/keypair.yaml diff --git a/examples-generated/lightsail/lb.yaml b/examples-generated/lightsail/v1beta1/lb.yaml similarity index 100% rename from examples-generated/lightsail/lb.yaml rename to examples-generated/lightsail/v1beta1/lb.yaml diff --git a/examples-generated/lightsail/lbattachment.yaml b/examples-generated/lightsail/v1beta1/lbattachment.yaml similarity index 100% rename from examples-generated/lightsail/lbattachment.yaml rename to examples-generated/lightsail/v1beta1/lbattachment.yaml diff --git a/examples-generated/lightsail/lbcertificate.yaml b/examples-generated/lightsail/v1beta1/lbcertificate.yaml similarity index 100% rename from examples-generated/lightsail/lbcertificate.yaml rename to examples-generated/lightsail/v1beta1/lbcertificate.yaml diff --git a/examples-generated/lightsail/lbstickinesspolicy.yaml b/examples-generated/lightsail/v1beta1/lbstickinesspolicy.yaml similarity index 100% rename from examples-generated/lightsail/lbstickinesspolicy.yaml rename to examples-generated/lightsail/v1beta1/lbstickinesspolicy.yaml diff --git a/examples-generated/lightsail/staticip.yaml b/examples-generated/lightsail/v1beta1/staticip.yaml similarity index 100% rename from examples-generated/lightsail/staticip.yaml rename to examples-generated/lightsail/v1beta1/staticip.yaml diff --git a/examples-generated/lightsail/staticipattachment.yaml b/examples-generated/lightsail/v1beta1/staticipattachment.yaml similarity index 100% rename from examples-generated/lightsail/staticipattachment.yaml rename to examples-generated/lightsail/v1beta1/staticipattachment.yaml diff --git a/examples-generated/location/geofencecollection.yaml b/examples-generated/location/v1beta1/geofencecollection.yaml similarity index 100% rename from examples-generated/location/geofencecollection.yaml rename to examples-generated/location/v1beta1/geofencecollection.yaml diff --git a/examples-generated/location/placeindex.yaml b/examples-generated/location/v1beta1/placeindex.yaml similarity index 100% rename from examples-generated/location/placeindex.yaml rename to examples-generated/location/v1beta1/placeindex.yaml diff --git a/examples-generated/location/routecalculator.yaml b/examples-generated/location/v1beta1/routecalculator.yaml similarity index 100% rename from examples-generated/location/routecalculator.yaml rename to examples-generated/location/v1beta1/routecalculator.yaml diff --git a/examples-generated/location/tracker.yaml b/examples-generated/location/v1beta1/tracker.yaml similarity index 100% rename from examples-generated/location/tracker.yaml rename to examples-generated/location/v1beta1/tracker.yaml diff --git a/examples-generated/location/trackerassociation.yaml b/examples-generated/location/v1beta1/trackerassociation.yaml similarity index 100% rename from examples-generated/location/trackerassociation.yaml rename to examples-generated/location/v1beta1/trackerassociation.yaml diff --git a/examples-generated/macie2/account.yaml b/examples-generated/macie2/v1beta1/account.yaml similarity index 100% rename from examples-generated/macie2/account.yaml rename to examples-generated/macie2/v1beta1/account.yaml diff --git a/examples-generated/macie2/classificationjob.yaml b/examples-generated/macie2/v1beta1/classificationjob.yaml similarity index 100% rename from examples-generated/macie2/classificationjob.yaml rename to examples-generated/macie2/v1beta1/classificationjob.yaml diff --git a/examples-generated/macie2/customdataidentifier.yaml b/examples-generated/macie2/v1beta1/customdataidentifier.yaml similarity index 100% rename from examples-generated/macie2/customdataidentifier.yaml rename to examples-generated/macie2/v1beta1/customdataidentifier.yaml diff --git a/examples-generated/macie2/findingsfilter.yaml b/examples-generated/macie2/v1beta1/findingsfilter.yaml similarity index 100% rename from examples-generated/macie2/findingsfilter.yaml rename to examples-generated/macie2/v1beta1/findingsfilter.yaml diff --git a/examples-generated/macie2/invitationaccepter.yaml b/examples-generated/macie2/v1beta1/invitationaccepter.yaml similarity index 100% rename from examples-generated/macie2/invitationaccepter.yaml rename to examples-generated/macie2/v1beta1/invitationaccepter.yaml diff --git a/examples-generated/macie2/member.yaml b/examples-generated/macie2/v1beta1/member.yaml similarity index 100% rename from examples-generated/macie2/member.yaml rename to examples-generated/macie2/v1beta1/member.yaml diff --git a/examples-generated/mediaconvert/queue.yaml b/examples-generated/mediaconvert/v1beta1/queue.yaml similarity index 100% rename from examples-generated/mediaconvert/queue.yaml rename to examples-generated/mediaconvert/v1beta1/queue.yaml diff --git a/examples-generated/medialive/channel.yaml b/examples-generated/medialive/v1beta1/channel.yaml similarity index 100% rename from examples-generated/medialive/channel.yaml rename to examples-generated/medialive/v1beta1/channel.yaml diff --git a/examples-generated/medialive/input.yaml b/examples-generated/medialive/v1beta1/input.yaml similarity index 100% rename from examples-generated/medialive/input.yaml rename to examples-generated/medialive/v1beta1/input.yaml diff --git a/examples-generated/medialive/inputsecuritygroup.yaml b/examples-generated/medialive/v1beta1/inputsecuritygroup.yaml similarity index 100% rename from examples-generated/medialive/inputsecuritygroup.yaml rename to examples-generated/medialive/v1beta1/inputsecuritygroup.yaml diff --git a/examples-generated/medialive/multiplex.yaml b/examples-generated/medialive/v1beta1/multiplex.yaml similarity index 100% rename from examples-generated/medialive/multiplex.yaml rename to examples-generated/medialive/v1beta1/multiplex.yaml diff --git a/examples-generated/mediapackage/channel.yaml b/examples-generated/mediapackage/v1beta1/channel.yaml similarity index 100% rename from examples-generated/mediapackage/channel.yaml rename to examples-generated/mediapackage/v1beta1/channel.yaml diff --git a/examples-generated/mediastore/container.yaml b/examples-generated/mediastore/v1beta1/container.yaml similarity index 100% rename from examples-generated/mediastore/container.yaml rename to examples-generated/mediastore/v1beta1/container.yaml diff --git a/examples-generated/mediastore/containerpolicy.yaml b/examples-generated/mediastore/v1beta1/containerpolicy.yaml similarity index 100% rename from examples-generated/mediastore/containerpolicy.yaml rename to examples-generated/mediastore/v1beta1/containerpolicy.yaml diff --git a/examples-generated/memorydb/acl.yaml b/examples-generated/memorydb/v1beta1/acl.yaml similarity index 100% rename from examples-generated/memorydb/acl.yaml rename to examples-generated/memorydb/v1beta1/acl.yaml diff --git a/examples-generated/memorydb/cluster.yaml b/examples-generated/memorydb/v1beta1/cluster.yaml similarity index 100% rename from examples-generated/memorydb/cluster.yaml rename to examples-generated/memorydb/v1beta1/cluster.yaml diff --git a/examples-generated/memorydb/parametergroup.yaml b/examples-generated/memorydb/v1beta1/parametergroup.yaml similarity index 100% rename from examples-generated/memorydb/parametergroup.yaml rename to examples-generated/memorydb/v1beta1/parametergroup.yaml diff --git a/examples-generated/memorydb/snapshot.yaml b/examples-generated/memorydb/v1beta1/snapshot.yaml similarity index 100% rename from examples-generated/memorydb/snapshot.yaml rename to examples-generated/memorydb/v1beta1/snapshot.yaml diff --git a/examples-generated/memorydb/subnetgroup.yaml b/examples-generated/memorydb/v1beta1/subnetgroup.yaml similarity index 100% rename from examples-generated/memorydb/subnetgroup.yaml rename to examples-generated/memorydb/v1beta1/subnetgroup.yaml diff --git a/examples-generated/mq/broker.yaml b/examples-generated/mq/v1beta1/broker.yaml similarity index 100% rename from examples-generated/mq/broker.yaml rename to examples-generated/mq/v1beta1/broker.yaml diff --git a/examples-generated/mq/configuration.yaml b/examples-generated/mq/v1beta1/configuration.yaml similarity index 100% rename from examples-generated/mq/configuration.yaml rename to examples-generated/mq/v1beta1/configuration.yaml diff --git a/examples-generated/neptune/cluster.yaml b/examples-generated/neptune/v1beta1/cluster.yaml similarity index 100% rename from examples-generated/neptune/cluster.yaml rename to examples-generated/neptune/v1beta1/cluster.yaml diff --git a/examples-generated/neptune/clusterendpoint.yaml b/examples-generated/neptune/v1beta1/clusterendpoint.yaml similarity index 100% rename from examples-generated/neptune/clusterendpoint.yaml rename to examples-generated/neptune/v1beta1/clusterendpoint.yaml diff --git a/examples-generated/neptune/clusterinstance.yaml b/examples-generated/neptune/v1beta1/clusterinstance.yaml similarity index 100% rename from examples-generated/neptune/clusterinstance.yaml rename to examples-generated/neptune/v1beta1/clusterinstance.yaml diff --git a/examples-generated/neptune/clusterparametergroup.yaml b/examples-generated/neptune/v1beta1/clusterparametergroup.yaml similarity index 100% rename from examples-generated/neptune/clusterparametergroup.yaml rename to examples-generated/neptune/v1beta1/clusterparametergroup.yaml diff --git a/examples-generated/neptune/clustersnapshot.yaml b/examples-generated/neptune/v1beta1/clustersnapshot.yaml similarity index 100% rename from examples-generated/neptune/clustersnapshot.yaml rename to examples-generated/neptune/v1beta1/clustersnapshot.yaml diff --git a/examples-generated/neptune/eventsubscription.yaml b/examples-generated/neptune/v1beta1/eventsubscription.yaml similarity index 100% rename from examples-generated/neptune/eventsubscription.yaml rename to examples-generated/neptune/v1beta1/eventsubscription.yaml diff --git a/examples-generated/neptune/globalcluster.yaml b/examples-generated/neptune/v1beta1/globalcluster.yaml similarity index 100% rename from examples-generated/neptune/globalcluster.yaml rename to examples-generated/neptune/v1beta1/globalcluster.yaml diff --git a/examples-generated/neptune/parametergroup.yaml b/examples-generated/neptune/v1beta1/parametergroup.yaml similarity index 100% rename from examples-generated/neptune/parametergroup.yaml rename to examples-generated/neptune/v1beta1/parametergroup.yaml diff --git a/examples-generated/neptune/subnetgroup.yaml b/examples-generated/neptune/v1beta1/subnetgroup.yaml similarity index 100% rename from examples-generated/neptune/subnetgroup.yaml rename to examples-generated/neptune/v1beta1/subnetgroup.yaml diff --git a/examples-generated/networkfirewall/firewall.yaml b/examples-generated/networkfirewall/v1beta1/firewall.yaml similarity index 100% rename from examples-generated/networkfirewall/firewall.yaml rename to examples-generated/networkfirewall/v1beta1/firewall.yaml diff --git a/examples-generated/networkfirewall/firewallpolicy.yaml b/examples-generated/networkfirewall/v1beta1/firewallpolicy.yaml similarity index 100% rename from examples-generated/networkfirewall/firewallpolicy.yaml rename to examples-generated/networkfirewall/v1beta1/firewallpolicy.yaml diff --git a/examples-generated/networkfirewall/loggingconfiguration.yaml b/examples-generated/networkfirewall/v1beta1/loggingconfiguration.yaml similarity index 100% rename from examples-generated/networkfirewall/loggingconfiguration.yaml rename to examples-generated/networkfirewall/v1beta1/loggingconfiguration.yaml diff --git a/examples-generated/networkfirewall/rulegroup.yaml b/examples-generated/networkfirewall/v1beta1/rulegroup.yaml similarity index 100% rename from examples-generated/networkfirewall/rulegroup.yaml rename to examples-generated/networkfirewall/v1beta1/rulegroup.yaml diff --git a/examples-generated/networkmanager/attachmentaccepter.yaml b/examples-generated/networkmanager/v1beta1/attachmentaccepter.yaml similarity index 100% rename from examples-generated/networkmanager/attachmentaccepter.yaml rename to examples-generated/networkmanager/v1beta1/attachmentaccepter.yaml diff --git a/examples-generated/networkmanager/connectattachment.yaml b/examples-generated/networkmanager/v1beta1/connectattachment.yaml similarity index 100% rename from examples-generated/networkmanager/connectattachment.yaml rename to examples-generated/networkmanager/v1beta1/connectattachment.yaml diff --git a/examples-generated/networkmanager/connection.yaml b/examples-generated/networkmanager/v1beta1/connection.yaml similarity index 100% rename from examples-generated/networkmanager/connection.yaml rename to examples-generated/networkmanager/v1beta1/connection.yaml diff --git a/examples-generated/networkmanager/corenetwork.yaml b/examples-generated/networkmanager/v1beta1/corenetwork.yaml similarity index 100% rename from examples-generated/networkmanager/corenetwork.yaml rename to examples-generated/networkmanager/v1beta1/corenetwork.yaml diff --git a/examples-generated/networkmanager/customergatewayassociation.yaml b/examples-generated/networkmanager/v1beta1/customergatewayassociation.yaml similarity index 100% rename from examples-generated/networkmanager/customergatewayassociation.yaml rename to examples-generated/networkmanager/v1beta1/customergatewayassociation.yaml diff --git a/examples-generated/networkmanager/device.yaml b/examples-generated/networkmanager/v1beta1/device.yaml similarity index 100% rename from examples-generated/networkmanager/device.yaml rename to examples-generated/networkmanager/v1beta1/device.yaml diff --git a/examples-generated/networkmanager/globalnetwork.yaml b/examples-generated/networkmanager/v1beta1/globalnetwork.yaml similarity index 100% rename from examples-generated/networkmanager/globalnetwork.yaml rename to examples-generated/networkmanager/v1beta1/globalnetwork.yaml diff --git a/examples-generated/networkmanager/link.yaml b/examples-generated/networkmanager/v1beta1/link.yaml similarity index 100% rename from examples-generated/networkmanager/link.yaml rename to examples-generated/networkmanager/v1beta1/link.yaml diff --git a/examples-generated/networkmanager/linkassociation.yaml b/examples-generated/networkmanager/v1beta1/linkassociation.yaml similarity index 100% rename from examples-generated/networkmanager/linkassociation.yaml rename to examples-generated/networkmanager/v1beta1/linkassociation.yaml diff --git a/examples-generated/networkmanager/site.yaml b/examples-generated/networkmanager/v1beta1/site.yaml similarity index 100% rename from examples-generated/networkmanager/site.yaml rename to examples-generated/networkmanager/v1beta1/site.yaml diff --git a/examples-generated/networkmanager/transitgatewayconnectpeerassociation.yaml b/examples-generated/networkmanager/v1beta1/transitgatewayconnectpeerassociation.yaml similarity index 100% rename from examples-generated/networkmanager/transitgatewayconnectpeerassociation.yaml rename to examples-generated/networkmanager/v1beta1/transitgatewayconnectpeerassociation.yaml diff --git a/examples-generated/networkmanager/transitgatewayregistration.yaml b/examples-generated/networkmanager/v1beta1/transitgatewayregistration.yaml similarity index 100% rename from examples-generated/networkmanager/transitgatewayregistration.yaml rename to examples-generated/networkmanager/v1beta1/transitgatewayregistration.yaml diff --git a/examples-generated/networkmanager/vpcattachment.yaml b/examples-generated/networkmanager/v1beta1/vpcattachment.yaml similarity index 100% rename from examples-generated/networkmanager/vpcattachment.yaml rename to examples-generated/networkmanager/v1beta1/vpcattachment.yaml diff --git a/examples-generated/opensearch/domain.yaml b/examples-generated/opensearch/v1beta1/domain.yaml similarity index 100% rename from examples-generated/opensearch/domain.yaml rename to examples-generated/opensearch/v1beta1/domain.yaml diff --git a/examples-generated/opensearch/domainpolicy.yaml b/examples-generated/opensearch/v1beta1/domainpolicy.yaml similarity index 100% rename from examples-generated/opensearch/domainpolicy.yaml rename to examples-generated/opensearch/v1beta1/domainpolicy.yaml diff --git a/examples-generated/opensearch/domainsamloptions.yaml b/examples-generated/opensearch/v1beta1/domainsamloptions.yaml similarity index 100% rename from examples-generated/opensearch/domainsamloptions.yaml rename to examples-generated/opensearch/v1beta1/domainsamloptions.yaml diff --git a/examples-generated/opsworks/application.yaml b/examples-generated/opsworks/v1beta1/application.yaml similarity index 100% rename from examples-generated/opsworks/application.yaml rename to examples-generated/opsworks/v1beta1/application.yaml diff --git a/examples-generated/opsworks/customlayer.yaml b/examples-generated/opsworks/v1beta1/customlayer.yaml similarity index 100% rename from examples-generated/opsworks/customlayer.yaml rename to examples-generated/opsworks/v1beta1/customlayer.yaml diff --git a/examples-generated/opsworks/ecsclusterlayer.yaml b/examples-generated/opsworks/v1beta1/ecsclusterlayer.yaml similarity index 100% rename from examples-generated/opsworks/ecsclusterlayer.yaml rename to examples-generated/opsworks/v1beta1/ecsclusterlayer.yaml diff --git a/examples-generated/opsworks/ganglialayer.yaml b/examples-generated/opsworks/v1beta1/ganglialayer.yaml similarity index 100% rename from examples-generated/opsworks/ganglialayer.yaml rename to examples-generated/opsworks/v1beta1/ganglialayer.yaml diff --git a/examples-generated/opsworks/haproxylayer.yaml b/examples-generated/opsworks/v1beta1/haproxylayer.yaml similarity index 100% rename from examples-generated/opsworks/haproxylayer.yaml rename to examples-generated/opsworks/v1beta1/haproxylayer.yaml diff --git a/examples-generated/opsworks/instance.yaml b/examples-generated/opsworks/v1beta1/instance.yaml similarity index 100% rename from examples-generated/opsworks/instance.yaml rename to examples-generated/opsworks/v1beta1/instance.yaml diff --git a/examples-generated/opsworks/javaapplayer.yaml b/examples-generated/opsworks/v1beta1/javaapplayer.yaml similarity index 100% rename from examples-generated/opsworks/javaapplayer.yaml rename to examples-generated/opsworks/v1beta1/javaapplayer.yaml diff --git a/examples-generated/opsworks/memcachedlayer.yaml b/examples-generated/opsworks/v1beta1/memcachedlayer.yaml similarity index 100% rename from examples-generated/opsworks/memcachedlayer.yaml rename to examples-generated/opsworks/v1beta1/memcachedlayer.yaml diff --git a/examples-generated/opsworks/mysqllayer.yaml b/examples-generated/opsworks/v1beta1/mysqllayer.yaml similarity index 100% rename from examples-generated/opsworks/mysqllayer.yaml rename to examples-generated/opsworks/v1beta1/mysqllayer.yaml diff --git a/examples-generated/opsworks/nodejsapplayer.yaml b/examples-generated/opsworks/v1beta1/nodejsapplayer.yaml similarity index 100% rename from examples-generated/opsworks/nodejsapplayer.yaml rename to examples-generated/opsworks/v1beta1/nodejsapplayer.yaml diff --git a/examples-generated/opsworks/permission.yaml b/examples-generated/opsworks/v1beta1/permission.yaml similarity index 100% rename from examples-generated/opsworks/permission.yaml rename to examples-generated/opsworks/v1beta1/permission.yaml diff --git a/examples-generated/opsworks/phpapplayer.yaml b/examples-generated/opsworks/v1beta1/phpapplayer.yaml similarity index 100% rename from examples-generated/opsworks/phpapplayer.yaml rename to examples-generated/opsworks/v1beta1/phpapplayer.yaml diff --git a/examples-generated/opsworks/railsapplayer.yaml b/examples-generated/opsworks/v1beta1/railsapplayer.yaml similarity index 100% rename from examples-generated/opsworks/railsapplayer.yaml rename to examples-generated/opsworks/v1beta1/railsapplayer.yaml diff --git a/examples-generated/opsworks/rdsdbinstance.yaml b/examples-generated/opsworks/v1beta1/rdsdbinstance.yaml similarity index 100% rename from examples-generated/opsworks/rdsdbinstance.yaml rename to examples-generated/opsworks/v1beta1/rdsdbinstance.yaml diff --git a/examples-generated/opsworks/stack.yaml b/examples-generated/opsworks/v1beta1/stack.yaml similarity index 100% rename from examples-generated/opsworks/stack.yaml rename to examples-generated/opsworks/v1beta1/stack.yaml diff --git a/examples-generated/opsworks/staticweblayer.yaml b/examples-generated/opsworks/v1beta1/staticweblayer.yaml similarity index 100% rename from examples-generated/opsworks/staticweblayer.yaml rename to examples-generated/opsworks/v1beta1/staticweblayer.yaml diff --git a/examples-generated/opsworks/userprofile.yaml b/examples-generated/opsworks/v1beta1/userprofile.yaml similarity index 100% rename from examples-generated/opsworks/userprofile.yaml rename to examples-generated/opsworks/v1beta1/userprofile.yaml diff --git a/examples-generated/organizations/account.yaml b/examples-generated/organizations/v1beta1/account.yaml similarity index 100% rename from examples-generated/organizations/account.yaml rename to examples-generated/organizations/v1beta1/account.yaml diff --git a/examples-generated/organizations/delegatedadministrator.yaml b/examples-generated/organizations/v1beta1/delegatedadministrator.yaml similarity index 100% rename from examples-generated/organizations/delegatedadministrator.yaml rename to examples-generated/organizations/v1beta1/delegatedadministrator.yaml diff --git a/examples-generated/organizations/organization.yaml b/examples-generated/organizations/v1beta1/organization.yaml similarity index 100% rename from examples-generated/organizations/organization.yaml rename to examples-generated/organizations/v1beta1/organization.yaml diff --git a/examples-generated/organizations/organizationalunit.yaml b/examples-generated/organizations/v1beta1/organizationalunit.yaml similarity index 100% rename from examples-generated/organizations/organizationalunit.yaml rename to examples-generated/organizations/v1beta1/organizationalunit.yaml diff --git a/examples-generated/organizations/policy.yaml b/examples-generated/organizations/v1beta1/policy.yaml similarity index 100% rename from examples-generated/organizations/policy.yaml rename to examples-generated/organizations/v1beta1/policy.yaml diff --git a/examples-generated/organizations/policyattachment.yaml b/examples-generated/organizations/v1beta1/policyattachment.yaml similarity index 100% rename from examples-generated/organizations/policyattachment.yaml rename to examples-generated/organizations/v1beta1/policyattachment.yaml diff --git a/examples-generated/pinpoint/app.yaml b/examples-generated/pinpoint/v1beta1/app.yaml similarity index 100% rename from examples-generated/pinpoint/app.yaml rename to examples-generated/pinpoint/v1beta1/app.yaml diff --git a/examples-generated/pinpoint/smschannel.yaml b/examples-generated/pinpoint/v1beta1/smschannel.yaml similarity index 100% rename from examples-generated/pinpoint/smschannel.yaml rename to examples-generated/pinpoint/v1beta1/smschannel.yaml diff --git a/examples-generated/qldb/ledger.yaml b/examples-generated/qldb/v1beta1/ledger.yaml similarity index 100% rename from examples-generated/qldb/ledger.yaml rename to examples-generated/qldb/v1beta1/ledger.yaml diff --git a/examples-generated/qldb/stream.yaml b/examples-generated/qldb/v1beta1/stream.yaml similarity index 100% rename from examples-generated/qldb/stream.yaml rename to examples-generated/qldb/v1beta1/stream.yaml diff --git a/examples-generated/quicksight/group.yaml b/examples-generated/quicksight/v1beta1/group.yaml similarity index 100% rename from examples-generated/quicksight/group.yaml rename to examples-generated/quicksight/v1beta1/group.yaml diff --git a/examples-generated/quicksight/user.yaml b/examples-generated/quicksight/v1beta1/user.yaml similarity index 100% rename from examples-generated/quicksight/user.yaml rename to examples-generated/quicksight/v1beta1/user.yaml diff --git a/examples-generated/ram/principalassociation.yaml b/examples-generated/ram/v1beta1/principalassociation.yaml similarity index 100% rename from examples-generated/ram/principalassociation.yaml rename to examples-generated/ram/v1beta1/principalassociation.yaml diff --git a/examples-generated/ram/resourceassociation.yaml b/examples-generated/ram/v1beta1/resourceassociation.yaml similarity index 100% rename from examples-generated/ram/resourceassociation.yaml rename to examples-generated/ram/v1beta1/resourceassociation.yaml diff --git a/examples-generated/ram/resourceshare.yaml b/examples-generated/ram/v1beta1/resourceshare.yaml similarity index 100% rename from examples-generated/ram/resourceshare.yaml rename to examples-generated/ram/v1beta1/resourceshare.yaml diff --git a/examples-generated/ram/resourceshareaccepter.yaml b/examples-generated/ram/v1beta1/resourceshareaccepter.yaml similarity index 100% rename from examples-generated/ram/resourceshareaccepter.yaml rename to examples-generated/ram/v1beta1/resourceshareaccepter.yaml diff --git a/examples-generated/rds/cluster.yaml b/examples-generated/rds/v1beta1/cluster.yaml similarity index 100% rename from examples-generated/rds/cluster.yaml rename to examples-generated/rds/v1beta1/cluster.yaml diff --git a/examples-generated/rds/clusteractivitystream.yaml b/examples-generated/rds/v1beta1/clusteractivitystream.yaml similarity index 100% rename from examples-generated/rds/clusteractivitystream.yaml rename to examples-generated/rds/v1beta1/clusteractivitystream.yaml diff --git a/examples-generated/rds/clusterendpoint.yaml b/examples-generated/rds/v1beta1/clusterendpoint.yaml similarity index 100% rename from examples-generated/rds/clusterendpoint.yaml rename to examples-generated/rds/v1beta1/clusterendpoint.yaml diff --git a/examples-generated/rds/clusterinstance.yaml b/examples-generated/rds/v1beta1/clusterinstance.yaml similarity index 100% rename from examples-generated/rds/clusterinstance.yaml rename to examples-generated/rds/v1beta1/clusterinstance.yaml diff --git a/examples-generated/rds/clusterparametergroup.yaml b/examples-generated/rds/v1beta1/clusterparametergroup.yaml similarity index 100% rename from examples-generated/rds/clusterparametergroup.yaml rename to examples-generated/rds/v1beta1/clusterparametergroup.yaml diff --git a/examples-generated/rds/clusterroleassociation.yaml b/examples-generated/rds/v1beta1/clusterroleassociation.yaml similarity index 100% rename from examples-generated/rds/clusterroleassociation.yaml rename to examples-generated/rds/v1beta1/clusterroleassociation.yaml diff --git a/examples-generated/rds/clustersnapshot.yaml b/examples-generated/rds/v1beta1/clustersnapshot.yaml similarity index 100% rename from examples-generated/rds/clustersnapshot.yaml rename to examples-generated/rds/v1beta1/clustersnapshot.yaml diff --git a/examples-generated/rds/dbinstanceautomatedbackupsreplication.yaml b/examples-generated/rds/v1beta1/dbinstanceautomatedbackupsreplication.yaml similarity index 100% rename from examples-generated/rds/dbinstanceautomatedbackupsreplication.yaml rename to examples-generated/rds/v1beta1/dbinstanceautomatedbackupsreplication.yaml diff --git a/examples-generated/rds/dbsnapshotcopy.yaml b/examples-generated/rds/v1beta1/dbsnapshotcopy.yaml similarity index 100% rename from examples-generated/rds/dbsnapshotcopy.yaml rename to examples-generated/rds/v1beta1/dbsnapshotcopy.yaml diff --git a/examples-generated/rds/eventsubscription.yaml b/examples-generated/rds/v1beta1/eventsubscription.yaml similarity index 100% rename from examples-generated/rds/eventsubscription.yaml rename to examples-generated/rds/v1beta1/eventsubscription.yaml diff --git a/examples-generated/rds/globalcluster.yaml b/examples-generated/rds/v1beta1/globalcluster.yaml similarity index 100% rename from examples-generated/rds/globalcluster.yaml rename to examples-generated/rds/v1beta1/globalcluster.yaml diff --git a/examples-generated/rds/instance.yaml b/examples-generated/rds/v1beta1/instance.yaml similarity index 100% rename from examples-generated/rds/instance.yaml rename to examples-generated/rds/v1beta1/instance.yaml diff --git a/examples-generated/rds/instanceroleassociation.yaml b/examples-generated/rds/v1beta1/instanceroleassociation.yaml similarity index 100% rename from examples-generated/rds/instanceroleassociation.yaml rename to examples-generated/rds/v1beta1/instanceroleassociation.yaml diff --git a/examples-generated/rds/optiongroup.yaml b/examples-generated/rds/v1beta1/optiongroup.yaml similarity index 100% rename from examples-generated/rds/optiongroup.yaml rename to examples-generated/rds/v1beta1/optiongroup.yaml diff --git a/examples-generated/rds/parametergroup.yaml b/examples-generated/rds/v1beta1/parametergroup.yaml similarity index 100% rename from examples-generated/rds/parametergroup.yaml rename to examples-generated/rds/v1beta1/parametergroup.yaml diff --git a/examples-generated/rds/proxy.yaml b/examples-generated/rds/v1beta1/proxy.yaml similarity index 100% rename from examples-generated/rds/proxy.yaml rename to examples-generated/rds/v1beta1/proxy.yaml diff --git a/examples-generated/rds/proxydefaulttargetgroup.yaml b/examples-generated/rds/v1beta1/proxydefaulttargetgroup.yaml similarity index 100% rename from examples-generated/rds/proxydefaulttargetgroup.yaml rename to examples-generated/rds/v1beta1/proxydefaulttargetgroup.yaml diff --git a/examples-generated/rds/proxyendpoint.yaml b/examples-generated/rds/v1beta1/proxyendpoint.yaml similarity index 100% rename from examples-generated/rds/proxyendpoint.yaml rename to examples-generated/rds/v1beta1/proxyendpoint.yaml diff --git a/examples-generated/rds/proxytarget.yaml b/examples-generated/rds/v1beta1/proxytarget.yaml similarity index 100% rename from examples-generated/rds/proxytarget.yaml rename to examples-generated/rds/v1beta1/proxytarget.yaml diff --git a/examples-generated/rds/snapshot.yaml b/examples-generated/rds/v1beta1/snapshot.yaml similarity index 100% rename from examples-generated/rds/snapshot.yaml rename to examples-generated/rds/v1beta1/snapshot.yaml diff --git a/examples-generated/rds/subnetgroup.yaml b/examples-generated/rds/v1beta1/subnetgroup.yaml similarity index 100% rename from examples-generated/rds/subnetgroup.yaml rename to examples-generated/rds/v1beta1/subnetgroup.yaml diff --git a/examples-generated/redshift/authenticationprofile.yaml b/examples-generated/redshift/v1beta1/authenticationprofile.yaml similarity index 100% rename from examples-generated/redshift/authenticationprofile.yaml rename to examples-generated/redshift/v1beta1/authenticationprofile.yaml diff --git a/examples-generated/redshift/cluster.yaml b/examples-generated/redshift/v1beta1/cluster.yaml similarity index 100% rename from examples-generated/redshift/cluster.yaml rename to examples-generated/redshift/v1beta1/cluster.yaml diff --git a/examples-generated/redshift/eventsubscription.yaml b/examples-generated/redshift/v1beta1/eventsubscription.yaml similarity index 100% rename from examples-generated/redshift/eventsubscription.yaml rename to examples-generated/redshift/v1beta1/eventsubscription.yaml diff --git a/examples-generated/redshift/hsmclientcertificate.yaml b/examples-generated/redshift/v1beta1/hsmclientcertificate.yaml similarity index 100% rename from examples-generated/redshift/hsmclientcertificate.yaml rename to examples-generated/redshift/v1beta1/hsmclientcertificate.yaml diff --git a/examples-generated/redshift/hsmconfiguration.yaml b/examples-generated/redshift/v1beta1/hsmconfiguration.yaml similarity index 100% rename from examples-generated/redshift/hsmconfiguration.yaml rename to examples-generated/redshift/v1beta1/hsmconfiguration.yaml diff --git a/examples-generated/redshift/parametergroup.yaml b/examples-generated/redshift/v1beta1/parametergroup.yaml similarity index 100% rename from examples-generated/redshift/parametergroup.yaml rename to examples-generated/redshift/v1beta1/parametergroup.yaml diff --git a/examples-generated/redshift/scheduledaction.yaml b/examples-generated/redshift/v1beta1/scheduledaction.yaml similarity index 100% rename from examples-generated/redshift/scheduledaction.yaml rename to examples-generated/redshift/v1beta1/scheduledaction.yaml diff --git a/examples-generated/redshift/snapshotcopygrant.yaml b/examples-generated/redshift/v1beta1/snapshotcopygrant.yaml similarity index 100% rename from examples-generated/redshift/snapshotcopygrant.yaml rename to examples-generated/redshift/v1beta1/snapshotcopygrant.yaml diff --git a/examples-generated/redshift/snapshotschedule.yaml b/examples-generated/redshift/v1beta1/snapshotschedule.yaml similarity index 100% rename from examples-generated/redshift/snapshotschedule.yaml rename to examples-generated/redshift/v1beta1/snapshotschedule.yaml diff --git a/examples-generated/redshift/snapshotscheduleassociation.yaml b/examples-generated/redshift/v1beta1/snapshotscheduleassociation.yaml similarity index 100% rename from examples-generated/redshift/snapshotscheduleassociation.yaml rename to examples-generated/redshift/v1beta1/snapshotscheduleassociation.yaml diff --git a/examples-generated/redshift/subnetgroup.yaml b/examples-generated/redshift/v1beta1/subnetgroup.yaml similarity index 100% rename from examples-generated/redshift/subnetgroup.yaml rename to examples-generated/redshift/v1beta1/subnetgroup.yaml diff --git a/examples-generated/redshift/usagelimit.yaml b/examples-generated/redshift/v1beta1/usagelimit.yaml similarity index 100% rename from examples-generated/redshift/usagelimit.yaml rename to examples-generated/redshift/v1beta1/usagelimit.yaml diff --git a/examples-generated/redshiftserverless/endpointaccess.yaml b/examples-generated/redshiftserverless/v1beta1/endpointaccess.yaml similarity index 100% rename from examples-generated/redshiftserverless/endpointaccess.yaml rename to examples-generated/redshiftserverless/v1beta1/endpointaccess.yaml diff --git a/examples-generated/redshiftserverless/redshiftserverlessnamespace.yaml b/examples-generated/redshiftserverless/v1beta1/redshiftserverlessnamespace.yaml similarity index 100% rename from examples-generated/redshiftserverless/redshiftserverlessnamespace.yaml rename to examples-generated/redshiftserverless/v1beta1/redshiftserverlessnamespace.yaml diff --git a/examples-generated/redshiftserverless/resourcepolicy.yaml b/examples-generated/redshiftserverless/v1beta1/resourcepolicy.yaml similarity index 100% rename from examples-generated/redshiftserverless/resourcepolicy.yaml rename to examples-generated/redshiftserverless/v1beta1/resourcepolicy.yaml diff --git a/examples-generated/redshiftserverless/snapshot.yaml b/examples-generated/redshiftserverless/v1beta1/snapshot.yaml similarity index 100% rename from examples-generated/redshiftserverless/snapshot.yaml rename to examples-generated/redshiftserverless/v1beta1/snapshot.yaml diff --git a/examples-generated/redshiftserverless/usagelimit.yaml b/examples-generated/redshiftserverless/v1beta1/usagelimit.yaml similarity index 100% rename from examples-generated/redshiftserverless/usagelimit.yaml rename to examples-generated/redshiftserverless/v1beta1/usagelimit.yaml diff --git a/examples-generated/redshiftserverless/workgroup.yaml b/examples-generated/redshiftserverless/v1beta1/workgroup.yaml similarity index 100% rename from examples-generated/redshiftserverless/workgroup.yaml rename to examples-generated/redshiftserverless/v1beta1/workgroup.yaml diff --git a/examples-generated/resourcegroups/group.yaml b/examples-generated/resourcegroups/v1beta1/group.yaml similarity index 100% rename from examples-generated/resourcegroups/group.yaml rename to examples-generated/resourcegroups/v1beta1/group.yaml diff --git a/examples-generated/rolesanywhere/profile.yaml b/examples-generated/rolesanywhere/v1beta1/profile.yaml similarity index 100% rename from examples-generated/rolesanywhere/profile.yaml rename to examples-generated/rolesanywhere/v1beta1/profile.yaml diff --git a/examples-generated/route53/delegationset.yaml b/examples-generated/route53/v1beta1/delegationset.yaml similarity index 100% rename from examples-generated/route53/delegationset.yaml rename to examples-generated/route53/v1beta1/delegationset.yaml diff --git a/examples-generated/route53/healthcheck.yaml b/examples-generated/route53/v1beta1/healthcheck.yaml similarity index 100% rename from examples-generated/route53/healthcheck.yaml rename to examples-generated/route53/v1beta1/healthcheck.yaml diff --git a/examples-generated/route53/hostedzonednssec.yaml b/examples-generated/route53/v1beta1/hostedzonednssec.yaml similarity index 100% rename from examples-generated/route53/hostedzonednssec.yaml rename to examples-generated/route53/v1beta1/hostedzonednssec.yaml diff --git a/examples-generated/route53/record.yaml b/examples-generated/route53/v1beta1/record.yaml similarity index 100% rename from examples-generated/route53/record.yaml rename to examples-generated/route53/v1beta1/record.yaml diff --git a/examples-generated/route53/resolverconfig.yaml b/examples-generated/route53/v1beta1/resolverconfig.yaml similarity index 100% rename from examples-generated/route53/resolverconfig.yaml rename to examples-generated/route53/v1beta1/resolverconfig.yaml diff --git a/examples-generated/route53/trafficpolicy.yaml b/examples-generated/route53/v1beta1/trafficpolicy.yaml similarity index 100% rename from examples-generated/route53/trafficpolicy.yaml rename to examples-generated/route53/v1beta1/trafficpolicy.yaml diff --git a/examples-generated/route53/trafficpolicyinstance.yaml b/examples-generated/route53/v1beta1/trafficpolicyinstance.yaml similarity index 100% rename from examples-generated/route53/trafficpolicyinstance.yaml rename to examples-generated/route53/v1beta1/trafficpolicyinstance.yaml diff --git a/examples-generated/route53/vpcassociationauthorization.yaml b/examples-generated/route53/v1beta1/vpcassociationauthorization.yaml similarity index 100% rename from examples-generated/route53/vpcassociationauthorization.yaml rename to examples-generated/route53/v1beta1/vpcassociationauthorization.yaml diff --git a/examples-generated/route53/zone.yaml b/examples-generated/route53/v1beta1/zone.yaml similarity index 100% rename from examples-generated/route53/zone.yaml rename to examples-generated/route53/v1beta1/zone.yaml diff --git a/examples-generated/route53/zoneassociation.yaml b/examples-generated/route53/v1beta1/zoneassociation.yaml similarity index 100% rename from examples-generated/route53/zoneassociation.yaml rename to examples-generated/route53/v1beta1/zoneassociation.yaml diff --git a/examples-generated/route53recoverycontrolconfig/cluster.yaml b/examples-generated/route53recoverycontrolconfig/v1beta1/cluster.yaml similarity index 100% rename from examples-generated/route53recoverycontrolconfig/cluster.yaml rename to examples-generated/route53recoverycontrolconfig/v1beta1/cluster.yaml diff --git a/examples-generated/route53recoverycontrolconfig/controlpanel.yaml b/examples-generated/route53recoverycontrolconfig/v1beta1/controlpanel.yaml similarity index 100% rename from examples-generated/route53recoverycontrolconfig/controlpanel.yaml rename to examples-generated/route53recoverycontrolconfig/v1beta1/controlpanel.yaml diff --git a/examples-generated/route53recoverycontrolconfig/routingcontrol.yaml b/examples-generated/route53recoverycontrolconfig/v1beta1/routingcontrol.yaml similarity index 100% rename from examples-generated/route53recoverycontrolconfig/routingcontrol.yaml rename to examples-generated/route53recoverycontrolconfig/v1beta1/routingcontrol.yaml diff --git a/examples-generated/route53recoverycontrolconfig/safetyrule.yaml b/examples-generated/route53recoverycontrolconfig/v1beta1/safetyrule.yaml similarity index 100% rename from examples-generated/route53recoverycontrolconfig/safetyrule.yaml rename to examples-generated/route53recoverycontrolconfig/v1beta1/safetyrule.yaml diff --git a/examples-generated/route53recoveryreadiness/cell.yaml b/examples-generated/route53recoveryreadiness/v1beta1/cell.yaml similarity index 100% rename from examples-generated/route53recoveryreadiness/cell.yaml rename to examples-generated/route53recoveryreadiness/v1beta1/cell.yaml diff --git a/examples-generated/route53recoveryreadiness/readinesscheck.yaml b/examples-generated/route53recoveryreadiness/v1beta1/readinesscheck.yaml similarity index 100% rename from examples-generated/route53recoveryreadiness/readinesscheck.yaml rename to examples-generated/route53recoveryreadiness/v1beta1/readinesscheck.yaml diff --git a/examples-generated/route53recoveryreadiness/recoverygroup.yaml b/examples-generated/route53recoveryreadiness/v1beta1/recoverygroup.yaml similarity index 100% rename from examples-generated/route53recoveryreadiness/recoverygroup.yaml rename to examples-generated/route53recoveryreadiness/v1beta1/recoverygroup.yaml diff --git a/examples-generated/route53recoveryreadiness/resourceset.yaml b/examples-generated/route53recoveryreadiness/v1beta1/resourceset.yaml similarity index 100% rename from examples-generated/route53recoveryreadiness/resourceset.yaml rename to examples-generated/route53recoveryreadiness/v1beta1/resourceset.yaml diff --git a/examples-generated/route53resolver/endpoint.yaml b/examples-generated/route53resolver/v1beta1/endpoint.yaml similarity index 100% rename from examples-generated/route53resolver/endpoint.yaml rename to examples-generated/route53resolver/v1beta1/endpoint.yaml diff --git a/examples-generated/route53resolver/rule.yaml b/examples-generated/route53resolver/v1beta1/rule.yaml similarity index 100% rename from examples-generated/route53resolver/rule.yaml rename to examples-generated/route53resolver/v1beta1/rule.yaml diff --git a/examples-generated/route53resolver/ruleassociation.yaml b/examples-generated/route53resolver/v1beta1/ruleassociation.yaml similarity index 100% rename from examples-generated/route53resolver/ruleassociation.yaml rename to examples-generated/route53resolver/v1beta1/ruleassociation.yaml diff --git a/examples-generated/rum/appmonitor.yaml b/examples-generated/rum/v1beta1/appmonitor.yaml similarity index 100% rename from examples-generated/rum/appmonitor.yaml rename to examples-generated/rum/v1beta1/appmonitor.yaml diff --git a/examples-generated/rum/metricsdestination.yaml b/examples-generated/rum/v1beta1/metricsdestination.yaml similarity index 100% rename from examples-generated/rum/metricsdestination.yaml rename to examples-generated/rum/v1beta1/metricsdestination.yaml diff --git a/examples-generated/s3/bucket.yaml b/examples-generated/s3/v1beta1/bucket.yaml similarity index 100% rename from examples-generated/s3/bucket.yaml rename to examples-generated/s3/v1beta1/bucket.yaml diff --git a/examples-generated/s3/bucketaccelerateconfiguration.yaml b/examples-generated/s3/v1beta1/bucketaccelerateconfiguration.yaml similarity index 100% rename from examples-generated/s3/bucketaccelerateconfiguration.yaml rename to examples-generated/s3/v1beta1/bucketaccelerateconfiguration.yaml diff --git a/examples-generated/s3/bucketacl.yaml b/examples-generated/s3/v1beta1/bucketacl.yaml similarity index 100% rename from examples-generated/s3/bucketacl.yaml rename to examples-generated/s3/v1beta1/bucketacl.yaml diff --git a/examples-generated/s3/bucketanalyticsconfiguration.yaml b/examples-generated/s3/v1beta1/bucketanalyticsconfiguration.yaml similarity index 100% rename from examples-generated/s3/bucketanalyticsconfiguration.yaml rename to examples-generated/s3/v1beta1/bucketanalyticsconfiguration.yaml diff --git a/examples-generated/s3/bucketcorsconfiguration.yaml b/examples-generated/s3/v1beta1/bucketcorsconfiguration.yaml similarity index 100% rename from examples-generated/s3/bucketcorsconfiguration.yaml rename to examples-generated/s3/v1beta1/bucketcorsconfiguration.yaml diff --git a/examples-generated/s3/bucketintelligenttieringconfiguration.yaml b/examples-generated/s3/v1beta1/bucketintelligenttieringconfiguration.yaml similarity index 100% rename from examples-generated/s3/bucketintelligenttieringconfiguration.yaml rename to examples-generated/s3/v1beta1/bucketintelligenttieringconfiguration.yaml diff --git a/examples-generated/s3/bucketinventory.yaml b/examples-generated/s3/v1beta1/bucketinventory.yaml similarity index 100% rename from examples-generated/s3/bucketinventory.yaml rename to examples-generated/s3/v1beta1/bucketinventory.yaml diff --git a/examples-generated/s3/bucketlifecycleconfiguration.yaml b/examples-generated/s3/v1beta1/bucketlifecycleconfiguration.yaml similarity index 100% rename from examples-generated/s3/bucketlifecycleconfiguration.yaml rename to examples-generated/s3/v1beta1/bucketlifecycleconfiguration.yaml diff --git a/examples-generated/s3/bucketlogging.yaml b/examples-generated/s3/v1beta1/bucketlogging.yaml similarity index 100% rename from examples-generated/s3/bucketlogging.yaml rename to examples-generated/s3/v1beta1/bucketlogging.yaml diff --git a/examples-generated/s3/bucketmetric.yaml b/examples-generated/s3/v1beta1/bucketmetric.yaml similarity index 100% rename from examples-generated/s3/bucketmetric.yaml rename to examples-generated/s3/v1beta1/bucketmetric.yaml diff --git a/examples-generated/s3/bucketnotification.yaml b/examples-generated/s3/v1beta1/bucketnotification.yaml similarity index 100% rename from examples-generated/s3/bucketnotification.yaml rename to examples-generated/s3/v1beta1/bucketnotification.yaml diff --git a/examples-generated/s3/bucketobject.yaml b/examples-generated/s3/v1beta1/bucketobject.yaml similarity index 100% rename from examples-generated/s3/bucketobject.yaml rename to examples-generated/s3/v1beta1/bucketobject.yaml diff --git a/examples-generated/s3/bucketobjectlockconfiguration.yaml b/examples-generated/s3/v1beta1/bucketobjectlockconfiguration.yaml similarity index 100% rename from examples-generated/s3/bucketobjectlockconfiguration.yaml rename to examples-generated/s3/v1beta1/bucketobjectlockconfiguration.yaml diff --git a/examples-generated/s3/bucketownershipcontrols.yaml b/examples-generated/s3/v1beta1/bucketownershipcontrols.yaml similarity index 100% rename from examples-generated/s3/bucketownershipcontrols.yaml rename to examples-generated/s3/v1beta1/bucketownershipcontrols.yaml diff --git a/examples-generated/s3/bucketpolicy.yaml b/examples-generated/s3/v1beta1/bucketpolicy.yaml similarity index 100% rename from examples-generated/s3/bucketpolicy.yaml rename to examples-generated/s3/v1beta1/bucketpolicy.yaml diff --git a/examples-generated/s3/bucketpublicaccessblock.yaml b/examples-generated/s3/v1beta1/bucketpublicaccessblock.yaml similarity index 100% rename from examples-generated/s3/bucketpublicaccessblock.yaml rename to examples-generated/s3/v1beta1/bucketpublicaccessblock.yaml diff --git a/examples-generated/s3/bucketreplicationconfiguration.yaml b/examples-generated/s3/v1beta1/bucketreplicationconfiguration.yaml similarity index 100% rename from examples-generated/s3/bucketreplicationconfiguration.yaml rename to examples-generated/s3/v1beta1/bucketreplicationconfiguration.yaml diff --git a/examples-generated/s3/bucketrequestpaymentconfiguration.yaml b/examples-generated/s3/v1beta1/bucketrequestpaymentconfiguration.yaml similarity index 100% rename from examples-generated/s3/bucketrequestpaymentconfiguration.yaml rename to examples-generated/s3/v1beta1/bucketrequestpaymentconfiguration.yaml diff --git a/examples-generated/s3/bucketserversideencryptionconfiguration.yaml b/examples-generated/s3/v1beta1/bucketserversideencryptionconfiguration.yaml similarity index 100% rename from examples-generated/s3/bucketserversideencryptionconfiguration.yaml rename to examples-generated/s3/v1beta1/bucketserversideencryptionconfiguration.yaml diff --git a/examples-generated/s3/bucketversioning.yaml b/examples-generated/s3/v1beta1/bucketversioning.yaml similarity index 100% rename from examples-generated/s3/bucketversioning.yaml rename to examples-generated/s3/v1beta1/bucketversioning.yaml diff --git a/examples-generated/s3/bucketwebsiteconfiguration.yaml b/examples-generated/s3/v1beta1/bucketwebsiteconfiguration.yaml similarity index 100% rename from examples-generated/s3/bucketwebsiteconfiguration.yaml rename to examples-generated/s3/v1beta1/bucketwebsiteconfiguration.yaml diff --git a/examples-generated/s3/object.yaml b/examples-generated/s3/v1beta1/object.yaml similarity index 100% rename from examples-generated/s3/object.yaml rename to examples-generated/s3/v1beta1/object.yaml diff --git a/examples-generated/s3/objectcopy.yaml b/examples-generated/s3/v1beta1/objectcopy.yaml similarity index 100% rename from examples-generated/s3/objectcopy.yaml rename to examples-generated/s3/v1beta1/objectcopy.yaml diff --git a/examples-generated/s3control/accesspoint.yaml b/examples-generated/s3control/v1beta1/accesspoint.yaml similarity index 100% rename from examples-generated/s3control/accesspoint.yaml rename to examples-generated/s3control/v1beta1/accesspoint.yaml diff --git a/examples-generated/s3control/accesspointpolicy.yaml b/examples-generated/s3control/v1beta1/accesspointpolicy.yaml similarity index 100% rename from examples-generated/s3control/accesspointpolicy.yaml rename to examples-generated/s3control/v1beta1/accesspointpolicy.yaml diff --git a/examples-generated/s3control/accountpublicaccessblock.yaml b/examples-generated/s3control/v1beta1/accountpublicaccessblock.yaml similarity index 100% rename from examples-generated/s3control/accountpublicaccessblock.yaml rename to examples-generated/s3control/v1beta1/accountpublicaccessblock.yaml diff --git a/examples-generated/s3control/multiregionaccesspoint.yaml b/examples-generated/s3control/v1beta1/multiregionaccesspoint.yaml similarity index 100% rename from examples-generated/s3control/multiregionaccesspoint.yaml rename to examples-generated/s3control/v1beta1/multiregionaccesspoint.yaml diff --git a/examples-generated/s3control/multiregionaccesspointpolicy.yaml b/examples-generated/s3control/v1beta1/multiregionaccesspointpolicy.yaml similarity index 100% rename from examples-generated/s3control/multiregionaccesspointpolicy.yaml rename to examples-generated/s3control/v1beta1/multiregionaccesspointpolicy.yaml diff --git a/examples-generated/s3control/objectlambdaaccesspoint.yaml b/examples-generated/s3control/v1beta1/objectlambdaaccesspoint.yaml similarity index 100% rename from examples-generated/s3control/objectlambdaaccesspoint.yaml rename to examples-generated/s3control/v1beta1/objectlambdaaccesspoint.yaml diff --git a/examples-generated/s3control/objectlambdaaccesspointpolicy.yaml b/examples-generated/s3control/v1beta1/objectlambdaaccesspointpolicy.yaml similarity index 100% rename from examples-generated/s3control/objectlambdaaccesspointpolicy.yaml rename to examples-generated/s3control/v1beta1/objectlambdaaccesspointpolicy.yaml diff --git a/examples-generated/s3control/storagelensconfiguration.yaml b/examples-generated/s3control/v1beta1/storagelensconfiguration.yaml similarity index 100% rename from examples-generated/s3control/storagelensconfiguration.yaml rename to examples-generated/s3control/v1beta1/storagelensconfiguration.yaml diff --git a/examples-generated/sagemaker/app.yaml b/examples-generated/sagemaker/v1beta1/app.yaml similarity index 100% rename from examples-generated/sagemaker/app.yaml rename to examples-generated/sagemaker/v1beta1/app.yaml diff --git a/examples-generated/sagemaker/appimageconfig.yaml b/examples-generated/sagemaker/v1beta1/appimageconfig.yaml similarity index 100% rename from examples-generated/sagemaker/appimageconfig.yaml rename to examples-generated/sagemaker/v1beta1/appimageconfig.yaml diff --git a/examples-generated/sagemaker/coderepository.yaml b/examples-generated/sagemaker/v1beta1/coderepository.yaml similarity index 100% rename from examples-generated/sagemaker/coderepository.yaml rename to examples-generated/sagemaker/v1beta1/coderepository.yaml diff --git a/examples-generated/sagemaker/device.yaml b/examples-generated/sagemaker/v1beta1/device.yaml similarity index 100% rename from examples-generated/sagemaker/device.yaml rename to examples-generated/sagemaker/v1beta1/device.yaml diff --git a/examples-generated/sagemaker/devicefleet.yaml b/examples-generated/sagemaker/v1beta1/devicefleet.yaml similarity index 100% rename from examples-generated/sagemaker/devicefleet.yaml rename to examples-generated/sagemaker/v1beta1/devicefleet.yaml diff --git a/examples-generated/sagemaker/domain.yaml b/examples-generated/sagemaker/v1beta1/domain.yaml similarity index 100% rename from examples-generated/sagemaker/domain.yaml rename to examples-generated/sagemaker/v1beta1/domain.yaml diff --git a/examples-generated/sagemaker/endpoint.yaml b/examples-generated/sagemaker/v1beta1/endpoint.yaml similarity index 100% rename from examples-generated/sagemaker/endpoint.yaml rename to examples-generated/sagemaker/v1beta1/endpoint.yaml diff --git a/examples-generated/sagemaker/endpointconfiguration.yaml b/examples-generated/sagemaker/v1beta1/endpointconfiguration.yaml similarity index 100% rename from examples-generated/sagemaker/endpointconfiguration.yaml rename to examples-generated/sagemaker/v1beta1/endpointconfiguration.yaml diff --git a/examples-generated/sagemaker/featuregroup.yaml b/examples-generated/sagemaker/v1beta1/featuregroup.yaml similarity index 100% rename from examples-generated/sagemaker/featuregroup.yaml rename to examples-generated/sagemaker/v1beta1/featuregroup.yaml diff --git a/examples-generated/sagemaker/image.yaml b/examples-generated/sagemaker/v1beta1/image.yaml similarity index 100% rename from examples-generated/sagemaker/image.yaml rename to examples-generated/sagemaker/v1beta1/image.yaml diff --git a/examples-generated/sagemaker/imageversion.yaml b/examples-generated/sagemaker/v1beta1/imageversion.yaml similarity index 100% rename from examples-generated/sagemaker/imageversion.yaml rename to examples-generated/sagemaker/v1beta1/imageversion.yaml diff --git a/examples-generated/sagemaker/model.yaml b/examples-generated/sagemaker/v1beta1/model.yaml similarity index 100% rename from examples-generated/sagemaker/model.yaml rename to examples-generated/sagemaker/v1beta1/model.yaml diff --git a/examples-generated/sagemaker/modelpackagegroup.yaml b/examples-generated/sagemaker/v1beta1/modelpackagegroup.yaml similarity index 100% rename from examples-generated/sagemaker/modelpackagegroup.yaml rename to examples-generated/sagemaker/v1beta1/modelpackagegroup.yaml diff --git a/examples-generated/sagemaker/modelpackagegrouppolicy.yaml b/examples-generated/sagemaker/v1beta1/modelpackagegrouppolicy.yaml similarity index 100% rename from examples-generated/sagemaker/modelpackagegrouppolicy.yaml rename to examples-generated/sagemaker/v1beta1/modelpackagegrouppolicy.yaml diff --git a/examples-generated/sagemaker/notebookinstance.yaml b/examples-generated/sagemaker/v1beta1/notebookinstance.yaml similarity index 100% rename from examples-generated/sagemaker/notebookinstance.yaml rename to examples-generated/sagemaker/v1beta1/notebookinstance.yaml diff --git a/examples-generated/sagemaker/notebookinstancelifecycleconfiguration.yaml b/examples-generated/sagemaker/v1beta1/notebookinstancelifecycleconfiguration.yaml similarity index 100% rename from examples-generated/sagemaker/notebookinstancelifecycleconfiguration.yaml rename to examples-generated/sagemaker/v1beta1/notebookinstancelifecycleconfiguration.yaml diff --git a/examples-generated/sagemaker/servicecatalogportfoliostatus.yaml b/examples-generated/sagemaker/v1beta1/servicecatalogportfoliostatus.yaml similarity index 100% rename from examples-generated/sagemaker/servicecatalogportfoliostatus.yaml rename to examples-generated/sagemaker/v1beta1/servicecatalogportfoliostatus.yaml diff --git a/examples-generated/sagemaker/space.yaml b/examples-generated/sagemaker/v1beta1/space.yaml similarity index 100% rename from examples-generated/sagemaker/space.yaml rename to examples-generated/sagemaker/v1beta1/space.yaml diff --git a/examples-generated/sagemaker/studiolifecycleconfig.yaml b/examples-generated/sagemaker/v1beta1/studiolifecycleconfig.yaml similarity index 100% rename from examples-generated/sagemaker/studiolifecycleconfig.yaml rename to examples-generated/sagemaker/v1beta1/studiolifecycleconfig.yaml diff --git a/examples-generated/sagemaker/userprofile.yaml b/examples-generated/sagemaker/v1beta1/userprofile.yaml similarity index 100% rename from examples-generated/sagemaker/userprofile.yaml rename to examples-generated/sagemaker/v1beta1/userprofile.yaml diff --git a/examples-generated/sagemaker/workforce.yaml b/examples-generated/sagemaker/v1beta1/workforce.yaml similarity index 100% rename from examples-generated/sagemaker/workforce.yaml rename to examples-generated/sagemaker/v1beta1/workforce.yaml diff --git a/examples-generated/sagemaker/workteam.yaml b/examples-generated/sagemaker/v1beta1/workteam.yaml similarity index 100% rename from examples-generated/sagemaker/workteam.yaml rename to examples-generated/sagemaker/v1beta1/workteam.yaml diff --git a/examples-generated/scheduler/schedule.yaml b/examples-generated/scheduler/v1beta1/schedule.yaml similarity index 100% rename from examples-generated/scheduler/schedule.yaml rename to examples-generated/scheduler/v1beta1/schedule.yaml diff --git a/examples-generated/scheduler/schedulegroup.yaml b/examples-generated/scheduler/v1beta1/schedulegroup.yaml similarity index 100% rename from examples-generated/scheduler/schedulegroup.yaml rename to examples-generated/scheduler/v1beta1/schedulegroup.yaml diff --git a/examples-generated/schemas/discoverer.yaml b/examples-generated/schemas/v1beta1/discoverer.yaml similarity index 100% rename from examples-generated/schemas/discoverer.yaml rename to examples-generated/schemas/v1beta1/discoverer.yaml diff --git a/examples-generated/schemas/registry.yaml b/examples-generated/schemas/v1beta1/registry.yaml similarity index 100% rename from examples-generated/schemas/registry.yaml rename to examples-generated/schemas/v1beta1/registry.yaml diff --git a/examples-generated/schemas/schema.yaml b/examples-generated/schemas/v1beta1/schema.yaml similarity index 100% rename from examples-generated/schemas/schema.yaml rename to examples-generated/schemas/v1beta1/schema.yaml diff --git a/examples-generated/secretsmanager/secret.yaml b/examples-generated/secretsmanager/v1beta1/secret.yaml similarity index 100% rename from examples-generated/secretsmanager/secret.yaml rename to examples-generated/secretsmanager/v1beta1/secret.yaml diff --git a/examples-generated/secretsmanager/secretpolicy.yaml b/examples-generated/secretsmanager/v1beta1/secretpolicy.yaml similarity index 100% rename from examples-generated/secretsmanager/secretpolicy.yaml rename to examples-generated/secretsmanager/v1beta1/secretpolicy.yaml diff --git a/examples-generated/secretsmanager/secretrotation.yaml b/examples-generated/secretsmanager/v1beta1/secretrotation.yaml similarity index 100% rename from examples-generated/secretsmanager/secretrotation.yaml rename to examples-generated/secretsmanager/v1beta1/secretrotation.yaml diff --git a/examples-generated/secretsmanager/secretversion.yaml b/examples-generated/secretsmanager/v1beta1/secretversion.yaml similarity index 100% rename from examples-generated/secretsmanager/secretversion.yaml rename to examples-generated/secretsmanager/v1beta1/secretversion.yaml diff --git a/examples-generated/securityhub/account.yaml b/examples-generated/securityhub/v1beta1/account.yaml similarity index 100% rename from examples-generated/securityhub/account.yaml rename to examples-generated/securityhub/v1beta1/account.yaml diff --git a/examples-generated/securityhub/actiontarget.yaml b/examples-generated/securityhub/v1beta1/actiontarget.yaml similarity index 100% rename from examples-generated/securityhub/actiontarget.yaml rename to examples-generated/securityhub/v1beta1/actiontarget.yaml diff --git a/examples-generated/securityhub/findingaggregator.yaml b/examples-generated/securityhub/v1beta1/findingaggregator.yaml similarity index 100% rename from examples-generated/securityhub/findingaggregator.yaml rename to examples-generated/securityhub/v1beta1/findingaggregator.yaml diff --git a/examples-generated/securityhub/insight.yaml b/examples-generated/securityhub/v1beta1/insight.yaml similarity index 100% rename from examples-generated/securityhub/insight.yaml rename to examples-generated/securityhub/v1beta1/insight.yaml diff --git a/examples-generated/securityhub/inviteaccepter.yaml b/examples-generated/securityhub/v1beta1/inviteaccepter.yaml similarity index 100% rename from examples-generated/securityhub/inviteaccepter.yaml rename to examples-generated/securityhub/v1beta1/inviteaccepter.yaml diff --git a/examples-generated/securityhub/member.yaml b/examples-generated/securityhub/v1beta1/member.yaml similarity index 100% rename from examples-generated/securityhub/member.yaml rename to examples-generated/securityhub/v1beta1/member.yaml diff --git a/examples-generated/securityhub/productsubscription.yaml b/examples-generated/securityhub/v1beta1/productsubscription.yaml similarity index 100% rename from examples-generated/securityhub/productsubscription.yaml rename to examples-generated/securityhub/v1beta1/productsubscription.yaml diff --git a/examples-generated/securityhub/standardssubscription.yaml b/examples-generated/securityhub/v1beta1/standardssubscription.yaml similarity index 100% rename from examples-generated/securityhub/standardssubscription.yaml rename to examples-generated/securityhub/v1beta1/standardssubscription.yaml diff --git a/examples-generated/serverlessrepo/cloudformationstack.yaml b/examples-generated/serverlessrepo/v1beta1/cloudformationstack.yaml similarity index 100% rename from examples-generated/serverlessrepo/cloudformationstack.yaml rename to examples-generated/serverlessrepo/v1beta1/cloudformationstack.yaml diff --git a/examples-generated/servicecatalog/budgetresourceassociation.yaml b/examples-generated/servicecatalog/v1beta1/budgetresourceassociation.yaml similarity index 100% rename from examples-generated/servicecatalog/budgetresourceassociation.yaml rename to examples-generated/servicecatalog/v1beta1/budgetresourceassociation.yaml diff --git a/examples-generated/servicecatalog/constraint.yaml b/examples-generated/servicecatalog/v1beta1/constraint.yaml similarity index 100% rename from examples-generated/servicecatalog/constraint.yaml rename to examples-generated/servicecatalog/v1beta1/constraint.yaml diff --git a/examples-generated/servicecatalog/portfolio.yaml b/examples-generated/servicecatalog/v1beta1/portfolio.yaml similarity index 100% rename from examples-generated/servicecatalog/portfolio.yaml rename to examples-generated/servicecatalog/v1beta1/portfolio.yaml diff --git a/examples-generated/servicecatalog/portfolioshare.yaml b/examples-generated/servicecatalog/v1beta1/portfolioshare.yaml similarity index 100% rename from examples-generated/servicecatalog/portfolioshare.yaml rename to examples-generated/servicecatalog/v1beta1/portfolioshare.yaml diff --git a/examples-generated/servicecatalog/principalportfolioassociation.yaml b/examples-generated/servicecatalog/v1beta1/principalportfolioassociation.yaml similarity index 100% rename from examples-generated/servicecatalog/principalportfolioassociation.yaml rename to examples-generated/servicecatalog/v1beta1/principalportfolioassociation.yaml diff --git a/examples-generated/servicecatalog/product.yaml b/examples-generated/servicecatalog/v1beta1/product.yaml similarity index 100% rename from examples-generated/servicecatalog/product.yaml rename to examples-generated/servicecatalog/v1beta1/product.yaml diff --git a/examples-generated/servicecatalog/productportfolioassociation.yaml b/examples-generated/servicecatalog/v1beta1/productportfolioassociation.yaml similarity index 100% rename from examples-generated/servicecatalog/productportfolioassociation.yaml rename to examples-generated/servicecatalog/v1beta1/productportfolioassociation.yaml diff --git a/examples-generated/servicecatalog/provisioningartifact.yaml b/examples-generated/servicecatalog/v1beta1/provisioningartifact.yaml similarity index 100% rename from examples-generated/servicecatalog/provisioningartifact.yaml rename to examples-generated/servicecatalog/v1beta1/provisioningartifact.yaml diff --git a/examples-generated/servicecatalog/serviceaction.yaml b/examples-generated/servicecatalog/v1beta1/serviceaction.yaml similarity index 100% rename from examples-generated/servicecatalog/serviceaction.yaml rename to examples-generated/servicecatalog/v1beta1/serviceaction.yaml diff --git a/examples-generated/servicecatalog/tagoption.yaml b/examples-generated/servicecatalog/v1beta1/tagoption.yaml similarity index 100% rename from examples-generated/servicecatalog/tagoption.yaml rename to examples-generated/servicecatalog/v1beta1/tagoption.yaml diff --git a/examples-generated/servicecatalog/tagoptionresourceassociation.yaml b/examples-generated/servicecatalog/v1beta1/tagoptionresourceassociation.yaml similarity index 100% rename from examples-generated/servicecatalog/tagoptionresourceassociation.yaml rename to examples-generated/servicecatalog/v1beta1/tagoptionresourceassociation.yaml diff --git a/examples-generated/servicediscovery/httpnamespace.yaml b/examples-generated/servicediscovery/v1beta1/httpnamespace.yaml similarity index 100% rename from examples-generated/servicediscovery/httpnamespace.yaml rename to examples-generated/servicediscovery/v1beta1/httpnamespace.yaml diff --git a/examples-generated/servicediscovery/privatednsnamespace.yaml b/examples-generated/servicediscovery/v1beta1/privatednsnamespace.yaml similarity index 100% rename from examples-generated/servicediscovery/privatednsnamespace.yaml rename to examples-generated/servicediscovery/v1beta1/privatednsnamespace.yaml diff --git a/examples-generated/servicediscovery/publicdnsnamespace.yaml b/examples-generated/servicediscovery/v1beta1/publicdnsnamespace.yaml similarity index 100% rename from examples-generated/servicediscovery/publicdnsnamespace.yaml rename to examples-generated/servicediscovery/v1beta1/publicdnsnamespace.yaml diff --git a/examples-generated/servicediscovery/service.yaml b/examples-generated/servicediscovery/v1beta1/service.yaml similarity index 100% rename from examples-generated/servicediscovery/service.yaml rename to examples-generated/servicediscovery/v1beta1/service.yaml diff --git a/examples-generated/servicequotas/servicequota.yaml b/examples-generated/servicequotas/v1beta1/servicequota.yaml similarity index 100% rename from examples-generated/servicequotas/servicequota.yaml rename to examples-generated/servicequotas/v1beta1/servicequota.yaml diff --git a/examples-generated/ses/activereceiptruleset.yaml b/examples-generated/ses/v1beta1/activereceiptruleset.yaml similarity index 100% rename from examples-generated/ses/activereceiptruleset.yaml rename to examples-generated/ses/v1beta1/activereceiptruleset.yaml diff --git a/examples-generated/ses/configurationset.yaml b/examples-generated/ses/v1beta1/configurationset.yaml similarity index 100% rename from examples-generated/ses/configurationset.yaml rename to examples-generated/ses/v1beta1/configurationset.yaml diff --git a/examples-generated/ses/domaindkim.yaml b/examples-generated/ses/v1beta1/domaindkim.yaml similarity index 100% rename from examples-generated/ses/domaindkim.yaml rename to examples-generated/ses/v1beta1/domaindkim.yaml diff --git a/examples-generated/ses/domainidentity.yaml b/examples-generated/ses/v1beta1/domainidentity.yaml similarity index 100% rename from examples-generated/ses/domainidentity.yaml rename to examples-generated/ses/v1beta1/domainidentity.yaml diff --git a/examples-generated/ses/domainmailfrom.yaml b/examples-generated/ses/v1beta1/domainmailfrom.yaml similarity index 100% rename from examples-generated/ses/domainmailfrom.yaml rename to examples-generated/ses/v1beta1/domainmailfrom.yaml diff --git a/examples-generated/ses/emailidentity.yaml b/examples-generated/ses/v1beta1/emailidentity.yaml similarity index 100% rename from examples-generated/ses/emailidentity.yaml rename to examples-generated/ses/v1beta1/emailidentity.yaml diff --git a/examples-generated/ses/eventdestination.yaml b/examples-generated/ses/v1beta1/eventdestination.yaml similarity index 100% rename from examples-generated/ses/eventdestination.yaml rename to examples-generated/ses/v1beta1/eventdestination.yaml diff --git a/examples-generated/ses/identitynotificationtopic.yaml b/examples-generated/ses/v1beta1/identitynotificationtopic.yaml similarity index 100% rename from examples-generated/ses/identitynotificationtopic.yaml rename to examples-generated/ses/v1beta1/identitynotificationtopic.yaml diff --git a/examples-generated/ses/identitypolicy.yaml b/examples-generated/ses/v1beta1/identitypolicy.yaml similarity index 100% rename from examples-generated/ses/identitypolicy.yaml rename to examples-generated/ses/v1beta1/identitypolicy.yaml diff --git a/examples-generated/ses/receiptfilter.yaml b/examples-generated/ses/v1beta1/receiptfilter.yaml similarity index 100% rename from examples-generated/ses/receiptfilter.yaml rename to examples-generated/ses/v1beta1/receiptfilter.yaml diff --git a/examples-generated/ses/receiptrule.yaml b/examples-generated/ses/v1beta1/receiptrule.yaml similarity index 100% rename from examples-generated/ses/receiptrule.yaml rename to examples-generated/ses/v1beta1/receiptrule.yaml diff --git a/examples-generated/ses/receiptruleset.yaml b/examples-generated/ses/v1beta1/receiptruleset.yaml similarity index 100% rename from examples-generated/ses/receiptruleset.yaml rename to examples-generated/ses/v1beta1/receiptruleset.yaml diff --git a/examples-generated/ses/template.yaml b/examples-generated/ses/v1beta1/template.yaml similarity index 100% rename from examples-generated/ses/template.yaml rename to examples-generated/ses/v1beta1/template.yaml diff --git a/examples-generated/sesv2/configurationset.yaml b/examples-generated/sesv2/v1beta1/configurationset.yaml similarity index 100% rename from examples-generated/sesv2/configurationset.yaml rename to examples-generated/sesv2/v1beta1/configurationset.yaml diff --git a/examples-generated/sesv2/configurationseteventdestination.yaml b/examples-generated/sesv2/v1beta1/configurationseteventdestination.yaml similarity index 100% rename from examples-generated/sesv2/configurationseteventdestination.yaml rename to examples-generated/sesv2/v1beta1/configurationseteventdestination.yaml diff --git a/examples-generated/sesv2/dedicatedippool.yaml b/examples-generated/sesv2/v1beta1/dedicatedippool.yaml similarity index 100% rename from examples-generated/sesv2/dedicatedippool.yaml rename to examples-generated/sesv2/v1beta1/dedicatedippool.yaml diff --git a/examples-generated/sesv2/emailidentity.yaml b/examples-generated/sesv2/v1beta1/emailidentity.yaml similarity index 100% rename from examples-generated/sesv2/emailidentity.yaml rename to examples-generated/sesv2/v1beta1/emailidentity.yaml diff --git a/examples-generated/sesv2/emailidentityfeedbackattributes.yaml b/examples-generated/sesv2/v1beta1/emailidentityfeedbackattributes.yaml similarity index 100% rename from examples-generated/sesv2/emailidentityfeedbackattributes.yaml rename to examples-generated/sesv2/v1beta1/emailidentityfeedbackattributes.yaml diff --git a/examples-generated/sesv2/emailidentitymailfromattributes.yaml b/examples-generated/sesv2/v1beta1/emailidentitymailfromattributes.yaml similarity index 100% rename from examples-generated/sesv2/emailidentitymailfromattributes.yaml rename to examples-generated/sesv2/v1beta1/emailidentitymailfromattributes.yaml diff --git a/examples-generated/sfn/activity.yaml b/examples-generated/sfn/v1beta1/activity.yaml similarity index 100% rename from examples-generated/sfn/activity.yaml rename to examples-generated/sfn/v1beta1/activity.yaml diff --git a/examples-generated/sfn/statemachine.yaml b/examples-generated/sfn/v1beta1/statemachine.yaml similarity index 100% rename from examples-generated/sfn/statemachine.yaml rename to examples-generated/sfn/v1beta1/statemachine.yaml diff --git a/examples-generated/signer/signingjob.yaml b/examples-generated/signer/v1beta1/signingjob.yaml similarity index 100% rename from examples-generated/signer/signingjob.yaml rename to examples-generated/signer/v1beta1/signingjob.yaml diff --git a/examples-generated/signer/signingprofile.yaml b/examples-generated/signer/v1beta1/signingprofile.yaml similarity index 100% rename from examples-generated/signer/signingprofile.yaml rename to examples-generated/signer/v1beta1/signingprofile.yaml diff --git a/examples-generated/signer/signingprofilepermission.yaml b/examples-generated/signer/v1beta1/signingprofilepermission.yaml similarity index 100% rename from examples-generated/signer/signingprofilepermission.yaml rename to examples-generated/signer/v1beta1/signingprofilepermission.yaml diff --git a/examples-generated/simpledb/domain.yaml b/examples-generated/simpledb/v1beta1/domain.yaml similarity index 100% rename from examples-generated/simpledb/domain.yaml rename to examples-generated/simpledb/v1beta1/domain.yaml diff --git a/examples-generated/sns/platformapplication.yaml b/examples-generated/sns/v1beta1/platformapplication.yaml similarity index 100% rename from examples-generated/sns/platformapplication.yaml rename to examples-generated/sns/v1beta1/platformapplication.yaml diff --git a/examples-generated/sns/smspreferences.yaml b/examples-generated/sns/v1beta1/smspreferences.yaml similarity index 100% rename from examples-generated/sns/smspreferences.yaml rename to examples-generated/sns/v1beta1/smspreferences.yaml diff --git a/examples-generated/sns/topic.yaml b/examples-generated/sns/v1beta1/topic.yaml similarity index 100% rename from examples-generated/sns/topic.yaml rename to examples-generated/sns/v1beta1/topic.yaml diff --git a/examples-generated/sns/topicpolicy.yaml b/examples-generated/sns/v1beta1/topicpolicy.yaml similarity index 100% rename from examples-generated/sns/topicpolicy.yaml rename to examples-generated/sns/v1beta1/topicpolicy.yaml diff --git a/examples-generated/sns/topicsubscription.yaml b/examples-generated/sns/v1beta1/topicsubscription.yaml similarity index 100% rename from examples-generated/sns/topicsubscription.yaml rename to examples-generated/sns/v1beta1/topicsubscription.yaml diff --git a/examples-generated/sqs/queue.yaml b/examples-generated/sqs/v1beta1/queue.yaml similarity index 100% rename from examples-generated/sqs/queue.yaml rename to examples-generated/sqs/v1beta1/queue.yaml diff --git a/examples-generated/sqs/queuepolicy.yaml b/examples-generated/sqs/v1beta1/queuepolicy.yaml similarity index 100% rename from examples-generated/sqs/queuepolicy.yaml rename to examples-generated/sqs/v1beta1/queuepolicy.yaml diff --git a/examples-generated/sqs/queueredriveallowpolicy.yaml b/examples-generated/sqs/v1beta1/queueredriveallowpolicy.yaml similarity index 100% rename from examples-generated/sqs/queueredriveallowpolicy.yaml rename to examples-generated/sqs/v1beta1/queueredriveallowpolicy.yaml diff --git a/examples-generated/sqs/queueredrivepolicy.yaml b/examples-generated/sqs/v1beta1/queueredrivepolicy.yaml similarity index 100% rename from examples-generated/sqs/queueredrivepolicy.yaml rename to examples-generated/sqs/v1beta1/queueredrivepolicy.yaml diff --git a/examples-generated/ssm/activation.yaml b/examples-generated/ssm/v1beta1/activation.yaml similarity index 100% rename from examples-generated/ssm/activation.yaml rename to examples-generated/ssm/v1beta1/activation.yaml diff --git a/examples-generated/ssm/association.yaml b/examples-generated/ssm/v1beta1/association.yaml similarity index 100% rename from examples-generated/ssm/association.yaml rename to examples-generated/ssm/v1beta1/association.yaml diff --git a/examples-generated/ssm/defaultpatchbaseline.yaml b/examples-generated/ssm/v1beta1/defaultpatchbaseline.yaml similarity index 100% rename from examples-generated/ssm/defaultpatchbaseline.yaml rename to examples-generated/ssm/v1beta1/defaultpatchbaseline.yaml diff --git a/examples-generated/ssm/document.yaml b/examples-generated/ssm/v1beta1/document.yaml similarity index 100% rename from examples-generated/ssm/document.yaml rename to examples-generated/ssm/v1beta1/document.yaml diff --git a/examples-generated/ssm/maintenancewindow.yaml b/examples-generated/ssm/v1beta1/maintenancewindow.yaml similarity index 100% rename from examples-generated/ssm/maintenancewindow.yaml rename to examples-generated/ssm/v1beta1/maintenancewindow.yaml diff --git a/examples-generated/ssm/maintenancewindowtarget.yaml b/examples-generated/ssm/v1beta1/maintenancewindowtarget.yaml similarity index 100% rename from examples-generated/ssm/maintenancewindowtarget.yaml rename to examples-generated/ssm/v1beta1/maintenancewindowtarget.yaml diff --git a/examples-generated/ssm/maintenancewindowtask.yaml b/examples-generated/ssm/v1beta1/maintenancewindowtask.yaml similarity index 100% rename from examples-generated/ssm/maintenancewindowtask.yaml rename to examples-generated/ssm/v1beta1/maintenancewindowtask.yaml diff --git a/examples-generated/ssm/parameter.yaml b/examples-generated/ssm/v1beta1/parameter.yaml similarity index 100% rename from examples-generated/ssm/parameter.yaml rename to examples-generated/ssm/v1beta1/parameter.yaml diff --git a/examples-generated/ssm/patchbaseline.yaml b/examples-generated/ssm/v1beta1/patchbaseline.yaml similarity index 100% rename from examples-generated/ssm/patchbaseline.yaml rename to examples-generated/ssm/v1beta1/patchbaseline.yaml diff --git a/examples-generated/ssm/patchgroup.yaml b/examples-generated/ssm/v1beta1/patchgroup.yaml similarity index 100% rename from examples-generated/ssm/patchgroup.yaml rename to examples-generated/ssm/v1beta1/patchgroup.yaml diff --git a/examples-generated/ssm/resourcedatasync.yaml b/examples-generated/ssm/v1beta1/resourcedatasync.yaml similarity index 100% rename from examples-generated/ssm/resourcedatasync.yaml rename to examples-generated/ssm/v1beta1/resourcedatasync.yaml diff --git a/examples-generated/ssm/servicesetting.yaml b/examples-generated/ssm/v1beta1/servicesetting.yaml similarity index 100% rename from examples-generated/ssm/servicesetting.yaml rename to examples-generated/ssm/v1beta1/servicesetting.yaml diff --git a/examples-generated/ssoadmin/accountassignment.yaml b/examples-generated/ssoadmin/v1beta1/accountassignment.yaml similarity index 100% rename from examples-generated/ssoadmin/accountassignment.yaml rename to examples-generated/ssoadmin/v1beta1/accountassignment.yaml diff --git a/examples-generated/ssoadmin/customermanagedpolicyattachment.yaml b/examples-generated/ssoadmin/v1beta1/customermanagedpolicyattachment.yaml similarity index 100% rename from examples-generated/ssoadmin/customermanagedpolicyattachment.yaml rename to examples-generated/ssoadmin/v1beta1/customermanagedpolicyattachment.yaml diff --git a/examples-generated/ssoadmin/instanceaccesscontrolattributes.yaml b/examples-generated/ssoadmin/v1beta1/instanceaccesscontrolattributes.yaml similarity index 100% rename from examples-generated/ssoadmin/instanceaccesscontrolattributes.yaml rename to examples-generated/ssoadmin/v1beta1/instanceaccesscontrolattributes.yaml diff --git a/examples-generated/ssoadmin/managedpolicyattachment.yaml b/examples-generated/ssoadmin/v1beta1/managedpolicyattachment.yaml similarity index 100% rename from examples-generated/ssoadmin/managedpolicyattachment.yaml rename to examples-generated/ssoadmin/v1beta1/managedpolicyattachment.yaml diff --git a/examples-generated/ssoadmin/permissionsboundaryattachment.yaml b/examples-generated/ssoadmin/v1beta1/permissionsboundaryattachment.yaml similarity index 100% rename from examples-generated/ssoadmin/permissionsboundaryattachment.yaml rename to examples-generated/ssoadmin/v1beta1/permissionsboundaryattachment.yaml diff --git a/examples-generated/ssoadmin/permissionset.yaml b/examples-generated/ssoadmin/v1beta1/permissionset.yaml similarity index 100% rename from examples-generated/ssoadmin/permissionset.yaml rename to examples-generated/ssoadmin/v1beta1/permissionset.yaml diff --git a/examples-generated/ssoadmin/permissionsetinlinepolicy.yaml b/examples-generated/ssoadmin/v1beta1/permissionsetinlinepolicy.yaml similarity index 100% rename from examples-generated/ssoadmin/permissionsetinlinepolicy.yaml rename to examples-generated/ssoadmin/v1beta1/permissionsetinlinepolicy.yaml diff --git a/examples-generated/swf/domain.yaml b/examples-generated/swf/v1beta1/domain.yaml similarity index 100% rename from examples-generated/swf/domain.yaml rename to examples-generated/swf/v1beta1/domain.yaml diff --git a/examples-generated/timestreamwrite/database.yaml b/examples-generated/timestreamwrite/v1beta1/database.yaml similarity index 100% rename from examples-generated/timestreamwrite/database.yaml rename to examples-generated/timestreamwrite/v1beta1/database.yaml diff --git a/examples-generated/timestreamwrite/table.yaml b/examples-generated/timestreamwrite/v1beta1/table.yaml similarity index 100% rename from examples-generated/timestreamwrite/table.yaml rename to examples-generated/timestreamwrite/v1beta1/table.yaml diff --git a/examples-generated/transcribe/languagemodel.yaml b/examples-generated/transcribe/v1beta1/languagemodel.yaml similarity index 100% rename from examples-generated/transcribe/languagemodel.yaml rename to examples-generated/transcribe/v1beta1/languagemodel.yaml diff --git a/examples-generated/transcribe/vocabulary.yaml b/examples-generated/transcribe/v1beta1/vocabulary.yaml similarity index 100% rename from examples-generated/transcribe/vocabulary.yaml rename to examples-generated/transcribe/v1beta1/vocabulary.yaml diff --git a/examples-generated/transcribe/vocabularyfilter.yaml b/examples-generated/transcribe/v1beta1/vocabularyfilter.yaml similarity index 100% rename from examples-generated/transcribe/vocabularyfilter.yaml rename to examples-generated/transcribe/v1beta1/vocabularyfilter.yaml diff --git a/examples-generated/transfer/server.yaml b/examples-generated/transfer/v1beta1/server.yaml similarity index 100% rename from examples-generated/transfer/server.yaml rename to examples-generated/transfer/v1beta1/server.yaml diff --git a/examples-generated/transfer/sshkey.yaml b/examples-generated/transfer/v1beta1/sshkey.yaml similarity index 100% rename from examples-generated/transfer/sshkey.yaml rename to examples-generated/transfer/v1beta1/sshkey.yaml diff --git a/examples-generated/transfer/tag.yaml b/examples-generated/transfer/v1beta1/tag.yaml similarity index 100% rename from examples-generated/transfer/tag.yaml rename to examples-generated/transfer/v1beta1/tag.yaml diff --git a/examples-generated/transfer/user.yaml b/examples-generated/transfer/v1beta1/user.yaml similarity index 100% rename from examples-generated/transfer/user.yaml rename to examples-generated/transfer/v1beta1/user.yaml diff --git a/examples-generated/transfer/workflow.yaml b/examples-generated/transfer/v1beta1/workflow.yaml similarity index 100% rename from examples-generated/transfer/workflow.yaml rename to examples-generated/transfer/v1beta1/workflow.yaml diff --git a/examples-generated/vpc/networkperformancemetricsubscription.yaml b/examples-generated/vpc/v1beta1/networkperformancemetricsubscription.yaml similarity index 100% rename from examples-generated/vpc/networkperformancemetricsubscription.yaml rename to examples-generated/vpc/v1beta1/networkperformancemetricsubscription.yaml diff --git a/examples-generated/waf/bytematchset.yaml b/examples-generated/waf/v1beta1/bytematchset.yaml similarity index 100% rename from examples-generated/waf/bytematchset.yaml rename to examples-generated/waf/v1beta1/bytematchset.yaml diff --git a/examples-generated/waf/geomatchset.yaml b/examples-generated/waf/v1beta1/geomatchset.yaml similarity index 100% rename from examples-generated/waf/geomatchset.yaml rename to examples-generated/waf/v1beta1/geomatchset.yaml diff --git a/examples-generated/waf/ipset.yaml b/examples-generated/waf/v1beta1/ipset.yaml similarity index 100% rename from examples-generated/waf/ipset.yaml rename to examples-generated/waf/v1beta1/ipset.yaml diff --git a/examples-generated/waf/ratebasedrule.yaml b/examples-generated/waf/v1beta1/ratebasedrule.yaml similarity index 100% rename from examples-generated/waf/ratebasedrule.yaml rename to examples-generated/waf/v1beta1/ratebasedrule.yaml diff --git a/examples-generated/waf/regexmatchset.yaml b/examples-generated/waf/v1beta1/regexmatchset.yaml similarity index 100% rename from examples-generated/waf/regexmatchset.yaml rename to examples-generated/waf/v1beta1/regexmatchset.yaml diff --git a/examples-generated/waf/regexpatternset.yaml b/examples-generated/waf/v1beta1/regexpatternset.yaml similarity index 100% rename from examples-generated/waf/regexpatternset.yaml rename to examples-generated/waf/v1beta1/regexpatternset.yaml diff --git a/examples-generated/waf/rule.yaml b/examples-generated/waf/v1beta1/rule.yaml similarity index 100% rename from examples-generated/waf/rule.yaml rename to examples-generated/waf/v1beta1/rule.yaml diff --git a/examples-generated/waf/sizeconstraintset.yaml b/examples-generated/waf/v1beta1/sizeconstraintset.yaml similarity index 100% rename from examples-generated/waf/sizeconstraintset.yaml rename to examples-generated/waf/v1beta1/sizeconstraintset.yaml diff --git a/examples-generated/waf/sqlinjectionmatchset.yaml b/examples-generated/waf/v1beta1/sqlinjectionmatchset.yaml similarity index 100% rename from examples-generated/waf/sqlinjectionmatchset.yaml rename to examples-generated/waf/v1beta1/sqlinjectionmatchset.yaml diff --git a/examples-generated/waf/webacl.yaml b/examples-generated/waf/v1beta1/webacl.yaml similarity index 100% rename from examples-generated/waf/webacl.yaml rename to examples-generated/waf/v1beta1/webacl.yaml diff --git a/examples-generated/waf/xssmatchset.yaml b/examples-generated/waf/v1beta1/xssmatchset.yaml similarity index 100% rename from examples-generated/waf/xssmatchset.yaml rename to examples-generated/waf/v1beta1/xssmatchset.yaml diff --git a/examples-generated/wafregional/bytematchset.yaml b/examples-generated/wafregional/v1beta1/bytematchset.yaml similarity index 100% rename from examples-generated/wafregional/bytematchset.yaml rename to examples-generated/wafregional/v1beta1/bytematchset.yaml diff --git a/examples-generated/wafregional/geomatchset.yaml b/examples-generated/wafregional/v1beta1/geomatchset.yaml similarity index 100% rename from examples-generated/wafregional/geomatchset.yaml rename to examples-generated/wafregional/v1beta1/geomatchset.yaml diff --git a/examples-generated/wafregional/ipset.yaml b/examples-generated/wafregional/v1beta1/ipset.yaml similarity index 100% rename from examples-generated/wafregional/ipset.yaml rename to examples-generated/wafregional/v1beta1/ipset.yaml diff --git a/examples-generated/wafregional/ratebasedrule.yaml b/examples-generated/wafregional/v1beta1/ratebasedrule.yaml similarity index 100% rename from examples-generated/wafregional/ratebasedrule.yaml rename to examples-generated/wafregional/v1beta1/ratebasedrule.yaml diff --git a/examples-generated/wafregional/regexmatchset.yaml b/examples-generated/wafregional/v1beta1/regexmatchset.yaml similarity index 100% rename from examples-generated/wafregional/regexmatchset.yaml rename to examples-generated/wafregional/v1beta1/regexmatchset.yaml diff --git a/examples-generated/wafregional/regexpatternset.yaml b/examples-generated/wafregional/v1beta1/regexpatternset.yaml similarity index 100% rename from examples-generated/wafregional/regexpatternset.yaml rename to examples-generated/wafregional/v1beta1/regexpatternset.yaml diff --git a/examples-generated/wafregional/rule.yaml b/examples-generated/wafregional/v1beta1/rule.yaml similarity index 100% rename from examples-generated/wafregional/rule.yaml rename to examples-generated/wafregional/v1beta1/rule.yaml diff --git a/examples-generated/wafregional/sizeconstraintset.yaml b/examples-generated/wafregional/v1beta1/sizeconstraintset.yaml similarity index 100% rename from examples-generated/wafregional/sizeconstraintset.yaml rename to examples-generated/wafregional/v1beta1/sizeconstraintset.yaml diff --git a/examples-generated/wafregional/sqlinjectionmatchset.yaml b/examples-generated/wafregional/v1beta1/sqlinjectionmatchset.yaml similarity index 100% rename from examples-generated/wafregional/sqlinjectionmatchset.yaml rename to examples-generated/wafregional/v1beta1/sqlinjectionmatchset.yaml diff --git a/examples-generated/wafregional/webacl.yaml b/examples-generated/wafregional/v1beta1/webacl.yaml similarity index 100% rename from examples-generated/wafregional/webacl.yaml rename to examples-generated/wafregional/v1beta1/webacl.yaml diff --git a/examples-generated/wafregional/xssmatchset.yaml b/examples-generated/wafregional/v1beta1/xssmatchset.yaml similarity index 100% rename from examples-generated/wafregional/xssmatchset.yaml rename to examples-generated/wafregional/v1beta1/xssmatchset.yaml diff --git a/examples-generated/wafv2/ipset.yaml b/examples-generated/wafv2/v1beta1/ipset.yaml similarity index 100% rename from examples-generated/wafv2/ipset.yaml rename to examples-generated/wafv2/v1beta1/ipset.yaml diff --git a/examples-generated/wafv2/regexpatternset.yaml b/examples-generated/wafv2/v1beta1/regexpatternset.yaml similarity index 100% rename from examples-generated/wafv2/regexpatternset.yaml rename to examples-generated/wafv2/v1beta1/regexpatternset.yaml diff --git a/examples-generated/workspaces/directory.yaml b/examples-generated/workspaces/v1beta1/directory.yaml similarity index 100% rename from examples-generated/workspaces/directory.yaml rename to examples-generated/workspaces/v1beta1/directory.yaml diff --git a/examples-generated/workspaces/ipgroup.yaml b/examples-generated/workspaces/v1beta1/ipgroup.yaml similarity index 100% rename from examples-generated/workspaces/ipgroup.yaml rename to examples-generated/workspaces/v1beta1/ipgroup.yaml diff --git a/examples-generated/xray/encryptionconfig.yaml b/examples-generated/xray/v1beta1/encryptionconfig.yaml similarity index 100% rename from examples-generated/xray/encryptionconfig.yaml rename to examples-generated/xray/v1beta1/encryptionconfig.yaml diff --git a/examples-generated/xray/group.yaml b/examples-generated/xray/v1beta1/group.yaml similarity index 100% rename from examples-generated/xray/group.yaml rename to examples-generated/xray/v1beta1/group.yaml diff --git a/examples-generated/xray/samplingrule.yaml b/examples-generated/xray/v1beta1/samplingrule.yaml similarity index 100% rename from examples-generated/xray/samplingrule.yaml rename to examples-generated/xray/v1beta1/samplingrule.yaml diff --git a/go.mod b/go.mod index 7a0a56b23f..0f597cda3a 100644 --- a/go.mod +++ b/go.mod @@ -15,8 +15,8 @@ require ( github.com/crossplane/upjet v1.1.0-rc.0.0.20231227120826-4cb45f9104ac github.com/go-ini/ini v1.46.0 github.com/google/go-cmp v0.6.0 - github.com/hashicorp/terraform-json v0.17.0 - github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 + github.com/hashicorp/terraform-json v0.17.1 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0 github.com/hashicorp/terraform-provider-aws v0.0.0-00010101000000-000000000000 github.com/pkg/errors v0.9.1 gopkg.in/alecthomas/kingpin.v2 v2.2.6 @@ -35,7 +35,7 @@ require ( github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect github.com/antchfx/htmlquery v1.2.4 // indirect github.com/antchfx/xpath v1.2.0 // indirect - github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/aws/aws-sdk-go v1.44.261 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3 // indirect @@ -120,20 +120,20 @@ require ( github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.4.10 // indirect + github.com/hashicorp/go-plugin v1.5.1 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/hc-install v0.5.0 // indirect - github.com/hashicorp/hcl/v2 v2.17.0 // indirect + github.com/hashicorp/hcl/v2 v2.19.1 // indirect github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.18.1 // indirect - github.com/hashicorp/terraform-plugin-framework v1.2.0 // indirect + github.com/hashicorp/terraform-plugin-framework v1.4.1 // indirect github.com/hashicorp/terraform-plugin-framework-timeouts v0.3.1 // indirect github.com/hashicorp/terraform-plugin-framework-validators v0.10.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.16.0 // indirect + github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect github.com/hashicorp/terraform-plugin-mux v0.10.0 // indirect - github.com/hashicorp/terraform-registry-address v0.2.1 // indirect + github.com/hashicorp/terraform-registry-address v0.2.2 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/iancoleman/strcase v0.2.0 // indirect @@ -176,7 +176,7 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/yuin/goldmark v1.4.13 // indirect - github.com/zclconf/go-cty v1.13.2 // indirect + github.com/zclconf/go-cty v1.14.1 // indirect github.com/zclconf/go-cty-yaml v1.0.3 // indirect go.opentelemetry.io/otel v1.20.0 // indirect go.opentelemetry.io/otel/trace v1.20.0 // indirect @@ -213,3 +213,13 @@ require ( replace golang.org/x/exp => golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 replace github.com/hashicorp/terraform-provider-aws => github.com/upbound/terraform-provider-aws v0.0.0-20231026091456-f2d38ee240d7 + +replace github.com/hashicorp/terraform-json => github.com/hashicorp/terraform-json v0.17.0 + +replace github.com/hashicorp/terraform-plugin-sdk/v2 => github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 + +replace github.com/hashicorp/terraform-plugin-go => github.com/hashicorp/terraform-plugin-go v0.16.0 + +replace github.com/hashicorp/terraform-plugin-framework => github.com/hashicorp/terraform-plugin-framework v1.2.0 + +replace github.com/crossplane/upjet => github.com/ulucinar/upbound-upjet v0.0.0-20240215153955-874266deb955 diff --git a/go.sum b/go.sum index 342b887b8e..f823261b5f 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,9 @@ github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwq github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= -github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aws/aws-sdk-go v1.44.261 h1:PcTMX/QVk+P3yh2n34UzuXDF5FS2z5Lse2bt+r3IpU4= @@ -162,6 +163,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8WK8raXaxBx6fRVTlJILwEwQGL1I/ByEI= github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/bufbuild/protocompile v0.6.1-0.20231108163138-146b831231f7 h1:1pUks8VaLdprN9wrxAgshb06b08IzdYp0B7JgoDeUfw= +github.com/bufbuild/protocompile v0.6.1-0.20231108163138-146b831231f7/go.mod h1:9N39DyRmxAF5+5AjqXQKV6hyWDI0EeoX4TRMix2ZnPE= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -174,8 +177,6 @@ github.com/crossplane/crossplane-runtime v1.15.0-rc.0.0.20231215091746-d23a82b3a github.com/crossplane/crossplane-runtime v1.15.0-rc.0.0.20231215091746-d23a82b3a2f5/go.mod h1:pgt7PaTvvOQz3jILyxbCaeleU9MrAqKaNoPJavhGBgM= github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79 h1:HigXs5tEQxWz0fcj8hzbU2UAZgEM7wPe0XRFOsrtF8Y= github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79/go.mod h1:+e4OaFlOcmr0JvINHl/yvEYBrZawzTgj6pQumOH1SS0= -github.com/crossplane/upjet v1.1.0-rc.0.0.20231227120826-4cb45f9104ac h1:T1MTxsPAE/Cs0/EAGjeC29H9O/rO81yol2/5qGsf888= -github.com/crossplane/upjet v1.1.0-rc.0.0.20231227120826-4cb45f9104ac/go.mod h1:t9etxIdYaxgyvFPBToikm5zBHi8RIpX8N4mTH77lQFM= github.com/dave/jennifer v1.4.1 h1:XyqG6cn5RQsTj3qlWQTKlRGAyrTcsk1kUmWdZBzRjDw= github.com/dave/jennifer v1.4.1/go.mod h1:7jEdnm+qBcxl8PC0zyp7vxcpSRnzXSt9r39tpTVGlwA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -286,8 +287,8 @@ github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.4.10 h1:xUbmA4jC6Dq163/fWcp8P3JuHilrHHMLNRxzGQJ9hNk= -github.com/hashicorp/go-plugin v1.4.10/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= +github.com/hashicorp/go-plugin v1.5.1 h1:oGm7cWBaYIp3lJpx1RUEfLWophprE2EV/KUeqBYo+6k= +github.com/hashicorp/go-plugin v1.5.1/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -296,8 +297,8 @@ github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09 github.com/hashicorp/hc-install v0.5.0 h1:D9bl4KayIYKEeJ4vUDe9L5huqxZXczKaykSRcmQ0xY0= github.com/hashicorp/hc-install v0.5.0/go.mod h1:JyzMfbzfSBSjoDCRPna1vi/24BEDxFaCPfdHtM5SCdo= github.com/hashicorp/hcl/v2 v2.9.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= -github.com/hashicorp/hcl/v2 v2.17.0 h1:z1XvSUyXd1HP10U4lrLg5e0JMVz6CPaJvAgxM0KNZVY= -github.com/hashicorp/hcl/v2 v2.17.0/go.mod h1:gJyW2PTShkJqQBKpAmPO3yxMxIuoXkOF2TpqXzrQyx4= +github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI= +github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/terraform-exec v0.18.1 h1:LAbfDvNQU1l0NOQlTuudjczVhHj061fNX5H8XZxHlH4= @@ -318,8 +319,8 @@ github.com/hashicorp/terraform-plugin-mux v0.10.0 h1:VejY1BffxGy2iYOaa8DDHavY4k9 github.com/hashicorp/terraform-plugin-mux v0.10.0/go.mod h1:9sdnpmY20xIsl4ItsfODZYE+MgpSy/osXpSf+RwaZCY= github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 h1:G9WAfb8LHeCxu7Ae8nc1agZlQOSCUWsb610iAogBhCs= github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1/go.mod h1:xcOSYlRVdPLmDUoqPhO9fiO/YCN/l6MGYeTzGt5jgkQ= -github.com/hashicorp/terraform-registry-address v0.2.1 h1:QuTf6oJ1+WSflJw6WYOHhLgwUiQ0FrROpHPYFtwTYWM= -github.com/hashicorp/terraform-registry-address v0.2.1/go.mod h1:BSE9fIFzp0qWsJUUyGquo4ldV9k2n+psif6NYkBRS3Y= +github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno= +github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= @@ -338,8 +339,8 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= -github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74= +github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -479,6 +480,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tmccombs/hcl2json v0.3.3 h1:+DLNYqpWE0CsOQiEZu+OZm5ZBImake3wtITYxQ8uLFQ= github.com/tmccombs/hcl2json v0.3.3/go.mod h1:Y2chtz2x9bAeRTvSibVRVgbLJhLJXKlUeIvjeVdnm4w= +github.com/ulucinar/upbound-upjet v0.0.0-20240215153955-874266deb955 h1:ugOLHhjVdEACnSS5zLAOMjkqgtDqLjfFCC1nXLs5NpY= +github.com/ulucinar/upbound-upjet v0.0.0-20240215153955-874266deb955/go.mod h1:0bHLtnejZ9bDeyXuBb9MSOQLvKo3+aoTeUBO8N0dGSA= github.com/upbound/terraform-provider-aws v0.0.0-20231026091456-f2d38ee240d7 h1:hOLIvZeun8SvbrjCg78hYGQIS7a/iwsIeJDXhKd2qmQ= github.com/upbound/terraform-provider-aws v0.0.0-20231026091456-f2d38ee240d7/go.mod h1:VC/cWYvL0CQ2QApMzLWtf5xkbEmaabKO0Hoi49B62AE= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -507,8 +510,8 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= github.com/zclconf/go-cty v1.8.1/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty v1.13.2 h1:4GvrUxe/QUDYuJKAav4EYqdM47/kZa672LwmXFmEKT0= -github.com/zclconf/go-cty v1.13.2/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= +github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA= +github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= github.com/zclconf/go-cty-yaml v1.0.3 h1:og/eOQ7lvA/WWhHGFETVWNduJM7Rjsv2RRpx1sdFMLc= github.com/zclconf/go-cty-yaml v1.0.3/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs= diff --git a/internal/controller/accessanalyzer/analyzer/zz_controller.go b/internal/controller/accessanalyzer/analyzer/zz_controller.go index b1751d4bc1..be84109b8f 100755 --- a/internal/controller/accessanalyzer/analyzer/zz_controller.go +++ b/internal/controller/accessanalyzer/analyzer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/accessanalyzer/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Analyzer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_accessanalyzer_analyzer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Analyzer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_accessanalyzer_analyzer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Analyzer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Analyzer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Analyzer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Analyzer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Analyzer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/accessanalyzer/archiverule/zz_controller.go b/internal/controller/accessanalyzer/archiverule/zz_controller.go index d477ae7af7..3d38b82607 100755 --- a/internal/controller/accessanalyzer/archiverule/zz_controller.go +++ b/internal/controller/accessanalyzer/archiverule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/accessanalyzer/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ArchiveRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_accessanalyzer_archive_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ArchiveRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_accessanalyzer_archive_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ArchiveRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ArchiveRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ArchiveRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ArchiveRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ArchiveRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/account/alternatecontact/zz_controller.go b/internal/controller/account/alternatecontact/zz_controller.go index d458227811..dd890ebf4a 100755 --- a/internal/controller/account/alternatecontact/zz_controller.go +++ b/internal/controller/account/alternatecontact/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/account/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AlternateContact_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_account_alternate_contact"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AlternateContact_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_account_alternate_contact"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AlternateContact_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AlternateContact + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AlternateContact{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AlternateContact") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AlternateContact_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/acm/certificate/zz_controller.go b/internal/controller/acm/certificate/zz_controller.go index 99fc83976b..0637cbcda9 100755 --- a/internal/controller/acm/certificate/zz_controller.go +++ b/internal/controller/acm/certificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/acm/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acm_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acm_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Certificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Certificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Certificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/acm/certificatevalidation/zz_controller.go b/internal/controller/acm/certificatevalidation/zz_controller.go index 42326e9f1e..c5bc7cecc5 100755 --- a/internal/controller/acm/certificatevalidation/zz_controller.go +++ b/internal/controller/acm/certificatevalidation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/acm/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateValidation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acm_certificate_validation"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CertificateValidation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acm_certificate_validation"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CertificateValidation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CertificateValidation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CertificateValidation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CertificateValidation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CertificateValidation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/acmpca/certificate/zz_controller.go b/internal/controller/acmpca/certificate/zz_controller.go index f9190702b3..a04f5348af 100755 --- a/internal/controller/acmpca/certificate/zz_controller.go +++ b/internal/controller/acmpca/certificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/acmpca/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acmpca_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acmpca_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Certificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Certificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Certificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/acmpca/certificateauthority/zz_controller.go b/internal/controller/acmpca/certificateauthority/zz_controller.go index 050d54c877..a0706b68a1 100755 --- a/internal/controller/acmpca/certificateauthority/zz_controller.go +++ b/internal/controller/acmpca/certificateauthority/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/acmpca/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateAuthority_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acmpca_certificate_authority"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CertificateAuthority_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acmpca_certificate_authority"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CertificateAuthority_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CertificateAuthority + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CertificateAuthority{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CertificateAuthority") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CertificateAuthority_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/acmpca/certificateauthoritycertificate/zz_controller.go b/internal/controller/acmpca/certificateauthoritycertificate/zz_controller.go index 23b961c300..c2dd110054 100755 --- a/internal/controller/acmpca/certificateauthoritycertificate/zz_controller.go +++ b/internal/controller/acmpca/certificateauthoritycertificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/acmpca/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateAuthorityCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acmpca_certificate_authority_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CertificateAuthorityCertificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acmpca_certificate_authority_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CertificateAuthorityCertificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CertificateAuthorityCertificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CertificateAuthorityCertificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CertificateAuthorityCertificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CertificateAuthorityCertificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/acmpca/permission/zz_controller.go b/internal/controller/acmpca/permission/zz_controller.go index e80f286efe..407556a7c3 100755 --- a/internal/controller/acmpca/permission/zz_controller.go +++ b/internal/controller/acmpca/permission/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/acmpca/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Permission_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acmpca_permission"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Permission_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acmpca_permission"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Permission_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Permission + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Permission{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Permission") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Permission_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/acmpca/policy/zz_controller.go b/internal/controller/acmpca/policy/zz_controller.go index 02a807cad7..4bdfa9ce6e 100755 --- a/internal/controller/acmpca/policy/zz_controller.go +++ b/internal/controller/acmpca/policy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/acmpca/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acmpca_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_acmpca_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Policy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Policy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Policy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/amp/alertmanagerdefinition/zz_controller.go b/internal/controller/amp/alertmanagerdefinition/zz_controller.go index 4c6657e327..64204ddc79 100755 --- a/internal/controller/amp/alertmanagerdefinition/zz_controller.go +++ b/internal/controller/amp/alertmanagerdefinition/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/amp/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AlertManagerDefinition_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_prometheus_alert_manager_definition"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AlertManagerDefinition_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_prometheus_alert_manager_definition"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AlertManagerDefinition_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AlertManagerDefinition + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AlertManagerDefinition{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AlertManagerDefinition") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AlertManagerDefinition_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/amp/rulegroupnamespace/zz_controller.go b/internal/controller/amp/rulegroupnamespace/zz_controller.go index eec25c2630..23893825c3 100755 --- a/internal/controller/amp/rulegroupnamespace/zz_controller.go +++ b/internal/controller/amp/rulegroupnamespace/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/amp/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RuleGroupNamespace_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_prometheus_rule_group_namespace"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RuleGroupNamespace_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_prometheus_rule_group_namespace"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RuleGroupNamespace_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RuleGroupNamespace + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RuleGroupNamespace{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RuleGroupNamespace") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RuleGroupNamespace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/amp/workspace/zz_controller.go b/internal/controller/amp/workspace/zz_controller.go index a9dd79ee0c..79e1d28590 100755 --- a/internal/controller/amp/workspace/zz_controller.go +++ b/internal/controller/amp/workspace/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/amp/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Workspace_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_prometheus_workspace"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workspace_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_prometheus_workspace"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workspace_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Workspace + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Workspace{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Workspace") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Workspace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/amplify/app/zz_controller.go b/internal/controller/amplify/app/zz_controller.go index 56c01adede..5d598ad652 100755 --- a/internal/controller/amplify/app/zz_controller.go +++ b/internal/controller/amplify/app/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/amplify/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.App_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_amplify_app"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.App_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_amplify_app"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.App_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.App + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.App{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.App") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.App_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/amplify/backendenvironment/zz_controller.go b/internal/controller/amplify/backendenvironment/zz_controller.go index 0ef334e1c7..c66e98fac3 100755 --- a/internal/controller/amplify/backendenvironment/zz_controller.go +++ b/internal/controller/amplify/backendenvironment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/amplify/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackendEnvironment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_amplify_backend_environment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BackendEnvironment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_amplify_backend_environment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BackendEnvironment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BackendEnvironment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BackendEnvironment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BackendEnvironment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BackendEnvironment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/amplify/branch/zz_controller.go b/internal/controller/amplify/branch/zz_controller.go index 45595c4b1a..b403e85747 100755 --- a/internal/controller/amplify/branch/zz_controller.go +++ b/internal/controller/amplify/branch/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/amplify/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Branch_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_amplify_branch"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Branch_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_amplify_branch"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Branch_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Branch + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Branch{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Branch") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Branch_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/amplify/webhook/zz_controller.go b/internal/controller/amplify/webhook/zz_controller.go index 354a83cae0..32264519ed 100755 --- a/internal/controller/amplify/webhook/zz_controller.go +++ b/internal/controller/amplify/webhook/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/amplify/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Webhook_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_amplify_webhook"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Webhook_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_amplify_webhook"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Webhook_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Webhook + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Webhook{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Webhook") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Webhook_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/account/zz_controller.go b/internal/controller/apigateway/account/zz_controller.go index 3afe683a9c..1bf331f601 100755 --- a/internal/controller/apigateway/account/zz_controller.go +++ b/internal/controller/apigateway/account/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Account_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_account"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Account_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_account"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Account_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Account + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Account{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Account") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/apikey/zz_controller.go b/internal/controller/apigateway/apikey/zz_controller.go index 4bdbe313e2..0318c5dd20 100755 --- a/internal/controller/apigateway/apikey/zz_controller.go +++ b/internal/controller/apigateway/apikey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.APIKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_api_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.APIKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_api_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.APIKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.APIKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.APIKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.APIKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APIKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/authorizer/zz_controller.go b/internal/controller/apigateway/authorizer/zz_controller.go index 8ab4f1ab51..6214e6f3c7 100755 --- a/internal/controller/apigateway/authorizer/zz_controller.go +++ b/internal/controller/apigateway/authorizer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Authorizer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_authorizer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Authorizer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_authorizer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Authorizer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Authorizer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Authorizer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Authorizer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Authorizer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/basepathmapping/zz_controller.go b/internal/controller/apigateway/basepathmapping/zz_controller.go index 71c4840296..0e5010b505 100755 --- a/internal/controller/apigateway/basepathmapping/zz_controller.go +++ b/internal/controller/apigateway/basepathmapping/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BasePathMapping_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_base_path_mapping"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BasePathMapping_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_base_path_mapping"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BasePathMapping_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BasePathMapping + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BasePathMapping{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BasePathMapping") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BasePathMapping_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/clientcertificate/zz_controller.go b/internal/controller/apigateway/clientcertificate/zz_controller.go index 9e169f6b3d..7896facdd5 100755 --- a/internal/controller/apigateway/clientcertificate/zz_controller.go +++ b/internal/controller/apigateway/clientcertificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClientCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_client_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClientCertificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_client_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClientCertificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClientCertificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClientCertificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClientCertificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClientCertificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/deployment/zz_controller.go b/internal/controller/apigateway/deployment/zz_controller.go index c681a4f5e3..7d79926ec8 100755 --- a/internal/controller/apigateway/deployment/zz_controller.go +++ b/internal/controller/apigateway/deployment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Deployment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_deployment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Deployment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_deployment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Deployment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Deployment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Deployment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Deployment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Deployment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/documentationpart/zz_controller.go b/internal/controller/apigateway/documentationpart/zz_controller.go index 41ee1eadeb..6332cb561d 100755 --- a/internal/controller/apigateway/documentationpart/zz_controller.go +++ b/internal/controller/apigateway/documentationpart/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DocumentationPart_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_documentation_part"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DocumentationPart_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_documentation_part"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DocumentationPart_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DocumentationPart + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DocumentationPart{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DocumentationPart") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DocumentationPart_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/documentationversion/zz_controller.go b/internal/controller/apigateway/documentationversion/zz_controller.go index 0c01494959..e170a727a2 100755 --- a/internal/controller/apigateway/documentationversion/zz_controller.go +++ b/internal/controller/apigateway/documentationversion/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DocumentationVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_documentation_version"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DocumentationVersion_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_documentation_version"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DocumentationVersion_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DocumentationVersion + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DocumentationVersion{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DocumentationVersion") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DocumentationVersion_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/domainname/zz_controller.go b/internal/controller/apigateway/domainname/zz_controller.go index 75034f3b64..a221a4c996 100755 --- a/internal/controller/apigateway/domainname/zz_controller.go +++ b/internal/controller/apigateway/domainname/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainName_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_domain_name"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainName_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_domain_name"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainName_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DomainName + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DomainName{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DomainName") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainName_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/gatewayresponse/zz_controller.go b/internal/controller/apigateway/gatewayresponse/zz_controller.go index 22309a90fb..2f47852265 100755 --- a/internal/controller/apigateway/gatewayresponse/zz_controller.go +++ b/internal/controller/apigateway/gatewayresponse/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GatewayResponse_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_gateway_response"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GatewayResponse_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_gateway_response"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GatewayResponse_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GatewayResponse + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GatewayResponse{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GatewayResponse") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GatewayResponse_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/integration/zz_controller.go b/internal/controller/apigateway/integration/zz_controller.go index 4274daa5bd..e65fb816e3 100755 --- a/internal/controller/apigateway/integration/zz_controller.go +++ b/internal/controller/apigateway/integration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Integration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_integration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Integration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_integration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Integration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Integration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Integration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Integration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Integration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/integrationresponse/zz_controller.go b/internal/controller/apigateway/integrationresponse/zz_controller.go index b87b2966f8..bf4504d0a2 100755 --- a/internal/controller/apigateway/integrationresponse/zz_controller.go +++ b/internal/controller/apigateway/integrationresponse/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IntegrationResponse_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_integration_response"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IntegrationResponse_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_integration_response"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IntegrationResponse_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.IntegrationResponse + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.IntegrationResponse{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.IntegrationResponse") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IntegrationResponse_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/method/zz_controller.go b/internal/controller/apigateway/method/zz_controller.go index 231eee062e..b3d7c88e6d 100755 --- a/internal/controller/apigateway/method/zz_controller.go +++ b/internal/controller/apigateway/method/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Method_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_method"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Method_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_method"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Method_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Method + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Method{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Method") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Method_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/methodresponse/zz_controller.go b/internal/controller/apigateway/methodresponse/zz_controller.go index 171d3f092a..d0c3bb2052 100755 --- a/internal/controller/apigateway/methodresponse/zz_controller.go +++ b/internal/controller/apigateway/methodresponse/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MethodResponse_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_method_response"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MethodResponse_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_method_response"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MethodResponse_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MethodResponse + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MethodResponse{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MethodResponse") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MethodResponse_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/methodsettings/zz_controller.go b/internal/controller/apigateway/methodsettings/zz_controller.go index 957dc0abd6..1a5cdde3e7 100755 --- a/internal/controller/apigateway/methodsettings/zz_controller.go +++ b/internal/controller/apigateway/methodsettings/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MethodSettings_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_method_settings"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MethodSettings_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_method_settings"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MethodSettings_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MethodSettings + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MethodSettings{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MethodSettings") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MethodSettings_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/model/zz_controller.go b/internal/controller/apigateway/model/zz_controller.go index b07b79044d..dd302612f9 100755 --- a/internal/controller/apigateway/model/zz_controller.go +++ b/internal/controller/apigateway/model/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Model_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_model"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Model_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_model"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Model_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Model + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Model{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Model") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Model_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/requestvalidator/zz_controller.go b/internal/controller/apigateway/requestvalidator/zz_controller.go index 1f4c956483..d01c8fa5f2 100755 --- a/internal/controller/apigateway/requestvalidator/zz_controller.go +++ b/internal/controller/apigateway/requestvalidator/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RequestValidator_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_request_validator"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RequestValidator_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_request_validator"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RequestValidator_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RequestValidator + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RequestValidator{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RequestValidator") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RequestValidator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/resource/zz_controller.go b/internal/controller/apigateway/resource/zz_controller.go index c43312d954..d108d4e012 100755 --- a/internal/controller/apigateway/resource/zz_controller.go +++ b/internal/controller/apigateway/resource/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Resource_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_resource"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Resource_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_resource"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Resource_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Resource + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Resource{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Resource") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Resource_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/restapi/zz_controller.go b/internal/controller/apigateway/restapi/zz_controller.go index 31fdb09c9a..b207e5cf0b 100755 --- a/internal/controller/apigateway/restapi/zz_controller.go +++ b/internal/controller/apigateway/restapi/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RestAPI_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_rest_api"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RestAPI_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_rest_api"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RestAPI_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RestAPI + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RestAPI{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RestAPI") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RestAPI_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/restapipolicy/zz_controller.go b/internal/controller/apigateway/restapipolicy/zz_controller.go index d33191efca..9cc2614323 100755 --- a/internal/controller/apigateway/restapipolicy/zz_controller.go +++ b/internal/controller/apigateway/restapipolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RestAPIPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_rest_api_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RestAPIPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_rest_api_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RestAPIPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RestAPIPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RestAPIPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RestAPIPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RestAPIPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/stage/zz_controller.go b/internal/controller/apigateway/stage/zz_controller.go index 5a91290aea..c1717c9126 100755 --- a/internal/controller/apigateway/stage/zz_controller.go +++ b/internal/controller/apigateway/stage/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Stage_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_stage"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stage_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_stage"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stage_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Stage + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Stage{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Stage") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Stage_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/usageplan/zz_controller.go b/internal/controller/apigateway/usageplan/zz_controller.go index f8609e65f8..37c3ae18d7 100755 --- a/internal/controller/apigateway/usageplan/zz_controller.go +++ b/internal/controller/apigateway/usageplan/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UsagePlan_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_usage_plan"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UsagePlan_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_usage_plan"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UsagePlan_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UsagePlan + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UsagePlan{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UsagePlan") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UsagePlan_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/usageplankey/zz_controller.go b/internal/controller/apigateway/usageplankey/zz_controller.go index ab9d7ef0b4..fb6d2b0680 100755 --- a/internal/controller/apigateway/usageplankey/zz_controller.go +++ b/internal/controller/apigateway/usageplankey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UsagePlanKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_usage_plan_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UsagePlanKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_usage_plan_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UsagePlanKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UsagePlanKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UsagePlanKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UsagePlanKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UsagePlanKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigateway/vpclink/zz_controller.go b/internal/controller/apigateway/vpclink/zz_controller.go index 283ab316e5..d698a08a86 100755 --- a/internal/controller/apigateway/vpclink/zz_controller.go +++ b/internal/controller/apigateway/vpclink/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigateway/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCLink_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_vpc_link"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCLink_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_api_gateway_vpc_link"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCLink_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCLink + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCLink{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCLink") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCLink_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/api/zz_controller.go b/internal/controller/apigatewayv2/api/zz_controller.go index 2a5a2dbe71..9daf059dbb 100755 --- a/internal/controller/apigatewayv2/api/zz_controller.go +++ b/internal/controller/apigatewayv2/api/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.API_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_api"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.API_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_api"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.API_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.API + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.API{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.API") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.API_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/apimapping/zz_controller.go b/internal/controller/apigatewayv2/apimapping/zz_controller.go index 03cd9786cf..3eae410569 100755 --- a/internal/controller/apigatewayv2/apimapping/zz_controller.go +++ b/internal/controller/apigatewayv2/apimapping/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.APIMapping_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_api_mapping"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.APIMapping_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_api_mapping"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.APIMapping_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.APIMapping + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.APIMapping{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.APIMapping") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APIMapping_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/authorizer/zz_controller.go b/internal/controller/apigatewayv2/authorizer/zz_controller.go index 0692d174f3..625c6db50e 100755 --- a/internal/controller/apigatewayv2/authorizer/zz_controller.go +++ b/internal/controller/apigatewayv2/authorizer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Authorizer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_authorizer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Authorizer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_authorizer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Authorizer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Authorizer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Authorizer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Authorizer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Authorizer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/deployment/zz_controller.go b/internal/controller/apigatewayv2/deployment/zz_controller.go index 8b76b6f8b9..2b9d7ddcbc 100755 --- a/internal/controller/apigatewayv2/deployment/zz_controller.go +++ b/internal/controller/apigatewayv2/deployment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Deployment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_deployment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Deployment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_deployment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Deployment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Deployment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Deployment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Deployment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Deployment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/domainname/zz_controller.go b/internal/controller/apigatewayv2/domainname/zz_controller.go index 4f56eebb5f..ae97f6fd0c 100755 --- a/internal/controller/apigatewayv2/domainname/zz_controller.go +++ b/internal/controller/apigatewayv2/domainname/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainName_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_domain_name"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainName_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_domain_name"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainName_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DomainName + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DomainName{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DomainName") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainName_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/integration/zz_controller.go b/internal/controller/apigatewayv2/integration/zz_controller.go index 85f104f016..a8731e22ea 100755 --- a/internal/controller/apigatewayv2/integration/zz_controller.go +++ b/internal/controller/apigatewayv2/integration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Integration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_integration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Integration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_integration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Integration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Integration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Integration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Integration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Integration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/integrationresponse/zz_controller.go b/internal/controller/apigatewayv2/integrationresponse/zz_controller.go index d1575cf4c1..f085c41991 100755 --- a/internal/controller/apigatewayv2/integrationresponse/zz_controller.go +++ b/internal/controller/apigatewayv2/integrationresponse/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IntegrationResponse_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_integration_response"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IntegrationResponse_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_integration_response"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IntegrationResponse_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.IntegrationResponse + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.IntegrationResponse{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.IntegrationResponse") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IntegrationResponse_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/model/zz_controller.go b/internal/controller/apigatewayv2/model/zz_controller.go index 63f574e9c6..65e88ba9b2 100755 --- a/internal/controller/apigatewayv2/model/zz_controller.go +++ b/internal/controller/apigatewayv2/model/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Model_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_model"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Model_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_model"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Model_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Model + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Model{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Model") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Model_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/route/zz_controller.go b/internal/controller/apigatewayv2/route/zz_controller.go index 47d41c6878..88f4e4e051 100755 --- a/internal/controller/apigatewayv2/route/zz_controller.go +++ b/internal/controller/apigatewayv2/route/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Route_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_route"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Route_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_route"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Route_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Route + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Route{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Route") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Route_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/routeresponse/zz_controller.go b/internal/controller/apigatewayv2/routeresponse/zz_controller.go index b42e97133b..173b8796a9 100755 --- a/internal/controller/apigatewayv2/routeresponse/zz_controller.go +++ b/internal/controller/apigatewayv2/routeresponse/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RouteResponse_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_route_response"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RouteResponse_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_route_response"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RouteResponse_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RouteResponse + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RouteResponse{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RouteResponse") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RouteResponse_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/stage/zz_controller.go b/internal/controller/apigatewayv2/stage/zz_controller.go index ddda1c82ca..89ff65905c 100755 --- a/internal/controller/apigatewayv2/stage/zz_controller.go +++ b/internal/controller/apigatewayv2/stage/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Stage_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_stage"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stage_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_stage"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stage_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Stage + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Stage{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Stage") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Stage_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apigatewayv2/vpclink/zz_controller.go b/internal/controller/apigatewayv2/vpclink/zz_controller.go index f1a0ff3441..64d001781d 100755 --- a/internal/controller/apigatewayv2/vpclink/zz_controller.go +++ b/internal/controller/apigatewayv2/vpclink/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCLink_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_vpc_link"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCLink_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apigatewayv2_vpc_link"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCLink_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCLink + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCLink{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCLink") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCLink_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appautoscaling/policy/zz_controller.go b/internal/controller/appautoscaling/policy/zz_controller.go index f075212ed5..3dd825644a 100755 --- a/internal/controller/appautoscaling/policy/zz_controller.go +++ b/internal/controller/appautoscaling/policy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appautoscaling/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appautoscaling_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appautoscaling_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Policy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Policy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Policy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appautoscaling/scheduledaction/zz_controller.go b/internal/controller/appautoscaling/scheduledaction/zz_controller.go index f82a740fd0..6a1ba2482e 100755 --- a/internal/controller/appautoscaling/scheduledaction/zz_controller.go +++ b/internal/controller/appautoscaling/scheduledaction/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appautoscaling/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ScheduledAction_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appautoscaling_scheduled_action"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ScheduledAction_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appautoscaling_scheduled_action"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ScheduledAction_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ScheduledAction + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ScheduledAction{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ScheduledAction") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ScheduledAction_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appautoscaling/target/zz_controller.go b/internal/controller/appautoscaling/target/zz_controller.go index 3a5ab8460b..c1d4f40801 100755 --- a/internal/controller/appautoscaling/target/zz_controller.go +++ b/internal/controller/appautoscaling/target/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appautoscaling/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Target_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appautoscaling_target"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Target_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appautoscaling_target"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Target_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Target + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Target{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Target") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Target_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appconfig/application/zz_controller.go b/internal/controller/appconfig/application/zz_controller.go index 0dc266fcfa..caa8b12a47 100755 --- a/internal/controller/appconfig/application/zz_controller.go +++ b/internal/controller/appconfig/application/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appconfig/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_application"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_application"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Application + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Application{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Application") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appconfig/configurationprofile/zz_controller.go b/internal/controller/appconfig/configurationprofile/zz_controller.go index fdabb6e61b..304425e983 100755 --- a/internal/controller/appconfig/configurationprofile/zz_controller.go +++ b/internal/controller/appconfig/configurationprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appconfig/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConfigurationProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_configuration_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_configuration_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConfigurationProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConfigurationProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConfigurationProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConfigurationProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appconfig/deployment/zz_controller.go b/internal/controller/appconfig/deployment/zz_controller.go index 03ef0cf5ec..e70cc35abf 100755 --- a/internal/controller/appconfig/deployment/zz_controller.go +++ b/internal/controller/appconfig/deployment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appconfig/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Deployment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_deployment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Deployment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_deployment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Deployment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Deployment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Deployment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Deployment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Deployment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appconfig/deploymentstrategy/zz_controller.go b/internal/controller/appconfig/deploymentstrategy/zz_controller.go index 8ae8e9ce14..262c0df374 100755 --- a/internal/controller/appconfig/deploymentstrategy/zz_controller.go +++ b/internal/controller/appconfig/deploymentstrategy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appconfig/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DeploymentStrategy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_deployment_strategy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeploymentStrategy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_deployment_strategy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeploymentStrategy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DeploymentStrategy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DeploymentStrategy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DeploymentStrategy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DeploymentStrategy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appconfig/environment/zz_controller.go b/internal/controller/appconfig/environment/zz_controller.go index 48f89bc9e3..b5617ea4ed 100755 --- a/internal/controller/appconfig/environment/zz_controller.go +++ b/internal/controller/appconfig/environment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appconfig/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Environment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_environment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Environment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_environment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Environment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Environment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Environment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Environment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Environment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appconfig/extension/zz_controller.go b/internal/controller/appconfig/extension/zz_controller.go index 54ed135eb5..868ea328f4 100755 --- a/internal/controller/appconfig/extension/zz_controller.go +++ b/internal/controller/appconfig/extension/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appconfig/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Extension_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_extension"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Extension_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_extension"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Extension_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Extension + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Extension{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Extension") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Extension_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appconfig/extensionassociation/zz_controller.go b/internal/controller/appconfig/extensionassociation/zz_controller.go index f3961e389c..9363904251 100755 --- a/internal/controller/appconfig/extensionassociation/zz_controller.go +++ b/internal/controller/appconfig/extensionassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appconfig/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ExtensionAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_extension_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ExtensionAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_extension_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ExtensionAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ExtensionAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ExtensionAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ExtensionAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ExtensionAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appconfig/hostedconfigurationversion/zz_controller.go b/internal/controller/appconfig/hostedconfigurationversion/zz_controller.go index e13b04a38e..c828aab37c 100755 --- a/internal/controller/appconfig/hostedconfigurationversion/zz_controller.go +++ b/internal/controller/appconfig/hostedconfigurationversion/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appconfig/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HostedConfigurationVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_hosted_configuration_version"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedConfigurationVersion_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_hosted_configuration_version"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedConfigurationVersion_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HostedConfigurationVersion + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HostedConfigurationVersion{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HostedConfigurationVersion") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HostedConfigurationVersion_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appflow/flow/zz_controller.go b/internal/controller/appflow/flow/zz_controller.go index 9752041f80..58b3de3cba 100755 --- a/internal/controller/appflow/flow/zz_controller.go +++ b/internal/controller/appflow/flow/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appflow/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Flow_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appflow_flow"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Flow_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appflow_flow"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Flow_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Flow + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Flow{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Flow") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Flow_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appintegrations/eventintegration/zz_controller.go b/internal/controller/appintegrations/eventintegration/zz_controller.go index 3a9237ac34..8f743dfaab 100755 --- a/internal/controller/appintegrations/eventintegration/zz_controller.go +++ b/internal/controller/appintegrations/eventintegration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appintegrations/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EventIntegration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appintegrations_event_integration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventIntegration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appintegrations_event_integration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventIntegration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EventIntegration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EventIntegration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EventIntegration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventIntegration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/applicationinsights/application/zz_controller.go b/internal/controller/applicationinsights/application/zz_controller.go index 863036cb55..bbed31a363 100755 --- a/internal/controller/applicationinsights/application/zz_controller.go +++ b/internal/controller/applicationinsights/application/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/applicationinsights/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_applicationinsights_application"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_applicationinsights_application"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Application + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Application{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Application") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appmesh/gatewayroute/zz_controller.go b/internal/controller/appmesh/gatewayroute/zz_controller.go index 3848afab1b..fca66e8e65 100755 --- a/internal/controller/appmesh/gatewayroute/zz_controller.go +++ b/internal/controller/appmesh/gatewayroute/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appmesh/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GatewayRoute_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_gateway_route"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GatewayRoute_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_gateway_route"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GatewayRoute_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GatewayRoute + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GatewayRoute{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GatewayRoute") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GatewayRoute_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appmesh/mesh/zz_controller.go b/internal/controller/appmesh/mesh/zz_controller.go index ff5752e0f2..854bb36555 100755 --- a/internal/controller/appmesh/mesh/zz_controller.go +++ b/internal/controller/appmesh/mesh/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appmesh/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Mesh_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_mesh"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Mesh_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_mesh"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Mesh_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Mesh + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Mesh{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Mesh") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Mesh_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appmesh/route/zz_controller.go b/internal/controller/appmesh/route/zz_controller.go index 75f05f58ef..5ba8e754c3 100755 --- a/internal/controller/appmesh/route/zz_controller.go +++ b/internal/controller/appmesh/route/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appmesh/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Route_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_route"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Route_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_route"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Route_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Route + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Route{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Route") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Route_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appmesh/virtualgateway/zz_controller.go b/internal/controller/appmesh/virtualgateway/zz_controller.go index 67d95bbe57..cbef2cedab 100755 --- a/internal/controller/appmesh/virtualgateway/zz_controller.go +++ b/internal/controller/appmesh/virtualgateway/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appmesh/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VirtualGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_virtual_gateway"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VirtualGateway_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_virtual_gateway"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VirtualGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VirtualGateway + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VirtualGateway{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VirtualGateway") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appmesh/virtualnode/zz_controller.go b/internal/controller/appmesh/virtualnode/zz_controller.go index 2df06caa79..7c5dd17491 100755 --- a/internal/controller/appmesh/virtualnode/zz_controller.go +++ b/internal/controller/appmesh/virtualnode/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appmesh/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VirtualNode_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_virtual_node"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VirtualNode_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_virtual_node"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VirtualNode_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VirtualNode + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VirtualNode{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VirtualNode") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualNode_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appmesh/virtualrouter/zz_controller.go b/internal/controller/appmesh/virtualrouter/zz_controller.go index 44399f7dfa..01d292b484 100755 --- a/internal/controller/appmesh/virtualrouter/zz_controller.go +++ b/internal/controller/appmesh/virtualrouter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appmesh/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VirtualRouter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_virtual_router"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VirtualRouter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_virtual_router"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VirtualRouter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VirtualRouter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VirtualRouter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VirtualRouter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualRouter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appmesh/virtualservice/zz_controller.go b/internal/controller/appmesh/virtualservice/zz_controller.go index c8f136c590..d1c62d58b6 100755 --- a/internal/controller/appmesh/virtualservice/zz_controller.go +++ b/internal/controller/appmesh/virtualservice/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appmesh/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VirtualService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_virtual_service"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VirtualService_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appmesh_virtual_service"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VirtualService_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VirtualService + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VirtualService{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VirtualService") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apprunner/autoscalingconfigurationversion/zz_controller.go b/internal/controller/apprunner/autoscalingconfigurationversion/zz_controller.go index 839a957996..38a85ee866 100755 --- a/internal/controller/apprunner/autoscalingconfigurationversion/zz_controller.go +++ b/internal/controller/apprunner/autoscalingconfigurationversion/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apprunner/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AutoScalingConfigurationVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apprunner_auto_scaling_configuration_version"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AutoScalingConfigurationVersion_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apprunner_auto_scaling_configuration_version"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AutoScalingConfigurationVersion_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AutoScalingConfigurationVersion + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AutoScalingConfigurationVersion{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AutoScalingConfigurationVersion") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AutoScalingConfigurationVersion_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apprunner/connection/zz_controller.go b/internal/controller/apprunner/connection/zz_controller.go index fe7944f285..3c817d393c 100755 --- a/internal/controller/apprunner/connection/zz_controller.go +++ b/internal/controller/apprunner/connection/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apprunner/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apprunner_connection"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apprunner_connection"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Connection + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Connection{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Connection") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apprunner/observabilityconfiguration/zz_controller.go b/internal/controller/apprunner/observabilityconfiguration/zz_controller.go index 53150ef977..8df0676960 100755 --- a/internal/controller/apprunner/observabilityconfiguration/zz_controller.go +++ b/internal/controller/apprunner/observabilityconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apprunner/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ObservabilityConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apprunner_observability_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ObservabilityConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apprunner_observability_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ObservabilityConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ObservabilityConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ObservabilityConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ObservabilityConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ObservabilityConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apprunner/service/zz_controller.go b/internal/controller/apprunner/service/zz_controller.go index 03f1f4a972..e24f2ddeb6 100755 --- a/internal/controller/apprunner/service/zz_controller.go +++ b/internal/controller/apprunner/service/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apprunner/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Service_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apprunner_service"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Service_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apprunner_service"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Service_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Service + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Service{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Service") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Service_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/apprunner/vpcconnector/zz_controller.go b/internal/controller/apprunner/vpcconnector/zz_controller.go index 0860439521..5b60808d71 100755 --- a/internal/controller/apprunner/vpcconnector/zz_controller.go +++ b/internal/controller/apprunner/vpcconnector/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/apprunner/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCConnector_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apprunner_vpc_connector"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCConnector_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_apprunner_vpc_connector"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCConnector_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCConnector + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCConnector{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCConnector") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCConnector_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appstream/directoryconfig/zz_controller.go b/internal/controller/appstream/directoryconfig/zz_controller.go index ee4ab4d86f..e8a098c94c 100755 --- a/internal/controller/appstream/directoryconfig/zz_controller.go +++ b/internal/controller/appstream/directoryconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appstream/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DirectoryConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_directory_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DirectoryConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_directory_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DirectoryConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DirectoryConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DirectoryConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DirectoryConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DirectoryConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appstream/fleet/zz_controller.go b/internal/controller/appstream/fleet/zz_controller.go index 3bc6a23cee..c40290aa04 100755 --- a/internal/controller/appstream/fleet/zz_controller.go +++ b/internal/controller/appstream/fleet/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appstream/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Fleet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_fleet"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Fleet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_fleet"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Fleet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Fleet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Fleet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Fleet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Fleet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appstream/fleetstackassociation/zz_controller.go b/internal/controller/appstream/fleetstackassociation/zz_controller.go index 5c4c1dd020..adbadd5344 100755 --- a/internal/controller/appstream/fleetstackassociation/zz_controller.go +++ b/internal/controller/appstream/fleetstackassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appstream/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FleetStackAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_fleet_stack_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FleetStackAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_fleet_stack_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FleetStackAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FleetStackAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FleetStackAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FleetStackAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FleetStackAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appstream/imagebuilder/zz_controller.go b/internal/controller/appstream/imagebuilder/zz_controller.go index 252b960bc3..e7a72cc2aa 100755 --- a/internal/controller/appstream/imagebuilder/zz_controller.go +++ b/internal/controller/appstream/imagebuilder/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appstream/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ImageBuilder_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_image_builder"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ImageBuilder_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_image_builder"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ImageBuilder_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ImageBuilder + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ImageBuilder{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ImageBuilder") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ImageBuilder_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appstream/stack/zz_controller.go b/internal/controller/appstream/stack/zz_controller.go index a77375fb15..8da7a18f18 100755 --- a/internal/controller/appstream/stack/zz_controller.go +++ b/internal/controller/appstream/stack/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appstream/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Stack_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_stack"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stack_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_stack"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stack_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Stack + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Stack{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Stack") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Stack_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appstream/user/zz_controller.go b/internal/controller/appstream/user/zz_controller.go index bfaa90586d..a341f362f9 100755 --- a/internal/controller/appstream/user/zz_controller.go +++ b/internal/controller/appstream/user/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appstream/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_user"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_user"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.User + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.User{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.User") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appstream/userstackassociation/zz_controller.go b/internal/controller/appstream/userstackassociation/zz_controller.go index cab8d2f543..66d09e70c5 100755 --- a/internal/controller/appstream/userstackassociation/zz_controller.go +++ b/internal/controller/appstream/userstackassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appstream/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserStackAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_user_stack_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserStackAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appstream_user_stack_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserStackAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserStackAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserStackAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserStackAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserStackAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appsync/apicache/zz_controller.go b/internal/controller/appsync/apicache/zz_controller.go index 8510647dca..0189d9385a 100755 --- a/internal/controller/appsync/apicache/zz_controller.go +++ b/internal/controller/appsync/apicache/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appsync/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.APICache_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_api_cache"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.APICache_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_api_cache"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.APICache_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.APICache + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.APICache{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.APICache") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APICache_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appsync/apikey/zz_controller.go b/internal/controller/appsync/apikey/zz_controller.go index ccd108252f..1d3395c372 100755 --- a/internal/controller/appsync/apikey/zz_controller.go +++ b/internal/controller/appsync/apikey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appsync/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.APIKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_api_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.APIKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_api_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.APIKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.APIKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.APIKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.APIKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APIKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appsync/datasource/zz_controller.go b/internal/controller/appsync/datasource/zz_controller.go index e74d7e91d4..730b66ca5b 100755 --- a/internal/controller/appsync/datasource/zz_controller.go +++ b/internal/controller/appsync/datasource/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appsync/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Datasource_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_datasource"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Datasource_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_datasource"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Datasource_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Datasource + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Datasource{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Datasource") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Datasource_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appsync/function/zz_controller.go b/internal/controller/appsync/function/zz_controller.go index 490e44cc3a..30dde55e0a 100755 --- a/internal/controller/appsync/function/zz_controller.go +++ b/internal/controller/appsync/function/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appsync/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Function_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_function"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Function_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_function"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Function_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Function + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Function{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Function") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Function_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appsync/graphqlapi/zz_controller.go b/internal/controller/appsync/graphqlapi/zz_controller.go index a3813219ca..d979764623 100755 --- a/internal/controller/appsync/graphqlapi/zz_controller.go +++ b/internal/controller/appsync/graphqlapi/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appsync/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GraphQLAPI_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_graphql_api"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GraphQLAPI_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_graphql_api"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GraphQLAPI_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GraphQLAPI + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GraphQLAPI{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GraphQLAPI") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GraphQLAPI_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/appsync/resolver/zz_controller.go b/internal/controller/appsync/resolver/zz_controller.go index 0e1b53cc5c..85712d8f6d 100755 --- a/internal/controller/appsync/resolver/zz_controller.go +++ b/internal/controller/appsync/resolver/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appsync/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Resolver_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_resolver"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Resolver_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appsync_resolver"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Resolver_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Resolver + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Resolver{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Resolver") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Resolver_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/athena/database/zz_controller.go b/internal/controller/athena/database/zz_controller.go index 9cef5607df..cc895a29e8 100755 --- a/internal/controller/athena/database/zz_controller.go +++ b/internal/controller/athena/database/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/athena/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_athena_database"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Database_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_athena_database"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Database_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Database + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Database{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Database") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/athena/datacatalog/zz_controller.go b/internal/controller/athena/datacatalog/zz_controller.go index 85853c804b..729fab9150 100755 --- a/internal/controller/athena/datacatalog/zz_controller.go +++ b/internal/controller/athena/datacatalog/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/athena/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DataCatalog_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_athena_data_catalog"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataCatalog_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_athena_data_catalog"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataCatalog_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DataCatalog + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DataCatalog{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DataCatalog") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataCatalog_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/athena/namedquery/zz_controller.go b/internal/controller/athena/namedquery/zz_controller.go index c07ac326af..e85d913d89 100755 --- a/internal/controller/athena/namedquery/zz_controller.go +++ b/internal/controller/athena/namedquery/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/athena/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NamedQuery_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_athena_named_query"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NamedQuery_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_athena_named_query"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NamedQuery_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NamedQuery + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NamedQuery{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NamedQuery") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NamedQuery_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/athena/workgroup/zz_controller.go b/internal/controller/athena/workgroup/zz_controller.go index 11bd1d0781..1a2a5b1951 100755 --- a/internal/controller/athena/workgroup/zz_controller.go +++ b/internal/controller/athena/workgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/athena/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Workgroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_athena_workgroup"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workgroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_athena_workgroup"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workgroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Workgroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Workgroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Workgroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Workgroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/autoscaling/attachment/zz_controller.go b/internal/controller/autoscaling/attachment/zz_controller.go index fdc20ab0a0..ea075b957e 100755 --- a/internal/controller/autoscaling/attachment/zz_controller.go +++ b/internal/controller/autoscaling/attachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/autoscaling/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Attachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Attachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Attachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Attachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Attachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Attachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Attachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/autoscaling/autoscalinggroup/zz_controller.go b/internal/controller/autoscaling/autoscalinggroup/zz_controller.go index 4adc62c047..b3777dc74d 100755 --- a/internal/controller/autoscaling/autoscalinggroup/zz_controller.go +++ b/internal/controller/autoscaling/autoscalinggroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/autoscaling/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AutoscalingGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AutoscalingGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AutoscalingGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AutoscalingGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AutoscalingGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AutoscalingGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AutoscalingGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/autoscaling/grouptag/zz_controller.go b/internal/controller/autoscaling/grouptag/zz_controller.go index e77c194050..0146209199 100755 --- a/internal/controller/autoscaling/grouptag/zz_controller.go +++ b/internal/controller/autoscaling/grouptag/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/autoscaling/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GroupTag_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_group_tag"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GroupTag_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_group_tag"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GroupTag_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GroupTag + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GroupTag{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GroupTag") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GroupTag_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/autoscaling/launchconfiguration/zz_controller.go b/internal/controller/autoscaling/launchconfiguration/zz_controller.go index e830c0b3d8..7bb37f885c 100755 --- a/internal/controller/autoscaling/launchconfiguration/zz_controller.go +++ b/internal/controller/autoscaling/launchconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/autoscaling/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LaunchConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_launch_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LaunchConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_launch_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LaunchConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LaunchConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LaunchConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LaunchConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LaunchConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/autoscaling/lifecyclehook/zz_controller.go b/internal/controller/autoscaling/lifecyclehook/zz_controller.go index 1083daddaf..980b0e711e 100755 --- a/internal/controller/autoscaling/lifecyclehook/zz_controller.go +++ b/internal/controller/autoscaling/lifecyclehook/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/autoscaling/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LifecycleHook_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_lifecycle_hook"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LifecycleHook_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_lifecycle_hook"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LifecycleHook_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LifecycleHook + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LifecycleHook{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LifecycleHook") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LifecycleHook_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/autoscaling/notification/zz_controller.go b/internal/controller/autoscaling/notification/zz_controller.go index 7fa3282974..1dce94efca 100755 --- a/internal/controller/autoscaling/notification/zz_controller.go +++ b/internal/controller/autoscaling/notification/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/autoscaling/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Notification_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_notification"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Notification_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_notification"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Notification_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Notification + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Notification{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Notification") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Notification_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/autoscaling/policy/zz_controller.go b/internal/controller/autoscaling/policy/zz_controller.go index 15ec93aff9..1a8fbcb9ce 100755 --- a/internal/controller/autoscaling/policy/zz_controller.go +++ b/internal/controller/autoscaling/policy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/autoscaling/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Policy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Policy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Policy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/autoscaling/schedule/zz_controller.go b/internal/controller/autoscaling/schedule/zz_controller.go index 975b94ee7c..4ee4965164 100755 --- a/internal/controller/autoscaling/schedule/zz_controller.go +++ b/internal/controller/autoscaling/schedule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/autoscaling/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Schedule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_schedule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Schedule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscaling_schedule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Schedule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Schedule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Schedule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Schedule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Schedule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/autoscalingplans/scalingplan/zz_controller.go b/internal/controller/autoscalingplans/scalingplan/zz_controller.go index 6251683594..984266efe7 100755 --- a/internal/controller/autoscalingplans/scalingplan/zz_controller.go +++ b/internal/controller/autoscalingplans/scalingplan/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/autoscalingplans/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ScalingPlan_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscalingplans_scaling_plan"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ScalingPlan_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_autoscalingplans_scaling_plan"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ScalingPlan_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ScalingPlan + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ScalingPlan{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ScalingPlan") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ScalingPlan_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/backup/framework/zz_controller.go b/internal/controller/backup/framework/zz_controller.go index 8727aa90c7..9eafec0445 100755 --- a/internal/controller/backup/framework/zz_controller.go +++ b/internal/controller/backup/framework/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/backup/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Framework_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_framework"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Framework_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_framework"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Framework_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Framework + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Framework{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Framework") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Framework_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/backup/globalsettings/zz_controller.go b/internal/controller/backup/globalsettings/zz_controller.go index 69df753957..936617772f 100755 --- a/internal/controller/backup/globalsettings/zz_controller.go +++ b/internal/controller/backup/globalsettings/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/backup/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalSettings_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_global_settings"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalSettings_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_global_settings"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalSettings_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GlobalSettings + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GlobalSettings{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GlobalSettings") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GlobalSettings_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/backup/plan/zz_controller.go b/internal/controller/backup/plan/zz_controller.go index 9ea2fbd7a0..5bd7bc5235 100755 --- a/internal/controller/backup/plan/zz_controller.go +++ b/internal/controller/backup/plan/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/backup/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Plan_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_plan"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Plan_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_plan"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Plan_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Plan + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Plan{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Plan") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Plan_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/backup/regionsettings/zz_controller.go b/internal/controller/backup/regionsettings/zz_controller.go index 0b5a7097fd..f3b5ca9114 100755 --- a/internal/controller/backup/regionsettings/zz_controller.go +++ b/internal/controller/backup/regionsettings/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/backup/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionSettings_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_region_settings"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionSettings_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_region_settings"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionSettings_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RegionSettings + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RegionSettings{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RegionSettings") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RegionSettings_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/backup/reportplan/zz_controller.go b/internal/controller/backup/reportplan/zz_controller.go index c9da3b435d..60fc9473ef 100755 --- a/internal/controller/backup/reportplan/zz_controller.go +++ b/internal/controller/backup/reportplan/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/backup/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReportPlan_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_report_plan"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReportPlan_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_report_plan"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReportPlan_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReportPlan + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReportPlan{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReportPlan") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReportPlan_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/backup/selection/zz_controller.go b/internal/controller/backup/selection/zz_controller.go index 9e3c26d9bd..3b3ea666e5 100755 --- a/internal/controller/backup/selection/zz_controller.go +++ b/internal/controller/backup/selection/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/backup/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Selection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_selection"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Selection_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_selection"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Selection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Selection + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Selection{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Selection") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Selection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/backup/vault/zz_controller.go b/internal/controller/backup/vault/zz_controller.go index b4661a00a8..1cc44f6919 100755 --- a/internal/controller/backup/vault/zz_controller.go +++ b/internal/controller/backup/vault/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/backup/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Vault_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_vault"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Vault_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_vault"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Vault_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Vault + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Vault{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Vault") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Vault_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/backup/vaultlockconfiguration/zz_controller.go b/internal/controller/backup/vaultlockconfiguration/zz_controller.go index f5f786e6bf..1c3431ba1b 100755 --- a/internal/controller/backup/vaultlockconfiguration/zz_controller.go +++ b/internal/controller/backup/vaultlockconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/backup/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VaultLockConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_vault_lock_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VaultLockConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_vault_lock_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VaultLockConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VaultLockConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VaultLockConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VaultLockConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VaultLockConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/backup/vaultnotifications/zz_controller.go b/internal/controller/backup/vaultnotifications/zz_controller.go index 9b7125c698..eb565e7982 100755 --- a/internal/controller/backup/vaultnotifications/zz_controller.go +++ b/internal/controller/backup/vaultnotifications/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/backup/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VaultNotifications_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_vault_notifications"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VaultNotifications_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_vault_notifications"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VaultNotifications_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VaultNotifications + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VaultNotifications{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VaultNotifications") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VaultNotifications_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/backup/vaultpolicy/zz_controller.go b/internal/controller/backup/vaultpolicy/zz_controller.go index 85be16f176..4f7d6ee489 100755 --- a/internal/controller/backup/vaultpolicy/zz_controller.go +++ b/internal/controller/backup/vaultpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/backup/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VaultPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_vault_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VaultPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_backup_vault_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VaultPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VaultPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VaultPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VaultPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VaultPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/batch/jobdefinition/zz_controller.go b/internal/controller/batch/jobdefinition/zz_controller.go index 3ca8272636..9ed1ccf5ee 100755 --- a/internal/controller/batch/jobdefinition/zz_controller.go +++ b/internal/controller/batch/jobdefinition/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/batch/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.JobDefinition_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_batch_job_definition"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.JobDefinition_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_batch_job_definition"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.JobDefinition_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.JobDefinition + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.JobDefinition{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.JobDefinition") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.JobDefinition_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/batch/schedulingpolicy/zz_controller.go b/internal/controller/batch/schedulingpolicy/zz_controller.go index a3e5d5faea..8e6f2763d4 100755 --- a/internal/controller/batch/schedulingpolicy/zz_controller.go +++ b/internal/controller/batch/schedulingpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/batch/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SchedulingPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_batch_scheduling_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SchedulingPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_batch_scheduling_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SchedulingPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SchedulingPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SchedulingPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SchedulingPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SchedulingPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/budgets/budget/zz_controller.go b/internal/controller/budgets/budget/zz_controller.go index 46527c287e..4c95326287 100755 --- a/internal/controller/budgets/budget/zz_controller.go +++ b/internal/controller/budgets/budget/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/budgets/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Budget_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_budgets_budget"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Budget_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_budgets_budget"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Budget_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Budget + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Budget{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Budget") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Budget_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/budgets/budgetaction/zz_controller.go b/internal/controller/budgets/budgetaction/zz_controller.go index 0952eb8178..00178614b3 100755 --- a/internal/controller/budgets/budgetaction/zz_controller.go +++ b/internal/controller/budgets/budgetaction/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/budgets/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BudgetAction_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_budgets_budget_action"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BudgetAction_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_budgets_budget_action"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BudgetAction_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BudgetAction + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BudgetAction{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BudgetAction") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BudgetAction_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ce/anomalymonitor/zz_controller.go b/internal/controller/ce/anomalymonitor/zz_controller.go index ce04ba12fc..d0423a1e3d 100755 --- a/internal/controller/ce/anomalymonitor/zz_controller.go +++ b/internal/controller/ce/anomalymonitor/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ce/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AnomalyMonitor_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ce_anomaly_monitor"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AnomalyMonitor_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ce_anomaly_monitor"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AnomalyMonitor_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AnomalyMonitor + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AnomalyMonitor{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AnomalyMonitor") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AnomalyMonitor_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/chime/voiceconnector/zz_controller.go b/internal/controller/chime/voiceconnector/zz_controller.go index b6c54f145f..6eea023710 100755 --- a/internal/controller/chime/voiceconnector/zz_controller.go +++ b/internal/controller/chime/voiceconnector/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/chime/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VoiceConnector_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnector_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnector_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VoiceConnector + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VoiceConnector{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VoiceConnector") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VoiceConnector_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/chime/voiceconnectorgroup/zz_controller.go b/internal/controller/chime/voiceconnectorgroup/zz_controller.go index 222d2a5dcd..9f8b81403f 100755 --- a/internal/controller/chime/voiceconnectorgroup/zz_controller.go +++ b/internal/controller/chime/voiceconnectorgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/chime/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VoiceConnectorGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VoiceConnectorGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VoiceConnectorGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/chime/voiceconnectorlogging/zz_controller.go b/internal/controller/chime/voiceconnectorlogging/zz_controller.go index ba6ad64439..956c38e46c 100755 --- a/internal/controller/chime/voiceconnectorlogging/zz_controller.go +++ b/internal/controller/chime/voiceconnectorlogging/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/chime/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorLogging_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_logging"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorLogging_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_logging"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorLogging_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VoiceConnectorLogging + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VoiceConnectorLogging{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VoiceConnectorLogging") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorLogging_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/chime/voiceconnectororigination/zz_controller.go b/internal/controller/chime/voiceconnectororigination/zz_controller.go index 1f08c9e750..58707224ab 100755 --- a/internal/controller/chime/voiceconnectororigination/zz_controller.go +++ b/internal/controller/chime/voiceconnectororigination/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/chime/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorOrigination_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_origination"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorOrigination_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_origination"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorOrigination_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VoiceConnectorOrigination + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VoiceConnectorOrigination{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VoiceConnectorOrigination") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorOrigination_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/chime/voiceconnectorstreaming/zz_controller.go b/internal/controller/chime/voiceconnectorstreaming/zz_controller.go index 8bf39cac3f..ab57903e85 100755 --- a/internal/controller/chime/voiceconnectorstreaming/zz_controller.go +++ b/internal/controller/chime/voiceconnectorstreaming/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/chime/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorStreaming_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_streaming"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorStreaming_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_streaming"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorStreaming_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VoiceConnectorStreaming + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VoiceConnectorStreaming{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VoiceConnectorStreaming") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorStreaming_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/chime/voiceconnectortermination/zz_controller.go b/internal/controller/chime/voiceconnectortermination/zz_controller.go index 2b6619c670..3867a3b4e7 100755 --- a/internal/controller/chime/voiceconnectortermination/zz_controller.go +++ b/internal/controller/chime/voiceconnectortermination/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/chime/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorTermination_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_termination"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorTermination_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_termination"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorTermination_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VoiceConnectorTermination + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VoiceConnectorTermination{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VoiceConnectorTermination") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorTermination_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/chime/voiceconnectorterminationcredentials/zz_controller.go b/internal/controller/chime/voiceconnectorterminationcredentials/zz_controller.go index 5bec306c46..ab467e2563 100755 --- a/internal/controller/chime/voiceconnectorterminationcredentials/zz_controller.go +++ b/internal/controller/chime/voiceconnectorterminationcredentials/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/chime/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorTerminationCredentials_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_termination_credentials"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorTerminationCredentials_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_chime_voice_connector_termination_credentials"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VoiceConnectorTerminationCredentials_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VoiceConnectorTerminationCredentials + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VoiceConnectorTerminationCredentials{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VoiceConnectorTerminationCredentials") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VoiceConnectorTerminationCredentials_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloud9/environmentec2/zz_controller.go b/internal/controller/cloud9/environmentec2/zz_controller.go index 3dd1185746..a7ebe45f83 100755 --- a/internal/controller/cloud9/environmentec2/zz_controller.go +++ b/internal/controller/cloud9/environmentec2/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloud9/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EnvironmentEC2_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloud9_environment_ec2"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EnvironmentEC2_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloud9_environment_ec2"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EnvironmentEC2_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EnvironmentEC2 + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EnvironmentEC2{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EnvironmentEC2") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EnvironmentEC2_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloud9/environmentmembership/zz_controller.go b/internal/controller/cloud9/environmentmembership/zz_controller.go index 36014b165a..423633ab63 100755 --- a/internal/controller/cloud9/environmentmembership/zz_controller.go +++ b/internal/controller/cloud9/environmentmembership/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloud9/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EnvironmentMembership_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloud9_environment_membership"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EnvironmentMembership_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloud9_environment_membership"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EnvironmentMembership_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EnvironmentMembership + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EnvironmentMembership{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EnvironmentMembership") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EnvironmentMembership_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudcontrol/resource/zz_controller.go b/internal/controller/cloudcontrol/resource/zz_controller.go index 0f5f0e78e2..a3fd0d5d4e 100755 --- a/internal/controller/cloudcontrol/resource/zz_controller.go +++ b/internal/controller/cloudcontrol/resource/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudcontrol/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Resource_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudcontrolapi_resource"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Resource_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudcontrolapi_resource"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Resource_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Resource + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Resource{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Resource") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Resource_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudformation/stack/zz_controller.go b/internal/controller/cloudformation/stack/zz_controller.go index d4f48d0a8d..567186f9e6 100755 --- a/internal/controller/cloudformation/stack/zz_controller.go +++ b/internal/controller/cloudformation/stack/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudformation/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Stack_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudformation_stack"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stack_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudformation_stack"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stack_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Stack + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Stack{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Stack") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Stack_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudformation/stackset/zz_controller.go b/internal/controller/cloudformation/stackset/zz_controller.go index 2bcb1e9cd3..6fe0e17d95 100755 --- a/internal/controller/cloudformation/stackset/zz_controller.go +++ b/internal/controller/cloudformation/stackset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudformation/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StackSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudformation_stack_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StackSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudformation_stack_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StackSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.StackSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.StackSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.StackSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StackSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/cachepolicy/zz_controller.go b/internal/controller/cloudfront/cachepolicy/zz_controller.go index b27e86449b..4a0e181cd9 100755 --- a/internal/controller/cloudfront/cachepolicy/zz_controller.go +++ b/internal/controller/cloudfront/cachepolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CachePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_cache_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CachePolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_cache_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CachePolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CachePolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CachePolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CachePolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CachePolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/distribution/zz_controller.go b/internal/controller/cloudfront/distribution/zz_controller.go index e99e18bd6a..e8bc280eca 100755 --- a/internal/controller/cloudfront/distribution/zz_controller.go +++ b/internal/controller/cloudfront/distribution/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Distribution_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_distribution"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Distribution_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_distribution"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Distribution_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Distribution + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Distribution{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Distribution") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Distribution_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/fieldlevelencryptionconfig/zz_controller.go b/internal/controller/cloudfront/fieldlevelencryptionconfig/zz_controller.go index 2d9339109e..50b4c0f826 100755 --- a/internal/controller/cloudfront/fieldlevelencryptionconfig/zz_controller.go +++ b/internal/controller/cloudfront/fieldlevelencryptionconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FieldLevelEncryptionConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_field_level_encryption_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FieldLevelEncryptionConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_field_level_encryption_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FieldLevelEncryptionConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FieldLevelEncryptionConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FieldLevelEncryptionConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FieldLevelEncryptionConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FieldLevelEncryptionConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/fieldlevelencryptionprofile/zz_controller.go b/internal/controller/cloudfront/fieldlevelencryptionprofile/zz_controller.go index a05b80fdff..29cc3ee229 100755 --- a/internal/controller/cloudfront/fieldlevelencryptionprofile/zz_controller.go +++ b/internal/controller/cloudfront/fieldlevelencryptionprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FieldLevelEncryptionProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_field_level_encryption_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FieldLevelEncryptionProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_field_level_encryption_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FieldLevelEncryptionProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FieldLevelEncryptionProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FieldLevelEncryptionProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FieldLevelEncryptionProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FieldLevelEncryptionProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/function/zz_controller.go b/internal/controller/cloudfront/function/zz_controller.go index e0265bdd58..7465d2836f 100755 --- a/internal/controller/cloudfront/function/zz_controller.go +++ b/internal/controller/cloudfront/function/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Function_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_function"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Function_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_function"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Function_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Function + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Function{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Function") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Function_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/keygroup/zz_controller.go b/internal/controller/cloudfront/keygroup/zz_controller.go index 86f6bf6514..7f78e8033f 100755 --- a/internal/controller/cloudfront/keygroup/zz_controller.go +++ b/internal/controller/cloudfront/keygroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.KeyGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_key_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.KeyGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_key_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.KeyGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.KeyGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.KeyGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.KeyGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.KeyGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/monitoringsubscription/zz_controller.go b/internal/controller/cloudfront/monitoringsubscription/zz_controller.go index 6f8f29de66..e55e7a00aa 100755 --- a/internal/controller/cloudfront/monitoringsubscription/zz_controller.go +++ b/internal/controller/cloudfront/monitoringsubscription/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MonitoringSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_monitoring_subscription"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MonitoringSubscription_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_monitoring_subscription"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MonitoringSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MonitoringSubscription + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MonitoringSubscription{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MonitoringSubscription") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MonitoringSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/originaccesscontrol/zz_controller.go b/internal/controller/cloudfront/originaccesscontrol/zz_controller.go index a749095186..958412e459 100755 --- a/internal/controller/cloudfront/originaccesscontrol/zz_controller.go +++ b/internal/controller/cloudfront/originaccesscontrol/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OriginAccessControl_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_origin_access_control"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OriginAccessControl_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_origin_access_control"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OriginAccessControl_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.OriginAccessControl + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.OriginAccessControl{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.OriginAccessControl") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OriginAccessControl_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/originaccessidentity/zz_controller.go b/internal/controller/cloudfront/originaccessidentity/zz_controller.go index 50eae63fc3..2a24147bd6 100755 --- a/internal/controller/cloudfront/originaccessidentity/zz_controller.go +++ b/internal/controller/cloudfront/originaccessidentity/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OriginAccessIdentity_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_origin_access_identity"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OriginAccessIdentity_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_origin_access_identity"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OriginAccessIdentity_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.OriginAccessIdentity + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.OriginAccessIdentity{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.OriginAccessIdentity") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OriginAccessIdentity_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/originrequestpolicy/zz_controller.go b/internal/controller/cloudfront/originrequestpolicy/zz_controller.go index 11f0f4ba9d..ceb83d5074 100755 --- a/internal/controller/cloudfront/originrequestpolicy/zz_controller.go +++ b/internal/controller/cloudfront/originrequestpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OriginRequestPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_origin_request_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OriginRequestPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_origin_request_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OriginRequestPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.OriginRequestPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.OriginRequestPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.OriginRequestPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OriginRequestPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/publickey/zz_controller.go b/internal/controller/cloudfront/publickey/zz_controller.go index 04f29ac4b7..d1382506bd 100755 --- a/internal/controller/cloudfront/publickey/zz_controller.go +++ b/internal/controller/cloudfront/publickey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PublicKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_public_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PublicKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_public_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PublicKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PublicKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PublicKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PublicKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PublicKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/realtimelogconfig/zz_controller.go b/internal/controller/cloudfront/realtimelogconfig/zz_controller.go index 0cb2decffa..f2fa56f211 100755 --- a/internal/controller/cloudfront/realtimelogconfig/zz_controller.go +++ b/internal/controller/cloudfront/realtimelogconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RealtimeLogConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_realtime_log_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RealtimeLogConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_realtime_log_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RealtimeLogConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RealtimeLogConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RealtimeLogConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RealtimeLogConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RealtimeLogConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudfront/responseheaderspolicy/zz_controller.go b/internal/controller/cloudfront/responseheaderspolicy/zz_controller.go index bb5ee4b5fb..e588c6bbd5 100755 --- a/internal/controller/cloudfront/responseheaderspolicy/zz_controller.go +++ b/internal/controller/cloudfront/responseheaderspolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudfront/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResponseHeadersPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_response_headers_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResponseHeadersPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudfront_response_headers_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResponseHeadersPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResponseHeadersPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResponseHeadersPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResponseHeadersPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResponseHeadersPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudsearch/domain/zz_controller.go b/internal/controller/cloudsearch/domain/zz_controller.go index 4234e99643..997d24c9fb 100755 --- a/internal/controller/cloudsearch/domain/zz_controller.go +++ b/internal/controller/cloudsearch/domain/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudsearch/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudsearch_domain"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudsearch_domain"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Domain + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Domain{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Domain") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudsearch/domainserviceaccesspolicy/zz_controller.go b/internal/controller/cloudsearch/domainserviceaccesspolicy/zz_controller.go index d995caadba..d3b5e3872f 100755 --- a/internal/controller/cloudsearch/domainserviceaccesspolicy/zz_controller.go +++ b/internal/controller/cloudsearch/domainserviceaccesspolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudsearch/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainServiceAccessPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudsearch_domain_service_access_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainServiceAccessPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudsearch_domain_service_access_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainServiceAccessPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DomainServiceAccessPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DomainServiceAccessPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DomainServiceAccessPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainServiceAccessPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudtrail/eventdatastore/zz_controller.go b/internal/controller/cloudtrail/eventdatastore/zz_controller.go index 15c0b84c74..2928e747bb 100755 --- a/internal/controller/cloudtrail/eventdatastore/zz_controller.go +++ b/internal/controller/cloudtrail/eventdatastore/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudtrail/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EventDataStore_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudtrail_event_data_store"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventDataStore_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudtrail_event_data_store"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventDataStore_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EventDataStore + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EventDataStore{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EventDataStore") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventDataStore_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudtrail/trail/zz_controller.go b/internal/controller/cloudtrail/trail/zz_controller.go index da0d08c9a8..1aa95ee6bc 100755 --- a/internal/controller/cloudtrail/trail/zz_controller.go +++ b/internal/controller/cloudtrail/trail/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudtrail/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Trail_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudtrail"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Trail_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudtrail"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Trail_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Trail + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Trail{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Trail") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Trail_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatch/compositealarm/zz_controller.go b/internal/controller/cloudwatch/compositealarm/zz_controller.go index 1fc4e5ed18..26ff73ec1a 100755 --- a/internal/controller/cloudwatch/compositealarm/zz_controller.go +++ b/internal/controller/cloudwatch/compositealarm/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatch/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CompositeAlarm_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_composite_alarm"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CompositeAlarm_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_composite_alarm"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CompositeAlarm_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CompositeAlarm + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CompositeAlarm{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CompositeAlarm") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CompositeAlarm_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatch/dashboard/zz_controller.go b/internal/controller/cloudwatch/dashboard/zz_controller.go index e27b9f2b2e..38f4325fec 100755 --- a/internal/controller/cloudwatch/dashboard/zz_controller.go +++ b/internal/controller/cloudwatch/dashboard/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatch/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Dashboard_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_dashboard"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Dashboard_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_dashboard"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Dashboard_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Dashboard + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Dashboard{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Dashboard") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Dashboard_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatch/metricalarm/zz_controller.go b/internal/controller/cloudwatch/metricalarm/zz_controller.go index 3486b98e54..92cb22ae4c 100755 --- a/internal/controller/cloudwatch/metricalarm/zz_controller.go +++ b/internal/controller/cloudwatch/metricalarm/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatch/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MetricAlarm_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_metric_alarm"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MetricAlarm_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_metric_alarm"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MetricAlarm_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MetricAlarm + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MetricAlarm{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MetricAlarm") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MetricAlarm_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatch/metricstream/zz_controller.go b/internal/controller/cloudwatch/metricstream/zz_controller.go index 7d43c1db8a..e19d45efdf 100755 --- a/internal/controller/cloudwatch/metricstream/zz_controller.go +++ b/internal/controller/cloudwatch/metricstream/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatch/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MetricStream_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_metric_stream"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MetricStream_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_metric_stream"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MetricStream_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MetricStream + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MetricStream{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MetricStream") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MetricStream_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchevents/apidestination/zz_controller.go b/internal/controller/cloudwatchevents/apidestination/zz_controller.go index 73c134b0bb..963902357f 100755 --- a/internal/controller/cloudwatchevents/apidestination/zz_controller.go +++ b/internal/controller/cloudwatchevents/apidestination/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchevents/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.APIDestination_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_api_destination"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.APIDestination_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_api_destination"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.APIDestination_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.APIDestination + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.APIDestination{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.APIDestination") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.APIDestination_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchevents/archive/zz_controller.go b/internal/controller/cloudwatchevents/archive/zz_controller.go index ce8ff6ef86..a05949a5bd 100755 --- a/internal/controller/cloudwatchevents/archive/zz_controller.go +++ b/internal/controller/cloudwatchevents/archive/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchevents/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Archive_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_archive"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Archive_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_archive"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Archive_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Archive + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Archive{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Archive") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Archive_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchevents/bus/zz_controller.go b/internal/controller/cloudwatchevents/bus/zz_controller.go index 6564644d42..f315e2d5f9 100755 --- a/internal/controller/cloudwatchevents/bus/zz_controller.go +++ b/internal/controller/cloudwatchevents/bus/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchevents/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Bus_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_bus"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Bus_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_bus"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Bus_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Bus + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Bus{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Bus") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Bus_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchevents/buspolicy/zz_controller.go b/internal/controller/cloudwatchevents/buspolicy/zz_controller.go index 51b0937ac5..5069b98804 100755 --- a/internal/controller/cloudwatchevents/buspolicy/zz_controller.go +++ b/internal/controller/cloudwatchevents/buspolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchevents/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BusPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_bus_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BusPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_bus_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BusPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BusPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BusPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BusPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BusPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchevents/connection/zz_controller.go b/internal/controller/cloudwatchevents/connection/zz_controller.go index ffded94f4e..eff5249374 100755 --- a/internal/controller/cloudwatchevents/connection/zz_controller.go +++ b/internal/controller/cloudwatchevents/connection/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchevents/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_connection"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_connection"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Connection + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Connection{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Connection") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchevents/permission/zz_controller.go b/internal/controller/cloudwatchevents/permission/zz_controller.go index a461ac8cc1..ad45dc3df3 100755 --- a/internal/controller/cloudwatchevents/permission/zz_controller.go +++ b/internal/controller/cloudwatchevents/permission/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchevents/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Permission_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_permission"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Permission_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_permission"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Permission_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Permission + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Permission{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Permission") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Permission_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchevents/rule/zz_controller.go b/internal/controller/cloudwatchevents/rule/zz_controller.go index 986093f2c0..100abeaea5 100755 --- a/internal/controller/cloudwatchevents/rule/zz_controller.go +++ b/internal/controller/cloudwatchevents/rule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchevents/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Rule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Rule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Rule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Rule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Rule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Rule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Rule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchevents/target/zz_controller.go b/internal/controller/cloudwatchevents/target/zz_controller.go index 67b04c1da6..5ba1419fd2 100755 --- a/internal/controller/cloudwatchevents/target/zz_controller.go +++ b/internal/controller/cloudwatchevents/target/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchevents/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Target_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_target"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Target_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_event_target"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Target_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Target + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Target{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Target") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Target_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchlogs/definition/zz_controller.go b/internal/controller/cloudwatchlogs/definition/zz_controller.go index 3b564a2395..496bba3c7a 100755 --- a/internal/controller/cloudwatchlogs/definition/zz_controller.go +++ b/internal/controller/cloudwatchlogs/definition/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Definition_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_query_definition"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Definition_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_query_definition"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Definition_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Definition + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Definition{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Definition") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Definition_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchlogs/destination/zz_controller.go b/internal/controller/cloudwatchlogs/destination/zz_controller.go index 004349828c..2405e47132 100755 --- a/internal/controller/cloudwatchlogs/destination/zz_controller.go +++ b/internal/controller/cloudwatchlogs/destination/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Destination_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_destination"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Destination_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_destination"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Destination_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Destination + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Destination{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Destination") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Destination_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchlogs/destinationpolicy/zz_controller.go b/internal/controller/cloudwatchlogs/destinationpolicy/zz_controller.go index 46c549fe9a..4c7d4162cc 100755 --- a/internal/controller/cloudwatchlogs/destinationpolicy/zz_controller.go +++ b/internal/controller/cloudwatchlogs/destinationpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DestinationPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_destination_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DestinationPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_destination_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DestinationPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DestinationPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DestinationPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DestinationPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DestinationPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchlogs/group/zz_controller.go b/internal/controller/cloudwatchlogs/group/zz_controller.go index e2de71fe74..a976eb325f 100755 --- a/internal/controller/cloudwatchlogs/group/zz_controller.go +++ b/internal/controller/cloudwatchlogs/group/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Group + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Group{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Group") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchlogs/metricfilter/zz_controller.go b/internal/controller/cloudwatchlogs/metricfilter/zz_controller.go index c24cea36c3..0289aa2d2b 100755 --- a/internal/controller/cloudwatchlogs/metricfilter/zz_controller.go +++ b/internal/controller/cloudwatchlogs/metricfilter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MetricFilter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_metric_filter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MetricFilter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_metric_filter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MetricFilter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MetricFilter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MetricFilter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MetricFilter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MetricFilter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchlogs/resourcepolicy/zz_controller.go b/internal/controller/cloudwatchlogs/resourcepolicy/zz_controller.go index e6980cde0a..cd9002deb3 100755 --- a/internal/controller/cloudwatchlogs/resourcepolicy/zz_controller.go +++ b/internal/controller/cloudwatchlogs/resourcepolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourcePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_resource_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourcePolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_resource_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourcePolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResourcePolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResourcePolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResourcePolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourcePolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchlogs/stream/zz_controller.go b/internal/controller/cloudwatchlogs/stream/zz_controller.go index 1ce75b8ad8..f50ae8d638 100755 --- a/internal/controller/cloudwatchlogs/stream/zz_controller.go +++ b/internal/controller/cloudwatchlogs/stream/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Stream_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_stream"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stream_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_stream"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stream_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Stream + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Stream{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Stream") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Stream_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cloudwatchlogs/subscriptionfilter/zz_controller.go b/internal/controller/cloudwatchlogs/subscriptionfilter/zz_controller.go index 45a850e716..8011add4f4 100755 --- a/internal/controller/cloudwatchlogs/subscriptionfilter/zz_controller.go +++ b/internal/controller/cloudwatchlogs/subscriptionfilter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cloudwatchlogs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubscriptionFilter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_subscription_filter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubscriptionFilter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cloudwatch_log_subscription_filter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubscriptionFilter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SubscriptionFilter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SubscriptionFilter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SubscriptionFilter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubscriptionFilter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/codecommit/approvalruletemplate/zz_controller.go b/internal/controller/codecommit/approvalruletemplate/zz_controller.go index d69a5f6f57..b4b254dd4f 100755 --- a/internal/controller/codecommit/approvalruletemplate/zz_controller.go +++ b/internal/controller/codecommit/approvalruletemplate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/codecommit/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ApprovalRuleTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codecommit_approval_rule_template"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ApprovalRuleTemplate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codecommit_approval_rule_template"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ApprovalRuleTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ApprovalRuleTemplate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ApprovalRuleTemplate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ApprovalRuleTemplate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApprovalRuleTemplate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/codecommit/approvalruletemplateassociation/zz_controller.go b/internal/controller/codecommit/approvalruletemplateassociation/zz_controller.go index 8172c80820..d8b902e714 100755 --- a/internal/controller/codecommit/approvalruletemplateassociation/zz_controller.go +++ b/internal/controller/codecommit/approvalruletemplateassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/codecommit/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ApprovalRuleTemplateAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codecommit_approval_rule_template_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ApprovalRuleTemplateAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codecommit_approval_rule_template_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ApprovalRuleTemplateAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ApprovalRuleTemplateAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ApprovalRuleTemplateAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ApprovalRuleTemplateAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApprovalRuleTemplateAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/codecommit/repository/zz_controller.go b/internal/controller/codecommit/repository/zz_controller.go index a4ae171747..3eabc63c39 100755 --- a/internal/controller/codecommit/repository/zz_controller.go +++ b/internal/controller/codecommit/repository/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/codecommit/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Repository_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codecommit_repository"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Repository_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codecommit_repository"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Repository_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Repository + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Repository{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Repository") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Repository_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/codecommit/trigger/zz_controller.go b/internal/controller/codecommit/trigger/zz_controller.go index b146dd7e8e..968ed8d8f1 100755 --- a/internal/controller/codecommit/trigger/zz_controller.go +++ b/internal/controller/codecommit/trigger/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/codecommit/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Trigger_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codecommit_trigger"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Trigger_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codecommit_trigger"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Trigger_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Trigger + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Trigger{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Trigger") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Trigger_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/codepipeline/codepipeline/zz_controller.go b/internal/controller/codepipeline/codepipeline/zz_controller.go index 7d90447bbb..a2c1ef7046 100755 --- a/internal/controller/codepipeline/codepipeline/zz_controller.go +++ b/internal/controller/codepipeline/codepipeline/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/codepipeline/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Codepipeline_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codepipeline"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Codepipeline_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codepipeline"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Codepipeline_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Codepipeline + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Codepipeline{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Codepipeline") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Codepipeline_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/codepipeline/customactiontype/zz_controller.go b/internal/controller/codepipeline/customactiontype/zz_controller.go index 2c127d917b..eda97df104 100755 --- a/internal/controller/codepipeline/customactiontype/zz_controller.go +++ b/internal/controller/codepipeline/customactiontype/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/codepipeline/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CustomActionType_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codepipeline_custom_action_type"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomActionType_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codepipeline_custom_action_type"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomActionType_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CustomActionType + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CustomActionType{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CustomActionType") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CustomActionType_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/codepipeline/webhook/zz_controller.go b/internal/controller/codepipeline/webhook/zz_controller.go index 00e39ba989..38af26644e 100755 --- a/internal/controller/codepipeline/webhook/zz_controller.go +++ b/internal/controller/codepipeline/webhook/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/codepipeline/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Webhook_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codepipeline_webhook"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Webhook_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codepipeline_webhook"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Webhook_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Webhook + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Webhook{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Webhook") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Webhook_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/codestarconnections/connection/zz_controller.go b/internal/controller/codestarconnections/connection/zz_controller.go index 44e5692c98..7cd785b15f 100755 --- a/internal/controller/codestarconnections/connection/zz_controller.go +++ b/internal/controller/codestarconnections/connection/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/codestarconnections/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codestarconnections_connection"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codestarconnections_connection"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Connection + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Connection{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Connection") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/codestarconnections/host/zz_controller.go b/internal/controller/codestarconnections/host/zz_controller.go index 5482c2b5a4..791ce469c6 100755 --- a/internal/controller/codestarconnections/host/zz_controller.go +++ b/internal/controller/codestarconnections/host/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/codestarconnections/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Host_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codestarconnections_host"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Host_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codestarconnections_host"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Host_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Host + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Host{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Host") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Host_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/codestarnotifications/notificationrule/zz_controller.go b/internal/controller/codestarnotifications/notificationrule/zz_controller.go index 7f7e452e2d..0e2a038cf3 100755 --- a/internal/controller/codestarnotifications/notificationrule/zz_controller.go +++ b/internal/controller/codestarnotifications/notificationrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/codestarnotifications/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NotificationRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codestarnotifications_notification_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NotificationRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codestarnotifications_notification_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NotificationRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NotificationRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NotificationRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NotificationRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NotificationRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidentity/cognitoidentitypoolproviderprincipaltag/zz_controller.go b/internal/controller/cognitoidentity/cognitoidentitypoolproviderprincipaltag/zz_controller.go index d48537671a..c8d0ed3c80 100755 --- a/internal/controller/cognitoidentity/cognitoidentitypoolproviderprincipaltag/zz_controller.go +++ b/internal/controller/cognitoidentity/cognitoidentitypoolproviderprincipaltag/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidentity/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CognitoIdentityPoolProviderPrincipalTag_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_identity_pool_provider_principal_tag"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CognitoIdentityPoolProviderPrincipalTag_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_identity_pool_provider_principal_tag"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CognitoIdentityPoolProviderPrincipalTag_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CognitoIdentityPoolProviderPrincipalTag + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CognitoIdentityPoolProviderPrincipalTag{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CognitoIdentityPoolProviderPrincipalTag") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CognitoIdentityPoolProviderPrincipalTag_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidentity/pool/zz_controller.go b/internal/controller/cognitoidentity/pool/zz_controller.go index 1cf71386bc..6a4290cdf3 100755 --- a/internal/controller/cognitoidentity/pool/zz_controller.go +++ b/internal/controller/cognitoidentity/pool/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidentity/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Pool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_identity_pool"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Pool_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_identity_pool"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Pool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Pool + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Pool{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Pool") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Pool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidentity/poolrolesattachment/zz_controller.go b/internal/controller/cognitoidentity/poolrolesattachment/zz_controller.go index ab2a5f228b..ad0c10831f 100755 --- a/internal/controller/cognitoidentity/poolrolesattachment/zz_controller.go +++ b/internal/controller/cognitoidentity/poolrolesattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidentity/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PoolRolesAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_identity_pool_roles_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PoolRolesAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_identity_pool_roles_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PoolRolesAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PoolRolesAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PoolRolesAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PoolRolesAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PoolRolesAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidp/identityprovider/zz_controller.go b/internal/controller/cognitoidp/identityprovider/zz_controller.go index c730296e23..e8165bfd15 100755 --- a/internal/controller/cognitoidp/identityprovider/zz_controller.go +++ b/internal/controller/cognitoidp/identityprovider/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IdentityProvider_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_identity_provider"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IdentityProvider_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_identity_provider"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IdentityProvider_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.IdentityProvider + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.IdentityProvider{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.IdentityProvider") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IdentityProvider_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidp/resourceserver/zz_controller.go b/internal/controller/cognitoidp/resourceserver/zz_controller.go index 20d66bf4fc..7a62ead69d 100755 --- a/internal/controller/cognitoidp/resourceserver/zz_controller.go +++ b/internal/controller/cognitoidp/resourceserver/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourceServer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_resource_server"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceServer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_resource_server"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceServer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResourceServer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResourceServer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResourceServer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourceServer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidp/riskconfiguration/zz_controller.go b/internal/controller/cognitoidp/riskconfiguration/zz_controller.go index 61b44878c5..ed9ebe8a3c 100755 --- a/internal/controller/cognitoidp/riskconfiguration/zz_controller.go +++ b/internal/controller/cognitoidp/riskconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RiskConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_risk_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RiskConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_risk_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RiskConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RiskConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RiskConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RiskConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RiskConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidp/user/zz_controller.go b/internal/controller/cognitoidp/user/zz_controller.go index b7750afade..a112071b1b 100755 --- a/internal/controller/cognitoidp/user/zz_controller.go +++ b/internal/controller/cognitoidp/user/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.User + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.User{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.User") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidp/usergroup/zz_controller.go b/internal/controller/cognitoidp/usergroup/zz_controller.go index 620a809603..ed1050a1ee 100755 --- a/internal/controller/cognitoidp/usergroup/zz_controller.go +++ b/internal/controller/cognitoidp/usergroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidp/useringroup/zz_controller.go b/internal/controller/cognitoidp/useringroup/zz_controller.go index 0a11e089d2..1fa084e92b 100755 --- a/internal/controller/cognitoidp/useringroup/zz_controller.go +++ b/internal/controller/cognitoidp/useringroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserInGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user_in_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserInGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user_in_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserInGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserInGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserInGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserInGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserInGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidp/userpool/zz_controller.go b/internal/controller/cognitoidp/userpool/zz_controller.go index 9d8959138b..e3388883fc 100755 --- a/internal/controller/cognitoidp/userpool/zz_controller.go +++ b/internal/controller/cognitoidp/userpool/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user_pool"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserPool_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user_pool"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserPool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserPool + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserPool{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserPool") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserPool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidp/userpoolclient/zz_controller.go b/internal/controller/cognitoidp/userpoolclient/zz_controller.go index 20cffe9e09..5c211ca350 100755 --- a/internal/controller/cognitoidp/userpoolclient/zz_controller.go +++ b/internal/controller/cognitoidp/userpoolclient/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/terraform" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" @@ -55,6 +56,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserPoolClient + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserPoolClient{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserPoolClient") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserPoolClient_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidp/userpooldomain/zz_controller.go b/internal/controller/cognitoidp/userpooldomain/zz_controller.go index 1539d2307f..2a1cb4f65f 100755 --- a/internal/controller/cognitoidp/userpooldomain/zz_controller.go +++ b/internal/controller/cognitoidp/userpooldomain/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserPoolDomain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user_pool_domain"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserPoolDomain_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user_pool_domain"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserPoolDomain_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserPoolDomain + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserPoolDomain{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserPoolDomain") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserPoolDomain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cognitoidp/userpooluicustomization/zz_controller.go b/internal/controller/cognitoidp/userpooluicustomization/zz_controller.go index a7f8667622..f8a9b0776f 100755 --- a/internal/controller/cognitoidp/userpooluicustomization/zz_controller.go +++ b/internal/controller/cognitoidp/userpooluicustomization/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cognitoidp/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserPoolUICustomization_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user_pool_ui_customization"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserPoolUICustomization_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cognito_user_pool_ui_customization"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserPoolUICustomization_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserPoolUICustomization + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserPoolUICustomization{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserPoolUICustomization") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserPoolUICustomization_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/configservice/awsconfigurationrecorderstatus/zz_controller.go b/internal/controller/configservice/awsconfigurationrecorderstatus/zz_controller.go index 81982caf60..2e1b427d4c 100755 --- a/internal/controller/configservice/awsconfigurationrecorderstatus/zz_controller.go +++ b/internal/controller/configservice/awsconfigurationrecorderstatus/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/configservice/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AWSConfigurationRecorderStatus_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_configuration_recorder_status"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AWSConfigurationRecorderStatus_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_configuration_recorder_status"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AWSConfigurationRecorderStatus_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AWSConfigurationRecorderStatus + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AWSConfigurationRecorderStatus{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AWSConfigurationRecorderStatus") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AWSConfigurationRecorderStatus_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/configservice/configrule/zz_controller.go b/internal/controller/configservice/configrule/zz_controller.go index f7f58125af..fc96a1f8fd 100755 --- a/internal/controller/configservice/configrule/zz_controller.go +++ b/internal/controller/configservice/configrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/configservice/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConfigRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_config_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_config_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConfigRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConfigRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConfigRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConfigRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/configservice/configurationaggregator/zz_controller.go b/internal/controller/configservice/configurationaggregator/zz_controller.go index 8014efb22f..ba4d6a5f4c 100755 --- a/internal/controller/configservice/configurationaggregator/zz_controller.go +++ b/internal/controller/configservice/configurationaggregator/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/configservice/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConfigurationAggregator_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_configuration_aggregator"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationAggregator_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_configuration_aggregator"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationAggregator_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConfigurationAggregator + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConfigurationAggregator{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConfigurationAggregator") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConfigurationAggregator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/configservice/configurationrecorder/zz_controller.go b/internal/controller/configservice/configurationrecorder/zz_controller.go index 59e348bbed..cacf623265 100755 --- a/internal/controller/configservice/configurationrecorder/zz_controller.go +++ b/internal/controller/configservice/configurationrecorder/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/configservice/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConfigurationRecorder_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_configuration_recorder"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationRecorder_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_configuration_recorder"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationRecorder_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConfigurationRecorder + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConfigurationRecorder{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConfigurationRecorder") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConfigurationRecorder_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/configservice/conformancepack/zz_controller.go b/internal/controller/configservice/conformancepack/zz_controller.go index 9dd13e59b7..5d4b1ee980 100755 --- a/internal/controller/configservice/conformancepack/zz_controller.go +++ b/internal/controller/configservice/conformancepack/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/configservice/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConformancePack_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_conformance_pack"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConformancePack_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_conformance_pack"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConformancePack_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConformancePack + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConformancePack{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConformancePack") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConformancePack_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/configservice/deliverychannel/zz_controller.go b/internal/controller/configservice/deliverychannel/zz_controller.go index 873a806a1f..364b21778c 100755 --- a/internal/controller/configservice/deliverychannel/zz_controller.go +++ b/internal/controller/configservice/deliverychannel/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/configservice/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DeliveryChannel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_delivery_channel"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeliveryChannel_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_delivery_channel"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeliveryChannel_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DeliveryChannel + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DeliveryChannel{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DeliveryChannel") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DeliveryChannel_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/configservice/remediationconfiguration/zz_controller.go b/internal/controller/configservice/remediationconfiguration/zz_controller.go index e4748fbe76..a54a0f8703 100755 --- a/internal/controller/configservice/remediationconfiguration/zz_controller.go +++ b/internal/controller/configservice/remediationconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/configservice/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RemediationConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_remediation_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RemediationConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_config_remediation_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RemediationConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RemediationConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RemediationConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RemediationConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RemediationConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/botassociation/zz_controller.go b/internal/controller/connect/botassociation/zz_controller.go index 75c61ac7f0..c614892f3f 100755 --- a/internal/controller/connect/botassociation/zz_controller.go +++ b/internal/controller/connect/botassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BotAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_bot_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BotAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_bot_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BotAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BotAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BotAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BotAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/contactflow/zz_controller.go b/internal/controller/connect/contactflow/zz_controller.go index ae8204dbae..32d2bb3941 100755 --- a/internal/controller/connect/contactflow/zz_controller.go +++ b/internal/controller/connect/contactflow/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ContactFlow_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_contact_flow"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContactFlow_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_contact_flow"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContactFlow_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ContactFlow + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ContactFlow{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ContactFlow") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ContactFlow_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/contactflowmodule/zz_controller.go b/internal/controller/connect/contactflowmodule/zz_controller.go index f2af940ceb..34fc910645 100755 --- a/internal/controller/connect/contactflowmodule/zz_controller.go +++ b/internal/controller/connect/contactflowmodule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ContactFlowModule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_contact_flow_module"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContactFlowModule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_contact_flow_module"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContactFlowModule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ContactFlowModule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ContactFlowModule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ContactFlowModule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ContactFlowModule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/hoursofoperation/zz_controller.go b/internal/controller/connect/hoursofoperation/zz_controller.go index 304fcbb45a..ecb38fac3f 100755 --- a/internal/controller/connect/hoursofoperation/zz_controller.go +++ b/internal/controller/connect/hoursofoperation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HoursOfOperation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_hours_of_operation"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HoursOfOperation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_hours_of_operation"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HoursOfOperation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HoursOfOperation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HoursOfOperation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HoursOfOperation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HoursOfOperation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/instance/zz_controller.go b/internal/controller/connect/instance/zz_controller.go index ebefe866f9..cceb0b461c 100755 --- a/internal/controller/connect/instance/zz_controller.go +++ b/internal/controller/connect/instance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Instance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Instance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Instance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/instancestorageconfig/zz_controller.go b/internal/controller/connect/instancestorageconfig/zz_controller.go index 7020e64f2e..07adb7364a 100755 --- a/internal/controller/connect/instancestorageconfig/zz_controller.go +++ b/internal/controller/connect/instancestorageconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceStorageConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_instance_storage_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceStorageConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_instance_storage_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceStorageConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InstanceStorageConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InstanceStorageConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InstanceStorageConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InstanceStorageConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/lambdafunctionassociation/zz_controller.go b/internal/controller/connect/lambdafunctionassociation/zz_controller.go index f92cba5844..9e2b1c1113 100755 --- a/internal/controller/connect/lambdafunctionassociation/zz_controller.go +++ b/internal/controller/connect/lambdafunctionassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LambdaFunctionAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_lambda_function_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LambdaFunctionAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_lambda_function_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LambdaFunctionAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LambdaFunctionAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LambdaFunctionAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LambdaFunctionAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LambdaFunctionAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/phonenumber/zz_controller.go b/internal/controller/connect/phonenumber/zz_controller.go index 6312d93b32..86262973b3 100755 --- a/internal/controller/connect/phonenumber/zz_controller.go +++ b/internal/controller/connect/phonenumber/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PhoneNumber_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_phone_number"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PhoneNumber_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_phone_number"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PhoneNumber_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PhoneNumber + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PhoneNumber{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PhoneNumber") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PhoneNumber_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/queue/zz_controller.go b/internal/controller/connect/queue/zz_controller.go index ece2ed4ca3..f6d2d32c8f 100755 --- a/internal/controller/connect/queue/zz_controller.go +++ b/internal/controller/connect/queue/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Queue_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_queue"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Queue_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_queue"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Queue_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Queue + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Queue{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Queue") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Queue_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/quickconnect/zz_controller.go b/internal/controller/connect/quickconnect/zz_controller.go index 8aaf474e7d..398a9dbb56 100755 --- a/internal/controller/connect/quickconnect/zz_controller.go +++ b/internal/controller/connect/quickconnect/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.QuickConnect_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_quick_connect"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.QuickConnect_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_quick_connect"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.QuickConnect_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.QuickConnect + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.QuickConnect{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.QuickConnect") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.QuickConnect_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/routingprofile/zz_controller.go b/internal/controller/connect/routingprofile/zz_controller.go index 25908d3ffb..97bb7b8dd5 100755 --- a/internal/controller/connect/routingprofile/zz_controller.go +++ b/internal/controller/connect/routingprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RoutingProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_routing_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RoutingProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_routing_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RoutingProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RoutingProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RoutingProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RoutingProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RoutingProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/securityprofile/zz_controller.go b/internal/controller/connect/securityprofile/zz_controller.go index 8b067c8062..fff76b91c9 100755 --- a/internal/controller/connect/securityprofile/zz_controller.go +++ b/internal/controller/connect/securityprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecurityProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_security_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecurityProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_security_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecurityProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SecurityProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SecurityProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SecurityProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/user/zz_controller.go b/internal/controller/connect/user/zz_controller.go index 3cf79828e8..8390522381 100755 --- a/internal/controller/connect/user/zz_controller.go +++ b/internal/controller/connect/user/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_user"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_user"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.User + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.User{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.User") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/userhierarchystructure/zz_controller.go b/internal/controller/connect/userhierarchystructure/zz_controller.go index b229469deb..8e5cbed86c 100755 --- a/internal/controller/connect/userhierarchystructure/zz_controller.go +++ b/internal/controller/connect/userhierarchystructure/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserHierarchyStructure_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_user_hierarchy_structure"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserHierarchyStructure_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_user_hierarchy_structure"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserHierarchyStructure_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserHierarchyStructure + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserHierarchyStructure{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserHierarchyStructure") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserHierarchyStructure_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/connect/vocabulary/zz_controller.go b/internal/controller/connect/vocabulary/zz_controller.go index c8a9b48a4a..4d268f535c 100755 --- a/internal/controller/connect/vocabulary/zz_controller.go +++ b/internal/controller/connect/vocabulary/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/connect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Vocabulary_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_vocabulary"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Vocabulary_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_connect_vocabulary"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Vocabulary_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Vocabulary + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Vocabulary{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Vocabulary") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Vocabulary_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/cur/reportdefinition/zz_controller.go b/internal/controller/cur/reportdefinition/zz_controller.go index 6cf85078ca..a2862bca8c 100755 --- a/internal/controller/cur/reportdefinition/zz_controller.go +++ b/internal/controller/cur/reportdefinition/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/cur/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReportDefinition_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cur_report_definition"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReportDefinition_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_cur_report_definition"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReportDefinition_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReportDefinition + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReportDefinition{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReportDefinition") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReportDefinition_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dataexchange/dataset/zz_controller.go b/internal/controller/dataexchange/dataset/zz_controller.go index d1fab89fae..ccf70a9079 100755 --- a/internal/controller/dataexchange/dataset/zz_controller.go +++ b/internal/controller/dataexchange/dataset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dataexchange/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DataSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dataexchange_data_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dataexchange_data_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DataSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DataSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DataSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dataexchange/revision/zz_controller.go b/internal/controller/dataexchange/revision/zz_controller.go index 4b8698846c..569e6c14cb 100755 --- a/internal/controller/dataexchange/revision/zz_controller.go +++ b/internal/controller/dataexchange/revision/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dataexchange/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Revision_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dataexchange_revision"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Revision_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dataexchange_revision"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Revision_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Revision + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Revision{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Revision") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Revision_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datapipeline/pipeline/zz_controller.go b/internal/controller/datapipeline/pipeline/zz_controller.go index 4c583165ce..c14bb918e0 100755 --- a/internal/controller/datapipeline/pipeline/zz_controller.go +++ b/internal/controller/datapipeline/pipeline/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/datapipeline/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Pipeline_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_datapipeline_pipeline"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Pipeline_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_datapipeline_pipeline"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Pipeline_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Pipeline + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Pipeline{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Pipeline") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Pipeline_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datasync/locations3/zz_controller.go b/internal/controller/datasync/locations3/zz_controller.go index d4bc19d110..23555d07d0 100755 --- a/internal/controller/datasync/locations3/zz_controller.go +++ b/internal/controller/datasync/locations3/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/datasync/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LocationS3_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_datasync_location_s3"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LocationS3_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_datasync_location_s3"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LocationS3_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LocationS3 + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LocationS3{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LocationS3") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LocationS3_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/datasync/task/zz_controller.go b/internal/controller/datasync/task/zz_controller.go index 2dc09a99e8..76519dcc79 100755 --- a/internal/controller/datasync/task/zz_controller.go +++ b/internal/controller/datasync/task/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/datasync/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Task_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_datasync_task"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Task_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_datasync_task"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Task_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Task + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Task{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Task") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Task_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dax/cluster/zz_controller.go b/internal/controller/dax/cluster/zz_controller.go index 6390a06c0d..3236f5680e 100755 --- a/internal/controller/dax/cluster/zz_controller.go +++ b/internal/controller/dax/cluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dax/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dax_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dax_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dax/parametergroup/zz_controller.go b/internal/controller/dax/parametergroup/zz_controller.go index f003cd176b..5d5cb014ca 100755 --- a/internal/controller/dax/parametergroup/zz_controller.go +++ b/internal/controller/dax/parametergroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dax/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dax_parameter_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dax_parameter_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ParameterGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ParameterGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ParameterGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dax/subnetgroup/zz_controller.go b/internal/controller/dax/subnetgroup/zz_controller.go index ae75e0056c..0b770f745c 100755 --- a/internal/controller/dax/subnetgroup/zz_controller.go +++ b/internal/controller/dax/subnetgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dax/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dax_subnet_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dax_subnet_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SubnetGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SubnetGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SubnetGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/deploy/app/zz_controller.go b/internal/controller/deploy/app/zz_controller.go index 43930072a2..c96aa715fb 100755 --- a/internal/controller/deploy/app/zz_controller.go +++ b/internal/controller/deploy/app/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/deploy/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.App_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codedeploy_app"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.App_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codedeploy_app"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.App_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.App + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.App{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.App") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.App_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/deploy/deploymentconfig/zz_controller.go b/internal/controller/deploy/deploymentconfig/zz_controller.go index a5ccf6dc56..5c14998aa0 100755 --- a/internal/controller/deploy/deploymentconfig/zz_controller.go +++ b/internal/controller/deploy/deploymentconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/deploy/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DeploymentConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codedeploy_deployment_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeploymentConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codedeploy_deployment_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeploymentConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DeploymentConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DeploymentConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DeploymentConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DeploymentConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/deploy/deploymentgroup/zz_controller.go b/internal/controller/deploy/deploymentgroup/zz_controller.go index b8dfe4fed6..fd1ef83ba4 100755 --- a/internal/controller/deploy/deploymentgroup/zz_controller.go +++ b/internal/controller/deploy/deploymentgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/deploy/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DeploymentGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codedeploy_deployment_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeploymentGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_codedeploy_deployment_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeploymentGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DeploymentGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DeploymentGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DeploymentGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DeploymentGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/detective/graph/zz_controller.go b/internal/controller/detective/graph/zz_controller.go index 75463cc913..da87079359 100755 --- a/internal/controller/detective/graph/zz_controller.go +++ b/internal/controller/detective/graph/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/detective/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Graph_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_detective_graph"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Graph_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_detective_graph"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Graph_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Graph + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Graph{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Graph") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Graph_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/detective/invitationaccepter/zz_controller.go b/internal/controller/detective/invitationaccepter/zz_controller.go index 13584e7ec8..eaaa2371eb 100755 --- a/internal/controller/detective/invitationaccepter/zz_controller.go +++ b/internal/controller/detective/invitationaccepter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/detective/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InvitationAccepter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_detective_invitation_accepter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InvitationAccepter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_detective_invitation_accepter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InvitationAccepter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InvitationAccepter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InvitationAccepter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InvitationAccepter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InvitationAccepter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/detective/member/zz_controller.go b/internal/controller/detective/member/zz_controller.go index 68f3e786bb..6a2ceff4bd 100755 --- a/internal/controller/detective/member/zz_controller.go +++ b/internal/controller/detective/member/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/detective/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_detective_member"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Member_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_detective_member"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Member_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Member + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Member{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Member") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devicefarm/devicepool/zz_controller.go b/internal/controller/devicefarm/devicepool/zz_controller.go index fb4e75391b..f72aaca075 100755 --- a/internal/controller/devicefarm/devicepool/zz_controller.go +++ b/internal/controller/devicefarm/devicepool/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/devicefarm/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DevicePool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_device_pool"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DevicePool_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_device_pool"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DevicePool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DevicePool + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DevicePool{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DevicePool") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DevicePool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devicefarm/instanceprofile/zz_controller.go b/internal/controller/devicefarm/instanceprofile/zz_controller.go index d5cf46ce0d..2c98820617 100755 --- a/internal/controller/devicefarm/instanceprofile/zz_controller.go +++ b/internal/controller/devicefarm/instanceprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/devicefarm/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_instance_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_instance_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InstanceProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InstanceProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InstanceProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InstanceProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devicefarm/networkprofile/zz_controller.go b/internal/controller/devicefarm/networkprofile/zz_controller.go index ee9f367eae..9313511e4d 100755 --- a/internal/controller/devicefarm/networkprofile/zz_controller.go +++ b/internal/controller/devicefarm/networkprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/devicefarm/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_network_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_network_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NetworkProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NetworkProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NetworkProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devicefarm/project/zz_controller.go b/internal/controller/devicefarm/project/zz_controller.go index 9287de432e..5fb0c2d78d 100755 --- a/internal/controller/devicefarm/project/zz_controller.go +++ b/internal/controller/devicefarm/project/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/devicefarm/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Project_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_project"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Project_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_project"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Project_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Project + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Project{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Project") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Project_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devicefarm/testgridproject/zz_controller.go b/internal/controller/devicefarm/testgridproject/zz_controller.go index b8c01423d0..0bf44eff1e 100755 --- a/internal/controller/devicefarm/testgridproject/zz_controller.go +++ b/internal/controller/devicefarm/testgridproject/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/devicefarm/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TestGridProject_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_test_grid_project"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TestGridProject_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_test_grid_project"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TestGridProject_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TestGridProject + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TestGridProject{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TestGridProject") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TestGridProject_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/devicefarm/upload/zz_controller.go b/internal/controller/devicefarm/upload/zz_controller.go index 20ce5a9fe9..d1acd3d76d 100755 --- a/internal/controller/devicefarm/upload/zz_controller.go +++ b/internal/controller/devicefarm/upload/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/devicefarm/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Upload_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_upload"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Upload_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_devicefarm_upload"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Upload_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Upload + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Upload{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Upload") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Upload_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/bgppeer/zz_controller.go b/internal/controller/directconnect/bgppeer/zz_controller.go index ef51cbf497..19e25164bb 100755 --- a/internal/controller/directconnect/bgppeer/zz_controller.go +++ b/internal/controller/directconnect/bgppeer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BGPPeer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_bgp_peer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BGPPeer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_bgp_peer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BGPPeer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BGPPeer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BGPPeer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BGPPeer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BGPPeer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/connection/zz_controller.go b/internal/controller/directconnect/connection/zz_controller.go index 38aa3c3858..094f32232e 100755 --- a/internal/controller/directconnect/connection/zz_controller.go +++ b/internal/controller/directconnect/connection/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_connection"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_connection"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Connection + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Connection{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Connection") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/connectionassociation/zz_controller.go b/internal/controller/directconnect/connectionassociation/zz_controller.go index a6425509df..eb3e5d9c8a 100755 --- a/internal/controller/directconnect/connectionassociation/zz_controller.go +++ b/internal/controller/directconnect/connectionassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConnectionAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_connection_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConnectionAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_connection_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConnectionAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConnectionAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConnectionAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConnectionAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConnectionAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/gateway/zz_controller.go b/internal/controller/directconnect/gateway/zz_controller.go index b9ba703e14..3cf2d91478 100755 --- a/internal/controller/directconnect/gateway/zz_controller.go +++ b/internal/controller/directconnect/gateway/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Gateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_gateway"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Gateway_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_gateway"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Gateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Gateway + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Gateway{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Gateway") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Gateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/gatewayassociation/zz_controller.go b/internal/controller/directconnect/gatewayassociation/zz_controller.go index f72e840e0f..0392da8685 100755 --- a/internal/controller/directconnect/gatewayassociation/zz_controller.go +++ b/internal/controller/directconnect/gatewayassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GatewayAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_gateway_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GatewayAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_gateway_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GatewayAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GatewayAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GatewayAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GatewayAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GatewayAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/gatewayassociationproposal/zz_controller.go b/internal/controller/directconnect/gatewayassociationproposal/zz_controller.go index aa4c61fdcb..cc2fb8a1f1 100755 --- a/internal/controller/directconnect/gatewayassociationproposal/zz_controller.go +++ b/internal/controller/directconnect/gatewayassociationproposal/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GatewayAssociationProposal_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_gateway_association_proposal"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GatewayAssociationProposal_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_gateway_association_proposal"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GatewayAssociationProposal_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GatewayAssociationProposal + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GatewayAssociationProposal{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GatewayAssociationProposal") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GatewayAssociationProposal_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/hostedprivatevirtualinterface/zz_controller.go b/internal/controller/directconnect/hostedprivatevirtualinterface/zz_controller.go index 34e44fb2eb..d115390377 100755 --- a/internal/controller/directconnect/hostedprivatevirtualinterface/zz_controller.go +++ b/internal/controller/directconnect/hostedprivatevirtualinterface/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HostedPrivateVirtualInterface_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_private_virtual_interface"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedPrivateVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_private_virtual_interface"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedPrivateVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HostedPrivateVirtualInterface + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HostedPrivateVirtualInterface{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HostedPrivateVirtualInterface") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HostedPrivateVirtualInterface_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/hostedprivatevirtualinterfaceaccepter/zz_controller.go b/internal/controller/directconnect/hostedprivatevirtualinterfaceaccepter/zz_controller.go index adfdae029a..5477dab8f5 100755 --- a/internal/controller/directconnect/hostedprivatevirtualinterfaceaccepter/zz_controller.go +++ b/internal/controller/directconnect/hostedprivatevirtualinterfaceaccepter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HostedPrivateVirtualInterfaceAccepter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_private_virtual_interface_accepter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedPrivateVirtualInterfaceAccepter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_private_virtual_interface_accepter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedPrivateVirtualInterfaceAccepter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HostedPrivateVirtualInterfaceAccepter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HostedPrivateVirtualInterfaceAccepter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HostedPrivateVirtualInterfaceAccepter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HostedPrivateVirtualInterfaceAccepter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/hostedpublicvirtualinterface/zz_controller.go b/internal/controller/directconnect/hostedpublicvirtualinterface/zz_controller.go index f342020257..dc849d6431 100755 --- a/internal/controller/directconnect/hostedpublicvirtualinterface/zz_controller.go +++ b/internal/controller/directconnect/hostedpublicvirtualinterface/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HostedPublicVirtualInterface_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_public_virtual_interface"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedPublicVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_public_virtual_interface"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedPublicVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HostedPublicVirtualInterface + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HostedPublicVirtualInterface{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HostedPublicVirtualInterface") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HostedPublicVirtualInterface_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/hostedpublicvirtualinterfaceaccepter/zz_controller.go b/internal/controller/directconnect/hostedpublicvirtualinterfaceaccepter/zz_controller.go index 5b5a0aa407..44219ccc5f 100755 --- a/internal/controller/directconnect/hostedpublicvirtualinterfaceaccepter/zz_controller.go +++ b/internal/controller/directconnect/hostedpublicvirtualinterfaceaccepter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HostedPublicVirtualInterfaceAccepter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_public_virtual_interface_accepter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedPublicVirtualInterfaceAccepter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_public_virtual_interface_accepter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedPublicVirtualInterfaceAccepter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HostedPublicVirtualInterfaceAccepter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HostedPublicVirtualInterfaceAccepter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HostedPublicVirtualInterfaceAccepter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HostedPublicVirtualInterfaceAccepter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/hostedtransitvirtualinterface/zz_controller.go b/internal/controller/directconnect/hostedtransitvirtualinterface/zz_controller.go index 5c3a4e4ad4..0a990a1ed8 100755 --- a/internal/controller/directconnect/hostedtransitvirtualinterface/zz_controller.go +++ b/internal/controller/directconnect/hostedtransitvirtualinterface/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HostedTransitVirtualInterface_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_transit_virtual_interface"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedTransitVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_transit_virtual_interface"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedTransitVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HostedTransitVirtualInterface + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HostedTransitVirtualInterface{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HostedTransitVirtualInterface") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HostedTransitVirtualInterface_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/hostedtransitvirtualinterfaceaccepter/zz_controller.go b/internal/controller/directconnect/hostedtransitvirtualinterfaceaccepter/zz_controller.go index 233a169f77..bc4327da91 100755 --- a/internal/controller/directconnect/hostedtransitvirtualinterfaceaccepter/zz_controller.go +++ b/internal/controller/directconnect/hostedtransitvirtualinterfaceaccepter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HostedTransitVirtualInterfaceAccepter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_transit_virtual_interface_accepter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedTransitVirtualInterfaceAccepter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_hosted_transit_virtual_interface_accepter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedTransitVirtualInterfaceAccepter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HostedTransitVirtualInterfaceAccepter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HostedTransitVirtualInterfaceAccepter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HostedTransitVirtualInterfaceAccepter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HostedTransitVirtualInterfaceAccepter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/lag/zz_controller.go b/internal/controller/directconnect/lag/zz_controller.go index 8abb58ac7c..4b0af04ba3 100755 --- a/internal/controller/directconnect/lag/zz_controller.go +++ b/internal/controller/directconnect/lag/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Lag_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_lag"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Lag_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_lag"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Lag_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Lag + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Lag{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Lag") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Lag_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/privatevirtualinterface/zz_controller.go b/internal/controller/directconnect/privatevirtualinterface/zz_controller.go index 04e4b616e0..1557c01715 100755 --- a/internal/controller/directconnect/privatevirtualinterface/zz_controller.go +++ b/internal/controller/directconnect/privatevirtualinterface/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PrivateVirtualInterface_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_private_virtual_interface"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PrivateVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_private_virtual_interface"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PrivateVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PrivateVirtualInterface + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PrivateVirtualInterface{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PrivateVirtualInterface") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateVirtualInterface_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/publicvirtualinterface/zz_controller.go b/internal/controller/directconnect/publicvirtualinterface/zz_controller.go index 000c929173..1a0ef97faf 100755 --- a/internal/controller/directconnect/publicvirtualinterface/zz_controller.go +++ b/internal/controller/directconnect/publicvirtualinterface/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PublicVirtualInterface_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_public_virtual_interface"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PublicVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_public_virtual_interface"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PublicVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PublicVirtualInterface + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PublicVirtualInterface{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PublicVirtualInterface") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PublicVirtualInterface_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/directconnect/transitvirtualinterface/zz_controller.go b/internal/controller/directconnect/transitvirtualinterface/zz_controller.go index 43e5f9733b..fc176ad5c6 100755 --- a/internal/controller/directconnect/transitvirtualinterface/zz_controller.go +++ b/internal/controller/directconnect/transitvirtualinterface/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/directconnect/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitVirtualInterface_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_transit_virtual_interface"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dx_transit_virtual_interface"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitVirtualInterface_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitVirtualInterface + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitVirtualInterface{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitVirtualInterface") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitVirtualInterface_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dlm/lifecyclepolicy/zz_controller.go b/internal/controller/dlm/lifecyclepolicy/zz_controller.go index 6b5421001d..8527956c47 100755 --- a/internal/controller/dlm/lifecyclepolicy/zz_controller.go +++ b/internal/controller/dlm/lifecyclepolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dlm/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LifecyclePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dlm_lifecycle_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LifecyclePolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dlm_lifecycle_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LifecyclePolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LifecyclePolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LifecyclePolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LifecyclePolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LifecyclePolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dms/certificate/zz_controller.go b/internal/controller/dms/certificate/zz_controller.go index 6a15926a77..db5d40bcac 100755 --- a/internal/controller/dms/certificate/zz_controller.go +++ b/internal/controller/dms/certificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dms/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Certificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Certificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Certificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dms/endpoint/zz_controller.go b/internal/controller/dms/endpoint/zz_controller.go index 5278814c57..d1bfd5de12 100755 --- a/internal/controller/dms/endpoint/zz_controller.go +++ b/internal/controller/dms/endpoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dms/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Endpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_endpoint"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Endpoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_endpoint"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Endpoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Endpoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Endpoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Endpoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Endpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dms/eventsubscription/zz_controller.go b/internal/controller/dms/eventsubscription/zz_controller.go index ea5c2659e2..3a67df2d64 100755 --- a/internal/controller/dms/eventsubscription/zz_controller.go +++ b/internal/controller/dms/eventsubscription/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dms/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EventSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_event_subscription"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSubscription_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_event_subscription"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EventSubscription + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EventSubscription{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EventSubscription") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dms/replicationinstance/zz_controller.go b/internal/controller/dms/replicationinstance/zz_controller.go index ba7273a74a..ada657fa47 100755 --- a/internal/controller/dms/replicationinstance/zz_controller.go +++ b/internal/controller/dms/replicationinstance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dms/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReplicationInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_replication_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationInstance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_replication_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationInstance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReplicationInstance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReplicationInstance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReplicationInstance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReplicationInstance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dms/replicationsubnetgroup/zz_controller.go b/internal/controller/dms/replicationsubnetgroup/zz_controller.go index fd25f448d7..d4d35130bb 100755 --- a/internal/controller/dms/replicationsubnetgroup/zz_controller.go +++ b/internal/controller/dms/replicationsubnetgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dms/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReplicationSubnetGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_replication_subnet_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationSubnetGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_replication_subnet_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationSubnetGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReplicationSubnetGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReplicationSubnetGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReplicationSubnetGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReplicationSubnetGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dms/replicationtask/zz_controller.go b/internal/controller/dms/replicationtask/zz_controller.go index 0607ec01b1..2cb31b6804 100755 --- a/internal/controller/dms/replicationtask/zz_controller.go +++ b/internal/controller/dms/replicationtask/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dms/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReplicationTask_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_replication_task"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationTask_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_replication_task"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationTask_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReplicationTask + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReplicationTask{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReplicationTask") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReplicationTask_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dms/s3endpoint/zz_controller.go b/internal/controller/dms/s3endpoint/zz_controller.go index a4f044ff79..44806fadee 100755 --- a/internal/controller/dms/s3endpoint/zz_controller.go +++ b/internal/controller/dms/s3endpoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dms/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.S3Endpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_s3_endpoint"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.S3Endpoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dms_s3_endpoint"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.S3Endpoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.S3Endpoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.S3Endpoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.S3Endpoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.S3Endpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/docdb/cluster/zz_controller.go b/internal/controller/docdb/cluster/zz_controller.go index 7015728970..e2ebf2ca7f 100755 --- a/internal/controller/docdb/cluster/zz_controller.go +++ b/internal/controller/docdb/cluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/docdb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/docdb/clusterinstance/zz_controller.go b/internal/controller/docdb/clusterinstance/zz_controller.go index de2224d847..c7584591ae 100755 --- a/internal/controller/docdb/clusterinstance/zz_controller.go +++ b/internal/controller/docdb/clusterinstance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/docdb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_cluster_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterInstance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_cluster_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterInstance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterInstance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterInstance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterInstance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterInstance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/docdb/clusterparametergroup/zz_controller.go b/internal/controller/docdb/clusterparametergroup/zz_controller.go index 4bf82f1d0c..edbae70ff7 100755 --- a/internal/controller/docdb/clusterparametergroup/zz_controller.go +++ b/internal/controller/docdb/clusterparametergroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/docdb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterParameterGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_cluster_parameter_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterParameterGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_cluster_parameter_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterParameterGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterParameterGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterParameterGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterParameterGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterParameterGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/docdb/clustersnapshot/zz_controller.go b/internal/controller/docdb/clustersnapshot/zz_controller.go index c3a9c8ea5b..c90531ca34 100755 --- a/internal/controller/docdb/clustersnapshot/zz_controller.go +++ b/internal/controller/docdb/clustersnapshot/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/docdb/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterSnapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_cluster_snapshot"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterSnapshot_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_cluster_snapshot"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterSnapshot_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterSnapshot + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterSnapshot{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterSnapshot") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterSnapshot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/docdb/eventsubscription/zz_controller.go b/internal/controller/docdb/eventsubscription/zz_controller.go index 5295299cf7..8d25f275f3 100755 --- a/internal/controller/docdb/eventsubscription/zz_controller.go +++ b/internal/controller/docdb/eventsubscription/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/docdb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EventSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_event_subscription"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSubscription_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_event_subscription"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EventSubscription + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EventSubscription{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EventSubscription") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/docdb/globalcluster/zz_controller.go b/internal/controller/docdb/globalcluster/zz_controller.go index 03bc36a7b6..eaccba51e5 100755 --- a/internal/controller/docdb/globalcluster/zz_controller.go +++ b/internal/controller/docdb/globalcluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/docdb/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalCluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_global_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalCluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_global_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalCluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GlobalCluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GlobalCluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GlobalCluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GlobalCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/docdb/subnetgroup/zz_controller.go b/internal/controller/docdb/subnetgroup/zz_controller.go index 43bab538a6..ee96690c5d 100755 --- a/internal/controller/docdb/subnetgroup/zz_controller.go +++ b/internal/controller/docdb/subnetgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/docdb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_subnet_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_docdb_subnet_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SubnetGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SubnetGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SubnetGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ds/conditionalforwarder/zz_controller.go b/internal/controller/ds/conditionalforwarder/zz_controller.go index 99c37620e8..c72a4862da 100755 --- a/internal/controller/ds/conditionalforwarder/zz_controller.go +++ b/internal/controller/ds/conditionalforwarder/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ds/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConditionalForwarder_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_directory_service_conditional_forwarder"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConditionalForwarder_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_directory_service_conditional_forwarder"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConditionalForwarder_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConditionalForwarder + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConditionalForwarder{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConditionalForwarder") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConditionalForwarder_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ds/directory/zz_controller.go b/internal/controller/ds/directory/zz_controller.go index fc8603f952..f2e2ae99bb 100755 --- a/internal/controller/ds/directory/zz_controller.go +++ b/internal/controller/ds/directory/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ds/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Directory_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_directory_service_directory"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Directory_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_directory_service_directory"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Directory_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Directory + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Directory{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Directory") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Directory_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ds/shareddirectory/zz_controller.go b/internal/controller/ds/shareddirectory/zz_controller.go index 36600a039f..60bb03aa2f 100755 --- a/internal/controller/ds/shareddirectory/zz_controller.go +++ b/internal/controller/ds/shareddirectory/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ds/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SharedDirectory_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_directory_service_shared_directory"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SharedDirectory_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_directory_service_shared_directory"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SharedDirectory_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SharedDirectory + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SharedDirectory{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SharedDirectory") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SharedDirectory_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dynamodb/contributorinsights/zz_controller.go b/internal/controller/dynamodb/contributorinsights/zz_controller.go index 6620a09811..3b896862b5 100755 --- a/internal/controller/dynamodb/contributorinsights/zz_controller.go +++ b/internal/controller/dynamodb/contributorinsights/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dynamodb/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ContributorInsights_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_contributor_insights"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContributorInsights_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_contributor_insights"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContributorInsights_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ContributorInsights + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ContributorInsights{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ContributorInsights") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ContributorInsights_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dynamodb/globaltable/zz_controller.go b/internal/controller/dynamodb/globaltable/zz_controller.go index d14d13d7ad..37d0132151 100755 --- a/internal/controller/dynamodb/globaltable/zz_controller.go +++ b/internal/controller/dynamodb/globaltable/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dynamodb/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalTable_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_global_table"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalTable_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_global_table"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalTable_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GlobalTable + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GlobalTable{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GlobalTable") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GlobalTable_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dynamodb/kinesisstreamingdestination/zz_controller.go b/internal/controller/dynamodb/kinesisstreamingdestination/zz_controller.go index b72dcef1f6..98472dd1a2 100755 --- a/internal/controller/dynamodb/kinesisstreamingdestination/zz_controller.go +++ b/internal/controller/dynamodb/kinesisstreamingdestination/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dynamodb/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.KinesisStreamingDestination_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_kinesis_streaming_destination"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.KinesisStreamingDestination_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_kinesis_streaming_destination"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.KinesisStreamingDestination_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.KinesisStreamingDestination + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.KinesisStreamingDestination{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.KinesisStreamingDestination") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.KinesisStreamingDestination_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dynamodb/table/zz_controller.go b/internal/controller/dynamodb/table/zz_controller.go index 816890c6f3..25d86a9097 100755 --- a/internal/controller/dynamodb/table/zz_controller.go +++ b/internal/controller/dynamodb/table/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dynamodb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Table_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_table"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Table_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_table"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Table_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Table + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Table{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Table") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Table_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dynamodb/tableitem/zz_controller.go b/internal/controller/dynamodb/tableitem/zz_controller.go index a2e99bf104..6e4140bacb 100755 --- a/internal/controller/dynamodb/tableitem/zz_controller.go +++ b/internal/controller/dynamodb/tableitem/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dynamodb/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableItem_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_table_item"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TableItem_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_table_item"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TableItem_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TableItem + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TableItem{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TableItem") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TableItem_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dynamodb/tablereplica/zz_controller.go b/internal/controller/dynamodb/tablereplica/zz_controller.go index d218af8daa..59891db2a8 100755 --- a/internal/controller/dynamodb/tablereplica/zz_controller.go +++ b/internal/controller/dynamodb/tablereplica/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dynamodb/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableReplica_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_table_replica"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TableReplica_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_table_replica"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TableReplica_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TableReplica + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TableReplica{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TableReplica") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TableReplica_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/dynamodb/tag/zz_controller.go b/internal/controller/dynamodb/tag/zz_controller.go index ff9ae48ce0..dd9690e606 100755 --- a/internal/controller/dynamodb/tag/zz_controller.go +++ b/internal/controller/dynamodb/tag/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/dynamodb/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Tag_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_tag"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Tag_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_dynamodb_tag"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Tag_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Tag + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Tag{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Tag") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Tag_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/ami/zz_controller.go b/internal/controller/ec2/ami/zz_controller.go index 3c85e105e1..343e50a546 100755 --- a/internal/controller/ec2/ami/zz_controller.go +++ b/internal/controller/ec2/ami/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AMI_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ami"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AMI_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ami"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AMI_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AMI + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AMI{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AMI") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AMI_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/amicopy/zz_controller.go b/internal/controller/ec2/amicopy/zz_controller.go index bfe8e42b65..346fac1e44 100755 --- a/internal/controller/ec2/amicopy/zz_controller.go +++ b/internal/controller/ec2/amicopy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AMICopy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ami_copy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AMICopy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ami_copy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AMICopy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AMICopy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AMICopy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AMICopy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AMICopy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/amilaunchpermission/zz_controller.go b/internal/controller/ec2/amilaunchpermission/zz_controller.go index 4ddeb7b1a9..28bf7d9514 100755 --- a/internal/controller/ec2/amilaunchpermission/zz_controller.go +++ b/internal/controller/ec2/amilaunchpermission/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AMILaunchPermission_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ami_launch_permission"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AMILaunchPermission_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ami_launch_permission"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AMILaunchPermission_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AMILaunchPermission + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AMILaunchPermission{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AMILaunchPermission") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AMILaunchPermission_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/availabilityzonegroup/zz_controller.go b/internal/controller/ec2/availabilityzonegroup/zz_controller.go index dc5278341f..41ecd132eb 100755 --- a/internal/controller/ec2/availabilityzonegroup/zz_controller.go +++ b/internal/controller/ec2/availabilityzonegroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AvailabilityZoneGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_availability_zone_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AvailabilityZoneGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_availability_zone_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AvailabilityZoneGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AvailabilityZoneGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AvailabilityZoneGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AvailabilityZoneGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AvailabilityZoneGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/capacityreservation/zz_controller.go b/internal/controller/ec2/capacityreservation/zz_controller.go index d50262761f..453af66a2e 100755 --- a/internal/controller/ec2/capacityreservation/zz_controller.go +++ b/internal/controller/ec2/capacityreservation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CapacityReservation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_capacity_reservation"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CapacityReservation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_capacity_reservation"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CapacityReservation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CapacityReservation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CapacityReservation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CapacityReservation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CapacityReservation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/carriergateway/zz_controller.go b/internal/controller/ec2/carriergateway/zz_controller.go index 338b32af40..a40bbb21c2 100755 --- a/internal/controller/ec2/carriergateway/zz_controller.go +++ b/internal/controller/ec2/carriergateway/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CarrierGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_carrier_gateway"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CarrierGateway_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_carrier_gateway"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CarrierGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CarrierGateway + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CarrierGateway{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CarrierGateway") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CarrierGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/customergateway/zz_controller.go b/internal/controller/ec2/customergateway/zz_controller.go index 08b7080011..16f10bc652 100755 --- a/internal/controller/ec2/customergateway/zz_controller.go +++ b/internal/controller/ec2/customergateway/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CustomerGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_customer_gateway"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomerGateway_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_customer_gateway"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomerGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CustomerGateway + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CustomerGateway{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CustomerGateway") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CustomerGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/defaultnetworkacl/zz_controller.go b/internal/controller/ec2/defaultnetworkacl/zz_controller.go index 8efeb7bb39..f6216afd24 100755 --- a/internal/controller/ec2/defaultnetworkacl/zz_controller.go +++ b/internal/controller/ec2/defaultnetworkacl/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultNetworkACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_network_acl"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultNetworkACL_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_network_acl"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultNetworkACL_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DefaultNetworkACL + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DefaultNetworkACL{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DefaultNetworkACL") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DefaultNetworkACL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/defaultroutetable/zz_controller.go b/internal/controller/ec2/defaultroutetable/zz_controller.go index e020ac181e..fa42b95497 100755 --- a/internal/controller/ec2/defaultroutetable/zz_controller.go +++ b/internal/controller/ec2/defaultroutetable/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultRouteTable_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_route_table"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultRouteTable_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_route_table"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultRouteTable_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DefaultRouteTable + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DefaultRouteTable{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DefaultRouteTable") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DefaultRouteTable_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/defaultsecuritygroup/zz_controller.go b/internal/controller/ec2/defaultsecuritygroup/zz_controller.go index d29d3552b0..690a8a988c 100755 --- a/internal/controller/ec2/defaultsecuritygroup/zz_controller.go +++ b/internal/controller/ec2/defaultsecuritygroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultSecurityGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_security_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultSecurityGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_security_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultSecurityGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DefaultSecurityGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DefaultSecurityGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DefaultSecurityGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DefaultSecurityGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/defaultsubnet/zz_controller.go b/internal/controller/ec2/defaultsubnet/zz_controller.go index 803b379fd5..097512a66d 100755 --- a/internal/controller/ec2/defaultsubnet/zz_controller.go +++ b/internal/controller/ec2/defaultsubnet/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultSubnet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_subnet"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultSubnet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_subnet"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultSubnet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DefaultSubnet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DefaultSubnet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DefaultSubnet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DefaultSubnet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/defaultvpc/zz_controller.go b/internal/controller/ec2/defaultvpc/zz_controller.go index 9d39ecf004..9deff018dd 100755 --- a/internal/controller/ec2/defaultvpc/zz_controller.go +++ b/internal/controller/ec2/defaultvpc/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultVPC_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_vpc"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultVPC_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_vpc"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultVPC_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DefaultVPC + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DefaultVPC{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DefaultVPC") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DefaultVPC_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/defaultvpcdhcpoptions/zz_controller.go b/internal/controller/ec2/defaultvpcdhcpoptions/zz_controller.go index 578eefcd44..0362e2d5a9 100755 --- a/internal/controller/ec2/defaultvpcdhcpoptions/zz_controller.go +++ b/internal/controller/ec2/defaultvpcdhcpoptions/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultVPCDHCPOptions_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_vpc_dhcp_options"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultVPCDHCPOptions_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_default_vpc_dhcp_options"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultVPCDHCPOptions_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DefaultVPCDHCPOptions + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DefaultVPCDHCPOptions{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DefaultVPCDHCPOptions") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DefaultVPCDHCPOptions_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/ebsdefaultkmskey/zz_controller.go b/internal/controller/ec2/ebsdefaultkmskey/zz_controller.go index e18c8da102..fc1014e8e5 100755 --- a/internal/controller/ec2/ebsdefaultkmskey/zz_controller.go +++ b/internal/controller/ec2/ebsdefaultkmskey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EBSDefaultKMSKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_default_kms_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSDefaultKMSKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_default_kms_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSDefaultKMSKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EBSDefaultKMSKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EBSDefaultKMSKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EBSDefaultKMSKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EBSDefaultKMSKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/ebsencryptionbydefault/zz_controller.go b/internal/controller/ec2/ebsencryptionbydefault/zz_controller.go index 18345a783d..986a7d52de 100755 --- a/internal/controller/ec2/ebsencryptionbydefault/zz_controller.go +++ b/internal/controller/ec2/ebsencryptionbydefault/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EBSEncryptionByDefault_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_encryption_by_default"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSEncryptionByDefault_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_encryption_by_default"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSEncryptionByDefault_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EBSEncryptionByDefault + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EBSEncryptionByDefault{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EBSEncryptionByDefault") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EBSEncryptionByDefault_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/ebssnapshot/zz_controller.go b/internal/controller/ec2/ebssnapshot/zz_controller.go index 849a6390b3..789e566330 100755 --- a/internal/controller/ec2/ebssnapshot/zz_controller.go +++ b/internal/controller/ec2/ebssnapshot/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EBSSnapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_snapshot"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSSnapshot_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_snapshot"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSSnapshot_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EBSSnapshot + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EBSSnapshot{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EBSSnapshot") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EBSSnapshot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/ebssnapshotcopy/zz_controller.go b/internal/controller/ec2/ebssnapshotcopy/zz_controller.go index 16454d95e7..385598d8b3 100755 --- a/internal/controller/ec2/ebssnapshotcopy/zz_controller.go +++ b/internal/controller/ec2/ebssnapshotcopy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EBSSnapshotCopy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_snapshot_copy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSSnapshotCopy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_snapshot_copy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSSnapshotCopy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EBSSnapshotCopy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EBSSnapshotCopy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EBSSnapshotCopy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EBSSnapshotCopy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/ebssnapshotimport/zz_controller.go b/internal/controller/ec2/ebssnapshotimport/zz_controller.go index f76f36850f..57a4cbaf54 100755 --- a/internal/controller/ec2/ebssnapshotimport/zz_controller.go +++ b/internal/controller/ec2/ebssnapshotimport/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EBSSnapshotImport_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_snapshot_import"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSSnapshotImport_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_snapshot_import"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSSnapshotImport_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EBSSnapshotImport + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EBSSnapshotImport{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EBSSnapshotImport") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EBSSnapshotImport_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/ebsvolume/zz_controller.go b/internal/controller/ec2/ebsvolume/zz_controller.go index a24873b117..96a8fc2851 100755 --- a/internal/controller/ec2/ebsvolume/zz_controller.go +++ b/internal/controller/ec2/ebsvolume/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EBSVolume_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_volume"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSVolume_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ebs_volume"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EBSVolume_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EBSVolume + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EBSVolume{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EBSVolume") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EBSVolume_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/egressonlyinternetgateway/zz_controller.go b/internal/controller/ec2/egressonlyinternetgateway/zz_controller.go index 6b080934ff..e8b5110b60 100755 --- a/internal/controller/ec2/egressonlyinternetgateway/zz_controller.go +++ b/internal/controller/ec2/egressonlyinternetgateway/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EgressOnlyInternetGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_egress_only_internet_gateway"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EgressOnlyInternetGateway_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_egress_only_internet_gateway"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EgressOnlyInternetGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EgressOnlyInternetGateway + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EgressOnlyInternetGateway{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EgressOnlyInternetGateway") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EgressOnlyInternetGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/eip/zz_controller.go b/internal/controller/ec2/eip/zz_controller.go index 103f429093..27b059b64c 100755 --- a/internal/controller/ec2/eip/zz_controller.go +++ b/internal/controller/ec2/eip/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EIP_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eip"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EIP_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eip"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EIP_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EIP + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EIP{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EIP") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EIP_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/eipassociation/zz_controller.go b/internal/controller/ec2/eipassociation/zz_controller.go index e0c8f91ef9..452c737eb9 100755 --- a/internal/controller/ec2/eipassociation/zz_controller.go +++ b/internal/controller/ec2/eipassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EIPAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eip_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EIPAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eip_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EIPAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EIPAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EIPAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EIPAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EIPAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/flowlog/zz_controller.go b/internal/controller/ec2/flowlog/zz_controller.go index eecd018760..644821650b 100755 --- a/internal/controller/ec2/flowlog/zz_controller.go +++ b/internal/controller/ec2/flowlog/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FlowLog_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_flow_log"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FlowLog_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_flow_log"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FlowLog_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FlowLog + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FlowLog{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FlowLog") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FlowLog_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/host/zz_controller.go b/internal/controller/ec2/host/zz_controller.go index 470b5c676f..495668dd0c 100755 --- a/internal/controller/ec2/host/zz_controller.go +++ b/internal/controller/ec2/host/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Host_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_host"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Host_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_host"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Host_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Host + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Host{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Host") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Host_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/instance/zz_controller.go b/internal/controller/ec2/instance/zz_controller.go index 25e8d71f5f..523ac7ecd0 100755 --- a/internal/controller/ec2/instance/zz_controller.go +++ b/internal/controller/ec2/instance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Instance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Instance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Instance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/instancestate/zz_controller.go b/internal/controller/ec2/instancestate/zz_controller.go index cf05aa457e..426069314e 100755 --- a/internal/controller/ec2/instancestate/zz_controller.go +++ b/internal/controller/ec2/instancestate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceState_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_instance_state"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceState_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_instance_state"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceState_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InstanceState + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InstanceState{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InstanceState") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InstanceState_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/internetgateway/zz_controller.go b/internal/controller/ec2/internetgateway/zz_controller.go index 9d46c16453..c9036d01e0 100755 --- a/internal/controller/ec2/internetgateway/zz_controller.go +++ b/internal/controller/ec2/internetgateway/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InternetGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_internet_gateway"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InternetGateway_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_internet_gateway"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InternetGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InternetGateway + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InternetGateway{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InternetGateway") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InternetGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/keypair/zz_controller.go b/internal/controller/ec2/keypair/zz_controller.go index 279caf22ed..cdf17d610f 100755 --- a/internal/controller/ec2/keypair/zz_controller.go +++ b/internal/controller/ec2/keypair/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.KeyPair_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_key_pair"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.KeyPair_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_key_pair"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.KeyPair_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.KeyPair + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.KeyPair{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.KeyPair") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.KeyPair_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/launchtemplate/zz_controller.go b/internal/controller/ec2/launchtemplate/zz_controller.go index 5c91b6ec1d..12105625e7 100755 --- a/internal/controller/ec2/launchtemplate/zz_controller.go +++ b/internal/controller/ec2/launchtemplate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LaunchTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_launch_template"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LaunchTemplate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_launch_template"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LaunchTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LaunchTemplate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LaunchTemplate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LaunchTemplate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LaunchTemplate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/mainroutetableassociation/zz_controller.go b/internal/controller/ec2/mainroutetableassociation/zz_controller.go index b85f596520..ee1e5557cf 100755 --- a/internal/controller/ec2/mainroutetableassociation/zz_controller.go +++ b/internal/controller/ec2/mainroutetableassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MainRouteTableAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_main_route_table_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MainRouteTableAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_main_route_table_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MainRouteTableAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MainRouteTableAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MainRouteTableAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MainRouteTableAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MainRouteTableAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/managedprefixlist/zz_controller.go b/internal/controller/ec2/managedprefixlist/zz_controller.go index 8ee59c3bd9..74e7da1bc2 100755 --- a/internal/controller/ec2/managedprefixlist/zz_controller.go +++ b/internal/controller/ec2/managedprefixlist/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ManagedPrefixList_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_managed_prefix_list"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ManagedPrefixList_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_managed_prefix_list"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ManagedPrefixList_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ManagedPrefixList + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ManagedPrefixList{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ManagedPrefixList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagedPrefixList_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/managedprefixlistentry/zz_controller.go b/internal/controller/ec2/managedprefixlistentry/zz_controller.go index 71c87e4ef0..3ac6af1d49 100755 --- a/internal/controller/ec2/managedprefixlistentry/zz_controller.go +++ b/internal/controller/ec2/managedprefixlistentry/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ManagedPrefixListEntry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_managed_prefix_list_entry"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ManagedPrefixListEntry_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_managed_prefix_list_entry"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ManagedPrefixListEntry_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ManagedPrefixListEntry + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ManagedPrefixListEntry{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ManagedPrefixListEntry") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagedPrefixListEntry_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/natgateway/zz_controller.go b/internal/controller/ec2/natgateway/zz_controller.go index 356eb30358..cb4744f054 100755 --- a/internal/controller/ec2/natgateway/zz_controller.go +++ b/internal/controller/ec2/natgateway/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NATGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_nat_gateway"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NATGateway_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_nat_gateway"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NATGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NATGateway + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NATGateway{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NATGateway") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NATGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/networkacl/zz_controller.go b/internal/controller/ec2/networkacl/zz_controller.go index 77df1339a6..c4c4aba3ce 100755 --- a/internal/controller/ec2/networkacl/zz_controller.go +++ b/internal/controller/ec2/networkacl/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_network_acl"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkACL_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_network_acl"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkACL_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NetworkACL + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NetworkACL{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NetworkACL") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkACL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/networkaclrule/zz_controller.go b/internal/controller/ec2/networkaclrule/zz_controller.go index 61687e468b..85aa2aad23 100755 --- a/internal/controller/ec2/networkaclrule/zz_controller.go +++ b/internal/controller/ec2/networkaclrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkACLRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_network_acl_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkACLRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_network_acl_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkACLRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NetworkACLRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NetworkACLRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NetworkACLRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkACLRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/networkinsightsanalysis/zz_controller.go b/internal/controller/ec2/networkinsightsanalysis/zz_controller.go index f49cd23dd6..a209c99fc0 100755 --- a/internal/controller/ec2/networkinsightsanalysis/zz_controller.go +++ b/internal/controller/ec2/networkinsightsanalysis/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkInsightsAnalysis_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_network_insights_analysis"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkInsightsAnalysis_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_network_insights_analysis"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkInsightsAnalysis_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NetworkInsightsAnalysis + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NetworkInsightsAnalysis{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NetworkInsightsAnalysis") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkInsightsAnalysis_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/networkinsightspath/zz_controller.go b/internal/controller/ec2/networkinsightspath/zz_controller.go index 6af5270206..0ea0db38f0 100755 --- a/internal/controller/ec2/networkinsightspath/zz_controller.go +++ b/internal/controller/ec2/networkinsightspath/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkInsightsPath_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_network_insights_path"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkInsightsPath_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_network_insights_path"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkInsightsPath_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NetworkInsightsPath + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NetworkInsightsPath{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NetworkInsightsPath") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkInsightsPath_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/networkinterface/zz_controller.go b/internal/controller/ec2/networkinterface/zz_controller.go index 0d0eb422b7..a3db6babc5 100755 --- a/internal/controller/ec2/networkinterface/zz_controller.go +++ b/internal/controller/ec2/networkinterface/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkInterface_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_network_interface"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkInterface_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_network_interface"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkInterface_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NetworkInterface + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NetworkInterface{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NetworkInterface") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkInterface_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/networkinterfaceattachment/zz_controller.go b/internal/controller/ec2/networkinterfaceattachment/zz_controller.go index 7560484370..9eb211a193 100755 --- a/internal/controller/ec2/networkinterfaceattachment/zz_controller.go +++ b/internal/controller/ec2/networkinterfaceattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkInterfaceAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_network_interface_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkInterfaceAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_network_interface_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkInterfaceAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NetworkInterfaceAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NetworkInterfaceAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NetworkInterfaceAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkInterfaceAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/networkinterfacesgattachment/zz_controller.go b/internal/controller/ec2/networkinterfacesgattachment/zz_controller.go index c397e6db50..6aca82c824 100755 --- a/internal/controller/ec2/networkinterfacesgattachment/zz_controller.go +++ b/internal/controller/ec2/networkinterfacesgattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkInterfaceSgAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_network_interface_sg_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkInterfaceSgAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_network_interface_sg_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkInterfaceSgAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NetworkInterfaceSgAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NetworkInterfaceSgAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NetworkInterfaceSgAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkInterfaceSgAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/placementgroup/zz_controller.go b/internal/controller/ec2/placementgroup/zz_controller.go index e084864b51..41a7c98882 100755 --- a/internal/controller/ec2/placementgroup/zz_controller.go +++ b/internal/controller/ec2/placementgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PlacementGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_placement_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PlacementGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_placement_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PlacementGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PlacementGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PlacementGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PlacementGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PlacementGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/route/zz_controller.go b/internal/controller/ec2/route/zz_controller.go index 0a9bff7536..bfbef36cb7 100755 --- a/internal/controller/ec2/route/zz_controller.go +++ b/internal/controller/ec2/route/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Route_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Route_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Route_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Route + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Route{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Route") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Route_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/routetable/zz_controller.go b/internal/controller/ec2/routetable/zz_controller.go index 4ae8cd7ddd..8a66ed0c32 100755 --- a/internal/controller/ec2/routetable/zz_controller.go +++ b/internal/controller/ec2/routetable/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RouteTable_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route_table"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RouteTable_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route_table"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RouteTable_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RouteTable + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RouteTable{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RouteTable") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RouteTable_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/routetableassociation/zz_controller.go b/internal/controller/ec2/routetableassociation/zz_controller.go index 8497dbfb67..b53cf04da8 100755 --- a/internal/controller/ec2/routetableassociation/zz_controller.go +++ b/internal/controller/ec2/routetableassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RouteTableAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route_table_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RouteTableAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route_table_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RouteTableAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RouteTableAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RouteTableAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RouteTableAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RouteTableAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/securitygroup/zz_controller.go b/internal/controller/ec2/securitygroup/zz_controller.go index b3663cb302..3b96c28eb2 100755 --- a/internal/controller/ec2/securitygroup/zz_controller.go +++ b/internal/controller/ec2/securitygroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecurityGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_security_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecurityGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_security_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecurityGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SecurityGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SecurityGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SecurityGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/securitygroupegressrule/zz_controller.go b/internal/controller/ec2/securitygroupegressrule/zz_controller.go index f92b4e25cf..1c567b3af4 100755 --- a/internal/controller/ec2/securitygroupegressrule/zz_controller.go +++ b/internal/controller/ec2/securitygroupegressrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/terraform" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -58,6 +59,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SecurityGroupEgressRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SecurityGroupEgressRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SecurityGroupEgressRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityGroupEgressRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/securitygroupingressrule/zz_controller.go b/internal/controller/ec2/securitygroupingressrule/zz_controller.go index 0a2780b8c9..46bf322372 100755 --- a/internal/controller/ec2/securitygroupingressrule/zz_controller.go +++ b/internal/controller/ec2/securitygroupingressrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/terraform" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -58,6 +59,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SecurityGroupIngressRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SecurityGroupIngressRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SecurityGroupIngressRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityGroupIngressRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/securitygrouprule/zz_controller.go b/internal/controller/ec2/securitygrouprule/zz_controller.go index 2969b2c451..37a31a515c 100755 --- a/internal/controller/ec2/securitygrouprule/zz_controller.go +++ b/internal/controller/ec2/securitygrouprule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecurityGroupRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_security_group_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecurityGroupRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_security_group_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecurityGroupRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SecurityGroupRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SecurityGroupRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SecurityGroupRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityGroupRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/serialconsoleaccess/zz_controller.go b/internal/controller/ec2/serialconsoleaccess/zz_controller.go index 1bc4b0f79e..ee45a6121e 100755 --- a/internal/controller/ec2/serialconsoleaccess/zz_controller.go +++ b/internal/controller/ec2/serialconsoleaccess/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SerialConsoleAccess_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_serial_console_access"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SerialConsoleAccess_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_serial_console_access"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SerialConsoleAccess_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SerialConsoleAccess + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SerialConsoleAccess{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SerialConsoleAccess") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SerialConsoleAccess_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/snapshotcreatevolumepermission/zz_controller.go b/internal/controller/ec2/snapshotcreatevolumepermission/zz_controller.go index 5982d6c478..58e91c2a32 100755 --- a/internal/controller/ec2/snapshotcreatevolumepermission/zz_controller.go +++ b/internal/controller/ec2/snapshotcreatevolumepermission/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SnapshotCreateVolumePermission_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_snapshot_create_volume_permission"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SnapshotCreateVolumePermission_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_snapshot_create_volume_permission"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SnapshotCreateVolumePermission_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SnapshotCreateVolumePermission + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SnapshotCreateVolumePermission{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SnapshotCreateVolumePermission") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SnapshotCreateVolumePermission_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/spotdatafeedsubscription/zz_controller.go b/internal/controller/ec2/spotdatafeedsubscription/zz_controller.go index ac9b64ec91..f31f76ea98 100755 --- a/internal/controller/ec2/spotdatafeedsubscription/zz_controller.go +++ b/internal/controller/ec2/spotdatafeedsubscription/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SpotDatafeedSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_spot_datafeed_subscription"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SpotDatafeedSubscription_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_spot_datafeed_subscription"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SpotDatafeedSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SpotDatafeedSubscription + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SpotDatafeedSubscription{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SpotDatafeedSubscription") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpotDatafeedSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/spotfleetrequest/zz_controller.go b/internal/controller/ec2/spotfleetrequest/zz_controller.go index af1af9a139..ef94dc9d48 100755 --- a/internal/controller/ec2/spotfleetrequest/zz_controller.go +++ b/internal/controller/ec2/spotfleetrequest/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SpotFleetRequest_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_spot_fleet_request"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SpotFleetRequest_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_spot_fleet_request"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SpotFleetRequest_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SpotFleetRequest + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SpotFleetRequest{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SpotFleetRequest") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpotFleetRequest_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/spotinstancerequest/zz_controller.go b/internal/controller/ec2/spotinstancerequest/zz_controller.go index 6873f11f26..530f5df797 100755 --- a/internal/controller/ec2/spotinstancerequest/zz_controller.go +++ b/internal/controller/ec2/spotinstancerequest/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SpotInstanceRequest_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_spot_instance_request"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SpotInstanceRequest_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_spot_instance_request"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SpotInstanceRequest_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SpotInstanceRequest + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SpotInstanceRequest{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SpotInstanceRequest") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SpotInstanceRequest_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/subnet/zz_controller.go b/internal/controller/ec2/subnet/zz_controller.go index 393ff03882..27403737d3 100755 --- a/internal/controller/ec2/subnet/zz_controller.go +++ b/internal/controller/ec2/subnet/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Subnet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_subnet"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Subnet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_subnet"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Subnet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Subnet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Subnet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Subnet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Subnet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/subnetcidrreservation/zz_controller.go b/internal/controller/ec2/subnetcidrreservation/zz_controller.go index bcff0cbcf9..85c86a30f8 100755 --- a/internal/controller/ec2/subnetcidrreservation/zz_controller.go +++ b/internal/controller/ec2/subnetcidrreservation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubnetCidrReservation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_subnet_cidr_reservation"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetCidrReservation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_subnet_cidr_reservation"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetCidrReservation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SubnetCidrReservation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SubnetCidrReservation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SubnetCidrReservation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetCidrReservation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/tag/zz_controller.go b/internal/controller/ec2/tag/zz_controller.go index 81f39ecd7a..1286f7fad2 100755 --- a/internal/controller/ec2/tag/zz_controller.go +++ b/internal/controller/ec2/tag/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Tag_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_tag"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Tag_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_tag"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Tag_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Tag + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Tag{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Tag") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Tag_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/trafficmirrorfilter/zz_controller.go b/internal/controller/ec2/trafficmirrorfilter/zz_controller.go index 95fc9cb7fe..fd7d0dc552 100755 --- a/internal/controller/ec2/trafficmirrorfilter/zz_controller.go +++ b/internal/controller/ec2/trafficmirrorfilter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TrafficMirrorFilter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_traffic_mirror_filter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TrafficMirrorFilter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_traffic_mirror_filter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TrafficMirrorFilter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TrafficMirrorFilter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TrafficMirrorFilter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TrafficMirrorFilter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TrafficMirrorFilter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/trafficmirrorfilterrule/zz_controller.go b/internal/controller/ec2/trafficmirrorfilterrule/zz_controller.go index 81079e98dc..8cd99666b1 100755 --- a/internal/controller/ec2/trafficmirrorfilterrule/zz_controller.go +++ b/internal/controller/ec2/trafficmirrorfilterrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TrafficMirrorFilterRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_traffic_mirror_filter_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TrafficMirrorFilterRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_traffic_mirror_filter_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TrafficMirrorFilterRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TrafficMirrorFilterRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TrafficMirrorFilterRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TrafficMirrorFilterRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TrafficMirrorFilterRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgateway/zz_controller.go b/internal/controller/ec2/transitgateway/zz_controller.go index 080c07f59e..8da3ee00ac 100755 --- a/internal/controller/ec2/transitgateway/zz_controller.go +++ b/internal/controller/ec2/transitgateway/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGateway_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGateway + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGateway{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGateway") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewayconnect/zz_controller.go b/internal/controller/ec2/transitgatewayconnect/zz_controller.go index ff7577f1b5..25fad2a866 100755 --- a/internal/controller/ec2/transitgatewayconnect/zz_controller.go +++ b/internal/controller/ec2/transitgatewayconnect/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayConnect_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_connect"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayConnect_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_connect"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayConnect_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayConnect + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayConnect{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayConnect") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayConnect_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewayconnectpeer/zz_controller.go b/internal/controller/ec2/transitgatewayconnectpeer/zz_controller.go index b31fe8049d..054ad6b964 100755 --- a/internal/controller/ec2/transitgatewayconnectpeer/zz_controller.go +++ b/internal/controller/ec2/transitgatewayconnectpeer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayConnectPeer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_connect_peer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayConnectPeer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_connect_peer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayConnectPeer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayConnectPeer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayConnectPeer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayConnectPeer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayConnectPeer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewaymulticastdomain/zz_controller.go b/internal/controller/ec2/transitgatewaymulticastdomain/zz_controller.go index 4a14043390..db93a47c9e 100755 --- a/internal/controller/ec2/transitgatewaymulticastdomain/zz_controller.go +++ b/internal/controller/ec2/transitgatewaymulticastdomain/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayMulticastDomain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_multicast_domain"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayMulticastDomain_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_multicast_domain"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayMulticastDomain_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayMulticastDomain + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayMulticastDomain{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayMulticastDomain") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayMulticastDomain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewaymulticastdomainassociation/zz_controller.go b/internal/controller/ec2/transitgatewaymulticastdomainassociation/zz_controller.go index fab1bc20ce..f1730c3aa2 100755 --- a/internal/controller/ec2/transitgatewaymulticastdomainassociation/zz_controller.go +++ b/internal/controller/ec2/transitgatewaymulticastdomainassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayMulticastDomainAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_multicast_domain_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayMulticastDomainAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_multicast_domain_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayMulticastDomainAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayMulticastDomainAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayMulticastDomainAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayMulticastDomainAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayMulticastDomainAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewaymulticastgroupmember/zz_controller.go b/internal/controller/ec2/transitgatewaymulticastgroupmember/zz_controller.go index 671fcd9cb2..47bc90396f 100755 --- a/internal/controller/ec2/transitgatewaymulticastgroupmember/zz_controller.go +++ b/internal/controller/ec2/transitgatewaymulticastgroupmember/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayMulticastGroupMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_multicast_group_member"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayMulticastGroupMember_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_multicast_group_member"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayMulticastGroupMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayMulticastGroupMember + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayMulticastGroupMember{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayMulticastGroupMember") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayMulticastGroupMember_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewaymulticastgroupsource/zz_controller.go b/internal/controller/ec2/transitgatewaymulticastgroupsource/zz_controller.go index a2beda8751..065768cc6d 100755 --- a/internal/controller/ec2/transitgatewaymulticastgroupsource/zz_controller.go +++ b/internal/controller/ec2/transitgatewaymulticastgroupsource/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayMulticastGroupSource_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_multicast_group_source"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayMulticastGroupSource_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_multicast_group_source"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayMulticastGroupSource_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayMulticastGroupSource + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayMulticastGroupSource{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayMulticastGroupSource") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayMulticastGroupSource_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewaypeeringattachment/zz_controller.go b/internal/controller/ec2/transitgatewaypeeringattachment/zz_controller.go index 58ee68b952..10541ad2b8 100755 --- a/internal/controller/ec2/transitgatewaypeeringattachment/zz_controller.go +++ b/internal/controller/ec2/transitgatewaypeeringattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayPeeringAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_peering_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayPeeringAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_peering_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayPeeringAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayPeeringAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayPeeringAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayPeeringAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayPeeringAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewaypeeringattachmentaccepter/zz_controller.go b/internal/controller/ec2/transitgatewaypeeringattachmentaccepter/zz_controller.go index 69fa03d9cd..fb306997b8 100755 --- a/internal/controller/ec2/transitgatewaypeeringattachmentaccepter/zz_controller.go +++ b/internal/controller/ec2/transitgatewaypeeringattachmentaccepter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayPeeringAttachmentAccepter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_peering_attachment_accepter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayPeeringAttachmentAccepter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_peering_attachment_accepter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayPeeringAttachmentAccepter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayPeeringAttachmentAccepter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayPeeringAttachmentAccepter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayPeeringAttachmentAccepter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayPeeringAttachmentAccepter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewaypolicytable/zz_controller.go b/internal/controller/ec2/transitgatewaypolicytable/zz_controller.go index 74b9578a53..c947a61675 100755 --- a/internal/controller/ec2/transitgatewaypolicytable/zz_controller.go +++ b/internal/controller/ec2/transitgatewaypolicytable/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayPolicyTable_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_policy_table"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayPolicyTable_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_policy_table"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayPolicyTable_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayPolicyTable + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayPolicyTable{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayPolicyTable") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayPolicyTable_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewayprefixlistreference/zz_controller.go b/internal/controller/ec2/transitgatewayprefixlistreference/zz_controller.go index fc37d2aafd..a9eaac8949 100755 --- a/internal/controller/ec2/transitgatewayprefixlistreference/zz_controller.go +++ b/internal/controller/ec2/transitgatewayprefixlistreference/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayPrefixListReference_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_prefix_list_reference"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayPrefixListReference_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_prefix_list_reference"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayPrefixListReference_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayPrefixListReference + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayPrefixListReference{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayPrefixListReference") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayPrefixListReference_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewayroute/zz_controller.go b/internal/controller/ec2/transitgatewayroute/zz_controller.go index bd05c5ca43..57292693f5 100755 --- a/internal/controller/ec2/transitgatewayroute/zz_controller.go +++ b/internal/controller/ec2/transitgatewayroute/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayRoute_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_route"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayRoute_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_route"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayRoute_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayRoute + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayRoute{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayRoute") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayRoute_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewayroutetable/zz_controller.go b/internal/controller/ec2/transitgatewayroutetable/zz_controller.go index 5bd85e578a..efec36f3a3 100755 --- a/internal/controller/ec2/transitgatewayroutetable/zz_controller.go +++ b/internal/controller/ec2/transitgatewayroutetable/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayRouteTable_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_route_table"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayRouteTable_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_route_table"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayRouteTable_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayRouteTable + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayRouteTable{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayRouteTable") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayRouteTable_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewayroutetableassociation/zz_controller.go b/internal/controller/ec2/transitgatewayroutetableassociation/zz_controller.go index 86a67c71aa..4e9351f878 100755 --- a/internal/controller/ec2/transitgatewayroutetableassociation/zz_controller.go +++ b/internal/controller/ec2/transitgatewayroutetableassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayRouteTableAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_route_table_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayRouteTableAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_route_table_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayRouteTableAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayRouteTableAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayRouteTableAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayRouteTableAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayRouteTableAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewayroutetablepropagation/zz_controller.go b/internal/controller/ec2/transitgatewayroutetablepropagation/zz_controller.go index f103ef6cce..03705c7cea 100755 --- a/internal/controller/ec2/transitgatewayroutetablepropagation/zz_controller.go +++ b/internal/controller/ec2/transitgatewayroutetablepropagation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayRouteTablePropagation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_route_table_propagation"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayRouteTablePropagation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_route_table_propagation"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayRouteTablePropagation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayRouteTablePropagation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayRouteTablePropagation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayRouteTablePropagation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayRouteTablePropagation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewayvpcattachment/zz_controller.go b/internal/controller/ec2/transitgatewayvpcattachment/zz_controller.go index 29b0e525a6..82247f8eb2 100755 --- a/internal/controller/ec2/transitgatewayvpcattachment/zz_controller.go +++ b/internal/controller/ec2/transitgatewayvpcattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayVPCAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_vpc_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayVPCAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_vpc_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayVPCAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayVPCAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayVPCAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayVPCAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayVPCAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/transitgatewayvpcattachmentaccepter/zz_controller.go b/internal/controller/ec2/transitgatewayvpcattachmentaccepter/zz_controller.go index c5ff5d5a3c..b1fb501ccc 100755 --- a/internal/controller/ec2/transitgatewayvpcattachmentaccepter/zz_controller.go +++ b/internal/controller/ec2/transitgatewayvpcattachmentaccepter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayVPCAttachmentAccepter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_vpc_attachment_accepter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayVPCAttachmentAccepter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ec2_transit_gateway_vpc_attachment_accepter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayVPCAttachmentAccepter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayVPCAttachmentAccepter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayVPCAttachmentAccepter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayVPCAttachmentAccepter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayVPCAttachmentAccepter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/volumeattachment/zz_controller.go b/internal/controller/ec2/volumeattachment/zz_controller.go index 8ea36ab734..f6700df865 100755 --- a/internal/controller/ec2/volumeattachment/zz_controller.go +++ b/internal/controller/ec2/volumeattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VolumeAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_volume_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VolumeAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_volume_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VolumeAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VolumeAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VolumeAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VolumeAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VolumeAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpc/zz_controller.go b/internal/controller/ec2/vpc/zz_controller.go index 424d223751..7535928653 100755 --- a/internal/controller/ec2/vpc/zz_controller.go +++ b/internal/controller/ec2/vpc/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPC_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPC_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPC_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPC + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPC{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPC") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPC_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcdhcpoptions/zz_controller.go b/internal/controller/ec2/vpcdhcpoptions/zz_controller.go index 4db9d9782a..52c541129c 100755 --- a/internal/controller/ec2/vpcdhcpoptions/zz_controller.go +++ b/internal/controller/ec2/vpcdhcpoptions/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCDHCPOptions_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_dhcp_options"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCDHCPOptions_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_dhcp_options"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCDHCPOptions_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCDHCPOptions + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCDHCPOptions{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCDHCPOptions") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCDHCPOptions_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcdhcpoptionsassociation/zz_controller.go b/internal/controller/ec2/vpcdhcpoptionsassociation/zz_controller.go index 004f6a6315..7f2eda4a5f 100755 --- a/internal/controller/ec2/vpcdhcpoptionsassociation/zz_controller.go +++ b/internal/controller/ec2/vpcdhcpoptionsassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCDHCPOptionsAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_dhcp_options_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCDHCPOptionsAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_dhcp_options_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCDHCPOptionsAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCDHCPOptionsAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCDHCPOptionsAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCDHCPOptionsAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCDHCPOptionsAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcendpoint/zz_controller.go b/internal/controller/ec2/vpcendpoint/zz_controller.go index b94981a40a..0a05435146 100755 --- a/internal/controller/ec2/vpcendpoint/zz_controller.go +++ b/internal/controller/ec2/vpcendpoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCEndpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCEndpoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCEndpoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCEndpoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcendpointconnectionnotification/zz_controller.go b/internal/controller/ec2/vpcendpointconnectionnotification/zz_controller.go index a9176c252d..6bf0a0209c 100755 --- a/internal/controller/ec2/vpcendpointconnectionnotification/zz_controller.go +++ b/internal/controller/ec2/vpcendpointconnectionnotification/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointConnectionNotification_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_connection_notification"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointConnectionNotification_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_connection_notification"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointConnectionNotification_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCEndpointConnectionNotification + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCEndpointConnectionNotification{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCEndpointConnectionNotification") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointConnectionNotification_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcendpointroutetableassociation/zz_controller.go b/internal/controller/ec2/vpcendpointroutetableassociation/zz_controller.go index 861302a69c..c4e36be24d 100755 --- a/internal/controller/ec2/vpcendpointroutetableassociation/zz_controller.go +++ b/internal/controller/ec2/vpcendpointroutetableassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointRouteTableAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_route_table_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointRouteTableAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_route_table_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointRouteTableAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCEndpointRouteTableAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCEndpointRouteTableAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCEndpointRouteTableAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointRouteTableAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcendpointsecuritygroupassociation/zz_controller.go b/internal/controller/ec2/vpcendpointsecuritygroupassociation/zz_controller.go index be94477835..7c6c6da3de 100755 --- a/internal/controller/ec2/vpcendpointsecuritygroupassociation/zz_controller.go +++ b/internal/controller/ec2/vpcendpointsecuritygroupassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointSecurityGroupAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_security_group_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointSecurityGroupAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_security_group_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointSecurityGroupAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCEndpointSecurityGroupAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCEndpointSecurityGroupAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCEndpointSecurityGroupAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointSecurityGroupAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcendpointservice/zz_controller.go b/internal/controller/ec2/vpcendpointservice/zz_controller.go index 3f3fa054d4..d9068ca107 100755 --- a/internal/controller/ec2/vpcendpointservice/zz_controller.go +++ b/internal/controller/ec2/vpcendpointservice/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_service"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointService_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_service"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointService_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCEndpointService + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCEndpointService{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCEndpointService") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcendpointserviceallowedprincipal/zz_controller.go b/internal/controller/ec2/vpcendpointserviceallowedprincipal/zz_controller.go index 992131b95e..201c94db53 100755 --- a/internal/controller/ec2/vpcendpointserviceallowedprincipal/zz_controller.go +++ b/internal/controller/ec2/vpcendpointserviceallowedprincipal/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointServiceAllowedPrincipal_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_service_allowed_principal"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointServiceAllowedPrincipal_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_service_allowed_principal"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointServiceAllowedPrincipal_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCEndpointServiceAllowedPrincipal + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCEndpointServiceAllowedPrincipal{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCEndpointServiceAllowedPrincipal") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointServiceAllowedPrincipal_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcendpointsubnetassociation/zz_controller.go b/internal/controller/ec2/vpcendpointsubnetassociation/zz_controller.go index 1c112dc808..058ad6c612 100755 --- a/internal/controller/ec2/vpcendpointsubnetassociation/zz_controller.go +++ b/internal/controller/ec2/vpcendpointsubnetassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointSubnetAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_subnet_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointSubnetAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_endpoint_subnet_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCEndpointSubnetAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCEndpointSubnetAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCEndpointSubnetAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCEndpointSubnetAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCEndpointSubnetAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcipam/zz_controller.go b/internal/controller/ec2/vpcipam/zz_controller.go index 45b3c82f7e..4cc3a8d2ef 100755 --- a/internal/controller/ec2/vpcipam/zz_controller.go +++ b/internal/controller/ec2/vpcipam/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCIpam_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipam"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIpam_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipam"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIpam_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCIpam + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCIpam{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCIpam") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCIpam_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcipampool/zz_controller.go b/internal/controller/ec2/vpcipampool/zz_controller.go index cb896fe05b..53ea49b8b2 100755 --- a/internal/controller/ec2/vpcipampool/zz_controller.go +++ b/internal/controller/ec2/vpcipampool/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCIpamPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipam_pool"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIpamPool_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipam_pool"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIpamPool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCIpamPool + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCIpamPool{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCIpamPool") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCIpamPool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcipampoolcidr/zz_controller.go b/internal/controller/ec2/vpcipampoolcidr/zz_controller.go index e7a88ad29b..b66cc72c34 100755 --- a/internal/controller/ec2/vpcipampoolcidr/zz_controller.go +++ b/internal/controller/ec2/vpcipampoolcidr/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCIpamPoolCidr_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipam_pool_cidr"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIpamPoolCidr_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipam_pool_cidr"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIpamPoolCidr_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCIpamPoolCidr + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCIpamPoolCidr{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCIpamPoolCidr") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCIpamPoolCidr_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcipampoolcidrallocation/zz_controller.go b/internal/controller/ec2/vpcipampoolcidrallocation/zz_controller.go index c1df1ba2ab..f825482d66 100755 --- a/internal/controller/ec2/vpcipampoolcidrallocation/zz_controller.go +++ b/internal/controller/ec2/vpcipampoolcidrallocation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCIpamPoolCidrAllocation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipam_pool_cidr_allocation"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIpamPoolCidrAllocation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipam_pool_cidr_allocation"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIpamPoolCidrAllocation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCIpamPoolCidrAllocation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCIpamPoolCidrAllocation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCIpamPoolCidrAllocation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCIpamPoolCidrAllocation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcipamscope/zz_controller.go b/internal/controller/ec2/vpcipamscope/zz_controller.go index 41d26d5f2f..e3dddc9cfd 100755 --- a/internal/controller/ec2/vpcipamscope/zz_controller.go +++ b/internal/controller/ec2/vpcipamscope/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCIpamScope_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipam_scope"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIpamScope_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipam_scope"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIpamScope_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCIpamScope + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCIpamScope{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCIpamScope") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCIpamScope_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcipv4cidrblockassociation/zz_controller.go b/internal/controller/ec2/vpcipv4cidrblockassociation/zz_controller.go index cd19429a99..17bd0ce942 100755 --- a/internal/controller/ec2/vpcipv4cidrblockassociation/zz_controller.go +++ b/internal/controller/ec2/vpcipv4cidrblockassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCIPv4CidrBlockAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipv4_cidr_block_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIPv4CidrBlockAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_ipv4_cidr_block_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCIPv4CidrBlockAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCIPv4CidrBlockAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCIPv4CidrBlockAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCIPv4CidrBlockAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCIPv4CidrBlockAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcpeeringconnection/zz_controller.go b/internal/controller/ec2/vpcpeeringconnection/zz_controller.go index 1d80230192..45e4296ea1 100755 --- a/internal/controller/ec2/vpcpeeringconnection/zz_controller.go +++ b/internal/controller/ec2/vpcpeeringconnection/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCPeeringConnection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_peering_connection"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCPeeringConnection_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_peering_connection"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCPeeringConnection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCPeeringConnection + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCPeeringConnection{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCPeeringConnection") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCPeeringConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcpeeringconnectionaccepter/zz_controller.go b/internal/controller/ec2/vpcpeeringconnectionaccepter/zz_controller.go index 87db192b96..6d86fd1cb2 100755 --- a/internal/controller/ec2/vpcpeeringconnectionaccepter/zz_controller.go +++ b/internal/controller/ec2/vpcpeeringconnectionaccepter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCPeeringConnectionAccepter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_peering_connection_accepter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCPeeringConnectionAccepter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_peering_connection_accepter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCPeeringConnectionAccepter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCPeeringConnectionAccepter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCPeeringConnectionAccepter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCPeeringConnectionAccepter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCPeeringConnectionAccepter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpcpeeringconnectionoptions/zz_controller.go b/internal/controller/ec2/vpcpeeringconnectionoptions/zz_controller.go index accecc9162..9cce5cec1e 100755 --- a/internal/controller/ec2/vpcpeeringconnectionoptions/zz_controller.go +++ b/internal/controller/ec2/vpcpeeringconnectionoptions/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCPeeringConnectionOptions_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_peering_connection_options"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCPeeringConnectionOptions_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_peering_connection_options"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCPeeringConnectionOptions_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCPeeringConnectionOptions + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCPeeringConnectionOptions{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCPeeringConnectionOptions") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCPeeringConnectionOptions_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpnconnection/zz_controller.go b/internal/controller/ec2/vpnconnection/zz_controller.go index 9775b42152..07ed4486e2 100755 --- a/internal/controller/ec2/vpnconnection/zz_controller.go +++ b/internal/controller/ec2/vpnconnection/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPNConnection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpn_connection"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNConnection_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpn_connection"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNConnection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPNConnection + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPNConnection{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPNConnection") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPNConnection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpnconnectionroute/zz_controller.go b/internal/controller/ec2/vpnconnectionroute/zz_controller.go index e1ea64dc7e..fb2ab6e3ee 100755 --- a/internal/controller/ec2/vpnconnectionroute/zz_controller.go +++ b/internal/controller/ec2/vpnconnectionroute/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPNConnectionRoute_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpn_connection_route"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNConnectionRoute_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpn_connection_route"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNConnectionRoute_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPNConnectionRoute + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPNConnectionRoute{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPNConnectionRoute") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPNConnectionRoute_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpngateway/zz_controller.go b/internal/controller/ec2/vpngateway/zz_controller.go index 8e5bd05051..67bc282468 100755 --- a/internal/controller/ec2/vpngateway/zz_controller.go +++ b/internal/controller/ec2/vpngateway/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPNGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpn_gateway"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNGateway_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpn_gateway"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPNGateway + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPNGateway{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPNGateway") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPNGateway_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpngatewayattachment/zz_controller.go b/internal/controller/ec2/vpngatewayattachment/zz_controller.go index ab5a923e4e..fd6cdc69f6 100755 --- a/internal/controller/ec2/vpngatewayattachment/zz_controller.go +++ b/internal/controller/ec2/vpngatewayattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPNGatewayAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpn_gateway_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNGatewayAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpn_gateway_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNGatewayAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPNGatewayAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPNGatewayAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPNGatewayAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPNGatewayAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ec2/vpngatewayroutepropagation/zz_controller.go b/internal/controller/ec2/vpngatewayroutepropagation/zz_controller.go index ea45f3f2f1..2096888e40 100755 --- a/internal/controller/ec2/vpngatewayroutepropagation/zz_controller.go +++ b/internal/controller/ec2/vpngatewayroutepropagation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ec2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPNGatewayRoutePropagation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpn_gateway_route_propagation"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNGatewayRoutePropagation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpn_gateway_route_propagation"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNGatewayRoutePropagation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPNGatewayRoutePropagation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPNGatewayRoutePropagation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPNGatewayRoutePropagation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPNGatewayRoutePropagation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecr/lifecyclepolicy/zz_controller.go b/internal/controller/ecr/lifecyclepolicy/zz_controller.go index 6007d33b7c..fea46ad680 100755 --- a/internal/controller/ecr/lifecyclepolicy/zz_controller.go +++ b/internal/controller/ecr/lifecyclepolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecr/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LifecyclePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_lifecycle_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LifecyclePolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_lifecycle_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LifecyclePolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LifecyclePolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LifecyclePolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LifecyclePolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LifecyclePolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecr/pullthroughcacherule/zz_controller.go b/internal/controller/ecr/pullthroughcacherule/zz_controller.go index faa6118f58..956d19a711 100755 --- a/internal/controller/ecr/pullthroughcacherule/zz_controller.go +++ b/internal/controller/ecr/pullthroughcacherule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecr/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PullThroughCacheRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_pull_through_cache_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PullThroughCacheRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_pull_through_cache_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PullThroughCacheRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PullThroughCacheRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PullThroughCacheRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PullThroughCacheRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PullThroughCacheRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecr/registrypolicy/zz_controller.go b/internal/controller/ecr/registrypolicy/zz_controller.go index a25a77061a..a6c40c5c31 100755 --- a/internal/controller/ecr/registrypolicy/zz_controller.go +++ b/internal/controller/ecr/registrypolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecr/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegistryPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_registry_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegistryPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_registry_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegistryPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RegistryPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RegistryPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RegistryPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RegistryPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecr/registryscanningconfiguration/zz_controller.go b/internal/controller/ecr/registryscanningconfiguration/zz_controller.go index 42e8738300..2a165403f5 100755 --- a/internal/controller/ecr/registryscanningconfiguration/zz_controller.go +++ b/internal/controller/ecr/registryscanningconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecr/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegistryScanningConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_registry_scanning_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegistryScanningConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_registry_scanning_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegistryScanningConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RegistryScanningConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RegistryScanningConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RegistryScanningConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RegistryScanningConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecr/replicationconfiguration/zz_controller.go b/internal/controller/ecr/replicationconfiguration/zz_controller.go index 2abc0767b4..e8ba0221de 100755 --- a/internal/controller/ecr/replicationconfiguration/zz_controller.go +++ b/internal/controller/ecr/replicationconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecr/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReplicationConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_replication_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_replication_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReplicationConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReplicationConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReplicationConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReplicationConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecr/repository/zz_controller.go b/internal/controller/ecr/repository/zz_controller.go index 848df82f57..f0ab13c5f3 100755 --- a/internal/controller/ecr/repository/zz_controller.go +++ b/internal/controller/ecr/repository/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecr/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Repository_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_repository"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Repository_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_repository"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Repository_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Repository + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Repository{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Repository") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Repository_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecr/repositorypolicy/zz_controller.go b/internal/controller/ecr/repositorypolicy/zz_controller.go index 5a5607509f..41041a8bb7 100755 --- a/internal/controller/ecr/repositorypolicy/zz_controller.go +++ b/internal/controller/ecr/repositorypolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecr/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RepositoryPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_repository_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RepositoryPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecr_repository_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RepositoryPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RepositoryPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RepositoryPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RepositoryPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RepositoryPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecrpublic/repository/zz_controller.go b/internal/controller/ecrpublic/repository/zz_controller.go index de621dcd50..502102b4e9 100755 --- a/internal/controller/ecrpublic/repository/zz_controller.go +++ b/internal/controller/ecrpublic/repository/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecrpublic/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Repository_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecrpublic_repository"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Repository_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecrpublic_repository"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Repository_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Repository + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Repository{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Repository") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Repository_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecrpublic/repositorypolicy/zz_controller.go b/internal/controller/ecrpublic/repositorypolicy/zz_controller.go index 4b1cf3ccfc..85669c7620 100755 --- a/internal/controller/ecrpublic/repositorypolicy/zz_controller.go +++ b/internal/controller/ecrpublic/repositorypolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecrpublic/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RepositoryPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecrpublic_repository_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RepositoryPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecrpublic_repository_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RepositoryPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RepositoryPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RepositoryPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RepositoryPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RepositoryPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecs/accountsettingdefault/zz_controller.go b/internal/controller/ecs/accountsettingdefault/zz_controller.go index 900bb85fa0..a2cb9c5b84 100755 --- a/internal/controller/ecs/accountsettingdefault/zz_controller.go +++ b/internal/controller/ecs/accountsettingdefault/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccountSettingDefault_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_account_setting_default"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccountSettingDefault_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_account_setting_default"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccountSettingDefault_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AccountSettingDefault + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AccountSettingDefault{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AccountSettingDefault") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AccountSettingDefault_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecs/capacityprovider/zz_controller.go b/internal/controller/ecs/capacityprovider/zz_controller.go index b8876a75dc..825b997de5 100755 --- a/internal/controller/ecs/capacityprovider/zz_controller.go +++ b/internal/controller/ecs/capacityprovider/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecs/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CapacityProvider_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_capacity_provider"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CapacityProvider_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_capacity_provider"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CapacityProvider_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CapacityProvider + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CapacityProvider{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CapacityProvider") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CapacityProvider_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecs/cluster/zz_controller.go b/internal/controller/ecs/cluster/zz_controller.go index 1560699fc9..71f0d022bd 100755 --- a/internal/controller/ecs/cluster/zz_controller.go +++ b/internal/controller/ecs/cluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecs/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecs/clustercapacityproviders/zz_controller.go b/internal/controller/ecs/clustercapacityproviders/zz_controller.go index 94347c0b3d..00bcca4ab6 100755 --- a/internal/controller/ecs/clustercapacityproviders/zz_controller.go +++ b/internal/controller/ecs/clustercapacityproviders/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterCapacityProviders_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_cluster_capacity_providers"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterCapacityProviders_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_cluster_capacity_providers"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterCapacityProviders_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterCapacityProviders + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterCapacityProviders{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterCapacityProviders") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterCapacityProviders_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecs/service/zz_controller.go b/internal/controller/ecs/service/zz_controller.go index 75693c37a5..8a1a920bea 100755 --- a/internal/controller/ecs/service/zz_controller.go +++ b/internal/controller/ecs/service/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecs/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Service_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_service"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Service_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_service"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Service_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Service + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Service{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Service") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Service_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ecs/taskdefinition/zz_controller.go b/internal/controller/ecs/taskdefinition/zz_controller.go index 5146ce9185..6c658459fa 100755 --- a/internal/controller/ecs/taskdefinition/zz_controller.go +++ b/internal/controller/ecs/taskdefinition/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ecs/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TaskDefinition_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_task_definition"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TaskDefinition_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ecs_task_definition"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TaskDefinition_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TaskDefinition + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TaskDefinition{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TaskDefinition") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TaskDefinition_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/efs/accesspoint/zz_controller.go b/internal/controller/efs/accesspoint/zz_controller.go index 1ded1eea57..90160093ef 100755 --- a/internal/controller/efs/accesspoint/zz_controller.go +++ b/internal/controller/efs/accesspoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/efs/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessPoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_access_point"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessPoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_access_point"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessPoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AccessPoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AccessPoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AccessPoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AccessPoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/efs/backuppolicy/zz_controller.go b/internal/controller/efs/backuppolicy/zz_controller.go index ed7d0b5864..7c75f5b7a1 100755 --- a/internal/controller/efs/backuppolicy/zz_controller.go +++ b/internal/controller/efs/backuppolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/efs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackupPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_backup_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BackupPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_backup_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BackupPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BackupPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BackupPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BackupPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BackupPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/efs/filesystem/zz_controller.go b/internal/controller/efs/filesystem/zz_controller.go index a9806c36ea..e51b0e80ed 100755 --- a/internal/controller/efs/filesystem/zz_controller.go +++ b/internal/controller/efs/filesystem/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/efs/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FileSystem_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_file_system"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FileSystem_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_file_system"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FileSystem_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FileSystem + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FileSystem{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FileSystem") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FileSystem_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/efs/filesystempolicy/zz_controller.go b/internal/controller/efs/filesystempolicy/zz_controller.go index 52e8200ab8..e17476ab02 100755 --- a/internal/controller/efs/filesystempolicy/zz_controller.go +++ b/internal/controller/efs/filesystempolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/efs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FileSystemPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_file_system_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FileSystemPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_file_system_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FileSystemPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FileSystemPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FileSystemPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FileSystemPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FileSystemPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/efs/mounttarget/zz_controller.go b/internal/controller/efs/mounttarget/zz_controller.go index 3bbb35f052..a3c433b2bc 100755 --- a/internal/controller/efs/mounttarget/zz_controller.go +++ b/internal/controller/efs/mounttarget/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/efs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MountTarget_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_mount_target"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MountTarget_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_mount_target"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MountTarget_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MountTarget + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MountTarget{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MountTarget") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MountTarget_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/efs/replicationconfiguration/zz_controller.go b/internal/controller/efs/replicationconfiguration/zz_controller.go index 278fdc0125..4ea5333f30 100755 --- a/internal/controller/efs/replicationconfiguration/zz_controller.go +++ b/internal/controller/efs/replicationconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/efs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReplicationConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_replication_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_efs_replication_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReplicationConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReplicationConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReplicationConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReplicationConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eks/addon/zz_controller.go b/internal/controller/eks/addon/zz_controller.go index 8208320c21..cbe1135f98 100755 --- a/internal/controller/eks/addon/zz_controller.go +++ b/internal/controller/eks/addon/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/eks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Addon_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eks_addon"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Addon_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eks_addon"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Addon_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Addon + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Addon{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Addon") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Addon_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eks/cluster/zz_controller.go b/internal/controller/eks/cluster/zz_controller.go index dce4186062..6358e1a12f 100755 --- a/internal/controller/eks/cluster/zz_controller.go +++ b/internal/controller/eks/cluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/eks/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eks_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eks_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eks/fargateprofile/zz_controller.go b/internal/controller/eks/fargateprofile/zz_controller.go index 0a23cec324..ff7d04222f 100755 --- a/internal/controller/eks/fargateprofile/zz_controller.go +++ b/internal/controller/eks/fargateprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/eks/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FargateProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eks_fargate_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FargateProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eks_fargate_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FargateProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FargateProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FargateProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FargateProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FargateProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eks/identityproviderconfig/zz_controller.go b/internal/controller/eks/identityproviderconfig/zz_controller.go index c3f2db6af2..96397da8c8 100755 --- a/internal/controller/eks/identityproviderconfig/zz_controller.go +++ b/internal/controller/eks/identityproviderconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/eks/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IdentityProviderConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eks_identity_provider_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IdentityProviderConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eks_identity_provider_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IdentityProviderConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.IdentityProviderConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.IdentityProviderConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.IdentityProviderConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IdentityProviderConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/eks/nodegroup/zz_controller.go b/internal/controller/eks/nodegroup/zz_controller.go index b2f33a245a..91a7189dd8 100755 --- a/internal/controller/eks/nodegroup/zz_controller.go +++ b/internal/controller/eks/nodegroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/eks/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodeGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eks_node_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NodeGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_eks_node_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NodeGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NodeGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NodeGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NodeGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NodeGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticache/cluster/zz_controller.go b/internal/controller/elasticache/cluster/zz_controller.go index f7e2394982..a0f9e7f290 100755 --- a/internal/controller/elasticache/cluster/zz_controller.go +++ b/internal/controller/elasticache/cluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticache/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticache/parametergroup/zz_controller.go b/internal/controller/elasticache/parametergroup/zz_controller.go index 3fd92e7011..61867cdf13 100755 --- a/internal/controller/elasticache/parametergroup/zz_controller.go +++ b/internal/controller/elasticache/parametergroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticache/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_parameter_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_parameter_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ParameterGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ParameterGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ParameterGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticache/replicationgroup/zz_controller.go b/internal/controller/elasticache/replicationgroup/zz_controller.go index 8aecef71b5..b3569dd9c0 100755 --- a/internal/controller/elasticache/replicationgroup/zz_controller.go +++ b/internal/controller/elasticache/replicationgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticache/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReplicationGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_replication_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_replication_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicationGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReplicationGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReplicationGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReplicationGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReplicationGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticache/subnetgroup/zz_controller.go b/internal/controller/elasticache/subnetgroup/zz_controller.go index 29705335ff..43aee113be 100755 --- a/internal/controller/elasticache/subnetgroup/zz_controller.go +++ b/internal/controller/elasticache/subnetgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticache/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_subnet_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_subnet_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SubnetGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SubnetGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SubnetGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticache/user/zz_controller.go b/internal/controller/elasticache/user/zz_controller.go index 30bd714fe9..7ffe1ea103 100755 --- a/internal/controller/elasticache/user/zz_controller.go +++ b/internal/controller/elasticache/user/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticache/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_user"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_user"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.User + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.User{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.User") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticache/usergroup/zz_controller.go b/internal/controller/elasticache/usergroup/zz_controller.go index 8f4abfc818..1ff8249137 100755 --- a/internal/controller/elasticache/usergroup/zz_controller.go +++ b/internal/controller/elasticache/usergroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticache/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_user_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_user_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticbeanstalk/application/zz_controller.go b/internal/controller/elasticbeanstalk/application/zz_controller.go index d7bdb1847c..500f1e731b 100755 --- a/internal/controller/elasticbeanstalk/application/zz_controller.go +++ b/internal/controller/elasticbeanstalk/application/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticbeanstalk/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elastic_beanstalk_application"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elastic_beanstalk_application"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Application + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Application{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Application") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticbeanstalk/applicationversion/zz_controller.go b/internal/controller/elasticbeanstalk/applicationversion/zz_controller.go index 6a52dc6ff0..be411708f1 100755 --- a/internal/controller/elasticbeanstalk/applicationversion/zz_controller.go +++ b/internal/controller/elasticbeanstalk/applicationversion/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticbeanstalk/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ApplicationVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elastic_beanstalk_application_version"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ApplicationVersion_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elastic_beanstalk_application_version"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ApplicationVersion_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ApplicationVersion + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ApplicationVersion{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ApplicationVersion") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApplicationVersion_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticbeanstalk/configurationtemplate/zz_controller.go b/internal/controller/elasticbeanstalk/configurationtemplate/zz_controller.go index 40938c4d28..963240e4ff 100755 --- a/internal/controller/elasticbeanstalk/configurationtemplate/zz_controller.go +++ b/internal/controller/elasticbeanstalk/configurationtemplate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticbeanstalk/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConfigurationTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elastic_beanstalk_configuration_template"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationTemplate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elastic_beanstalk_configuration_template"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConfigurationTemplate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConfigurationTemplate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConfigurationTemplate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConfigurationTemplate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticsearch/domain/zz_controller.go b/internal/controller/elasticsearch/domain/zz_controller.go index dab792ed00..895de1108a 100755 --- a/internal/controller/elasticsearch/domain/zz_controller.go +++ b/internal/controller/elasticsearch/domain/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticsearch/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticsearch_domain"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticsearch_domain"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Domain + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Domain{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Domain") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticsearch/domainpolicy/zz_controller.go b/internal/controller/elasticsearch/domainpolicy/zz_controller.go index 56d87c316e..5c136058c5 100755 --- a/internal/controller/elasticsearch/domainpolicy/zz_controller.go +++ b/internal/controller/elasticsearch/domainpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticsearch/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticsearch_domain_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticsearch_domain_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DomainPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DomainPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DomainPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elasticsearch/domainsamloptions/zz_controller.go b/internal/controller/elasticsearch/domainsamloptions/zz_controller.go index 4f5290fe3f..4cc8a59a66 100755 --- a/internal/controller/elasticsearch/domainsamloptions/zz_controller.go +++ b/internal/controller/elasticsearch/domainsamloptions/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elasticsearch/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainSAMLOptions_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticsearch_domain_saml_options"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainSAMLOptions_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticsearch_domain_saml_options"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainSAMLOptions_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DomainSAMLOptions + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DomainSAMLOptions{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DomainSAMLOptions") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainSAMLOptions_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elastictranscoder/pipeline/zz_controller.go b/internal/controller/elastictranscoder/pipeline/zz_controller.go index eab03ca738..a865014c30 100755 --- a/internal/controller/elastictranscoder/pipeline/zz_controller.go +++ b/internal/controller/elastictranscoder/pipeline/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elastictranscoder/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Pipeline_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elastictranscoder_pipeline"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Pipeline_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elastictranscoder_pipeline"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Pipeline_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Pipeline + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Pipeline{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Pipeline") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Pipeline_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elastictranscoder/preset/zz_controller.go b/internal/controller/elastictranscoder/preset/zz_controller.go index 83bb075fe8..84548b03f1 100755 --- a/internal/controller/elastictranscoder/preset/zz_controller.go +++ b/internal/controller/elastictranscoder/preset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elastictranscoder/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Preset_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elastictranscoder_preset"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Preset_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elastictranscoder_preset"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Preset_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Preset + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Preset{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Preset") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Preset_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elb/appcookiestickinesspolicy/zz_controller.go b/internal/controller/elb/appcookiestickinesspolicy/zz_controller.go index 7d24f31426..9c7253e17a 100755 --- a/internal/controller/elb/appcookiestickinesspolicy/zz_controller.go +++ b/internal/controller/elb/appcookiestickinesspolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elb/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppCookieStickinessPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_app_cookie_stickiness_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppCookieStickinessPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_app_cookie_stickiness_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppCookieStickinessPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AppCookieStickinessPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AppCookieStickinessPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AppCookieStickinessPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppCookieStickinessPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elb/attachment/zz_controller.go b/internal/controller/elb/attachment/zz_controller.go index 41f712d650..3da218fa92 100755 --- a/internal/controller/elb/attachment/zz_controller.go +++ b/internal/controller/elb/attachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elb/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Attachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elb_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Attachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elb_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Attachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Attachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Attachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Attachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Attachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elb/backendserverpolicy/zz_controller.go b/internal/controller/elb/backendserverpolicy/zz_controller.go index 0be7d6b32b..ed572ad16f 100755 --- a/internal/controller/elb/backendserverpolicy/zz_controller.go +++ b/internal/controller/elb/backendserverpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elb/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackendServerPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_load_balancer_backend_server_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BackendServerPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_load_balancer_backend_server_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BackendServerPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BackendServerPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BackendServerPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BackendServerPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BackendServerPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elb/elb/zz_controller.go b/internal/controller/elb/elb/zz_controller.go index f46c3e9291..233985f5bd 100755 --- a/internal/controller/elb/elb/zz_controller.go +++ b/internal/controller/elb/elb/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ELB_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elb"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ELB_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elb"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ELB_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ELB + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ELB{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ELB") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ELB_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elb/lbcookiestickinesspolicy/zz_controller.go b/internal/controller/elb/lbcookiestickinesspolicy/zz_controller.go index 2aa9cfe4ac..35391f593b 100755 --- a/internal/controller/elb/lbcookiestickinesspolicy/zz_controller.go +++ b/internal/controller/elb/lbcookiestickinesspolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elb/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LBCookieStickinessPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_cookie_stickiness_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBCookieStickinessPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_cookie_stickiness_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBCookieStickinessPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LBCookieStickinessPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LBCookieStickinessPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LBCookieStickinessPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LBCookieStickinessPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elb/lbsslnegotiationpolicy/zz_controller.go b/internal/controller/elb/lbsslnegotiationpolicy/zz_controller.go index 4f300812cf..43863472fe 100755 --- a/internal/controller/elb/lbsslnegotiationpolicy/zz_controller.go +++ b/internal/controller/elb/lbsslnegotiationpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elb/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LBSSLNegotiationPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_ssl_negotiation_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBSSLNegotiationPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_ssl_negotiation_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBSSLNegotiationPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LBSSLNegotiationPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LBSSLNegotiationPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LBSSLNegotiationPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LBSSLNegotiationPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elb/listenerpolicy/zz_controller.go b/internal/controller/elb/listenerpolicy/zz_controller.go index 2c1bed0913..5c0003d814 100755 --- a/internal/controller/elb/listenerpolicy/zz_controller.go +++ b/internal/controller/elb/listenerpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elb/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ListenerPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_load_balancer_listener_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ListenerPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_load_balancer_listener_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ListenerPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ListenerPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ListenerPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ListenerPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ListenerPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elb/policy/zz_controller.go b/internal/controller/elb/policy/zz_controller.go index f9785c7137..c8961c82d9 100755 --- a/internal/controller/elb/policy/zz_controller.go +++ b/internal/controller/elb/policy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elb/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_load_balancer_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_load_balancer_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Policy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Policy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Policy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elb/proxyprotocolpolicy/zz_controller.go b/internal/controller/elb/proxyprotocolpolicy/zz_controller.go index 61305cb751..185e08a2a7 100755 --- a/internal/controller/elb/proxyprotocolpolicy/zz_controller.go +++ b/internal/controller/elb/proxyprotocolpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elb/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProxyProtocolPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_proxy_protocol_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProxyProtocolPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_proxy_protocol_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProxyProtocolPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ProxyProtocolPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ProxyProtocolPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ProxyProtocolPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProxyProtocolPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elbv2/lb/zz_controller.go b/internal/controller/elbv2/lb/zz_controller.go index 23bbfe4f59..09359560e3 100755 --- a/internal/controller/elbv2/lb/zz_controller.go +++ b/internal/controller/elbv2/lb/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elbv2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LB_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LB_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LB_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LB + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LB{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LB") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LB_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elbv2/lblistener/zz_controller.go b/internal/controller/elbv2/lblistener/zz_controller.go index 4b4c7d500b..56f0472031 100755 --- a/internal/controller/elbv2/lblistener/zz_controller.go +++ b/internal/controller/elbv2/lblistener/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elbv2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LBListener_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_listener"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBListener_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_listener"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBListener_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LBListener + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LBListener{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LBListener") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LBListener_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elbv2/lblistenercertificate/zz_controller.go b/internal/controller/elbv2/lblistenercertificate/zz_controller.go index 753c416f81..ad28e726fe 100755 --- a/internal/controller/elbv2/lblistenercertificate/zz_controller.go +++ b/internal/controller/elbv2/lblistenercertificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elbv2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LBListenerCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_listener_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBListenerCertificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_listener_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBListenerCertificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LBListenerCertificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LBListenerCertificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LBListenerCertificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LBListenerCertificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elbv2/lblistenerrule/zz_controller.go b/internal/controller/elbv2/lblistenerrule/zz_controller.go index f1929f02eb..c21358f5f4 100755 --- a/internal/controller/elbv2/lblistenerrule/zz_controller.go +++ b/internal/controller/elbv2/lblistenerrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elbv2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LBListenerRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_listener_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBListenerRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_listener_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBListenerRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LBListenerRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LBListenerRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LBListenerRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LBListenerRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elbv2/lbtargetgroup/zz_controller.go b/internal/controller/elbv2/lbtargetgroup/zz_controller.go index 08ed3a68e4..943b365b50 100755 --- a/internal/controller/elbv2/lbtargetgroup/zz_controller.go +++ b/internal/controller/elbv2/lbtargetgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elbv2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LBTargetGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_target_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBTargetGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_target_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBTargetGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LBTargetGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LBTargetGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LBTargetGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LBTargetGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/elbv2/lbtargetgroupattachment/zz_controller.go b/internal/controller/elbv2/lbtargetgroupattachment/zz_controller.go index 5f60c58df5..d670e2c9b3 100755 --- a/internal/controller/elbv2/lbtargetgroupattachment/zz_controller.go +++ b/internal/controller/elbv2/lbtargetgroupattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/elbv2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LBTargetGroupAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_target_group_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBTargetGroupAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lb_target_group_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBTargetGroupAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LBTargetGroupAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LBTargetGroupAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LBTargetGroupAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LBTargetGroupAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/emr/securityconfiguration/zz_controller.go b/internal/controller/emr/securityconfiguration/zz_controller.go index dc945c58b8..b0460c8eb5 100755 --- a/internal/controller/emr/securityconfiguration/zz_controller.go +++ b/internal/controller/emr/securityconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/emr/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecurityConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_emr_security_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecurityConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_emr_security_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecurityConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SecurityConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SecurityConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SecurityConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/emrserverless/application/zz_controller.go b/internal/controller/emrserverless/application/zz_controller.go index a17b59b497..1d31b321ff 100755 --- a/internal/controller/emrserverless/application/zz_controller.go +++ b/internal/controller/emrserverless/application/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/emrserverless/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_emrserverless_application"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_emrserverless_application"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Application + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Application{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Application") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/evidently/feature/zz_controller.go b/internal/controller/evidently/feature/zz_controller.go index b9903655bf..0daf7d81d6 100755 --- a/internal/controller/evidently/feature/zz_controller.go +++ b/internal/controller/evidently/feature/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/evidently/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Feature_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_evidently_feature"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Feature_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_evidently_feature"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Feature_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Feature + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Feature{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Feature") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Feature_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/evidently/project/zz_controller.go b/internal/controller/evidently/project/zz_controller.go index 31cdea6c4a..ef1798d0f1 100755 --- a/internal/controller/evidently/project/zz_controller.go +++ b/internal/controller/evidently/project/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/evidently/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Project_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_evidently_project"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Project_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_evidently_project"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Project_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Project + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Project{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Project") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Project_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/evidently/segment/zz_controller.go b/internal/controller/evidently/segment/zz_controller.go index 6287eaebe4..f854cb0295 100755 --- a/internal/controller/evidently/segment/zz_controller.go +++ b/internal/controller/evidently/segment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/evidently/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Segment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_evidently_segment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Segment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_evidently_segment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Segment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Segment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Segment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Segment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Segment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/firehose/deliverystream/zz_controller.go b/internal/controller/firehose/deliverystream/zz_controller.go index c862464539..e8a2284170 100755 --- a/internal/controller/firehose/deliverystream/zz_controller.go +++ b/internal/controller/firehose/deliverystream/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/firehose/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DeliveryStream_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesis_firehose_delivery_stream"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeliveryStream_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesis_firehose_delivery_stream"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeliveryStream_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DeliveryStream + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DeliveryStream{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DeliveryStream") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DeliveryStream_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/fis/experimenttemplate/zz_controller.go b/internal/controller/fis/experimenttemplate/zz_controller.go index 2b68a2fd7d..977cf52faa 100755 --- a/internal/controller/fis/experimenttemplate/zz_controller.go +++ b/internal/controller/fis/experimenttemplate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/fis/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ExperimentTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fis_experiment_template"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ExperimentTemplate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fis_experiment_template"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ExperimentTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ExperimentTemplate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ExperimentTemplate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ExperimentTemplate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ExperimentTemplate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/fsx/backup/zz_controller.go b/internal/controller/fsx/backup/zz_controller.go index 6e6d272bbb..deaacffbf4 100755 --- a/internal/controller/fsx/backup/zz_controller.go +++ b/internal/controller/fsx/backup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/fsx/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Backup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_backup"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Backup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_backup"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Backup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Backup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Backup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Backup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Backup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/fsx/datarepositoryassociation/zz_controller.go b/internal/controller/fsx/datarepositoryassociation/zz_controller.go index fb9cb7b777..002a2162aa 100755 --- a/internal/controller/fsx/datarepositoryassociation/zz_controller.go +++ b/internal/controller/fsx/datarepositoryassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/fsx/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DataRepositoryAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_data_repository_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataRepositoryAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_data_repository_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataRepositoryAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DataRepositoryAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DataRepositoryAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DataRepositoryAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataRepositoryAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/fsx/lustrefilesystem/zz_controller.go b/internal/controller/fsx/lustrefilesystem/zz_controller.go index a4b85a9821..885285ee79 100755 --- a/internal/controller/fsx/lustrefilesystem/zz_controller.go +++ b/internal/controller/fsx/lustrefilesystem/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/fsx/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LustreFileSystem_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_lustre_file_system"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LustreFileSystem_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_lustre_file_system"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LustreFileSystem_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LustreFileSystem + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LustreFileSystem{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LustreFileSystem") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LustreFileSystem_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/fsx/ontapfilesystem/zz_controller.go b/internal/controller/fsx/ontapfilesystem/zz_controller.go index 0c03b113f9..e967dd5f20 100755 --- a/internal/controller/fsx/ontapfilesystem/zz_controller.go +++ b/internal/controller/fsx/ontapfilesystem/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/fsx/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OntapFileSystem_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_ontap_file_system"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OntapFileSystem_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_ontap_file_system"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OntapFileSystem_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.OntapFileSystem + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.OntapFileSystem{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.OntapFileSystem") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OntapFileSystem_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/fsx/ontapstoragevirtualmachine/zz_controller.go b/internal/controller/fsx/ontapstoragevirtualmachine/zz_controller.go index 7e71d7414c..ad130f7f6c 100755 --- a/internal/controller/fsx/ontapstoragevirtualmachine/zz_controller.go +++ b/internal/controller/fsx/ontapstoragevirtualmachine/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/fsx/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OntapStorageVirtualMachine_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_ontap_storage_virtual_machine"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OntapStorageVirtualMachine_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_ontap_storage_virtual_machine"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OntapStorageVirtualMachine_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.OntapStorageVirtualMachine + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.OntapStorageVirtualMachine{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.OntapStorageVirtualMachine") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OntapStorageVirtualMachine_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/fsx/windowsfilesystem/zz_controller.go b/internal/controller/fsx/windowsfilesystem/zz_controller.go index b843d62413..6a15f798e7 100755 --- a/internal/controller/fsx/windowsfilesystem/zz_controller.go +++ b/internal/controller/fsx/windowsfilesystem/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/fsx/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WindowsFileSystem_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_windows_file_system"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WindowsFileSystem_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_fsx_windows_file_system"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WindowsFileSystem_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.WindowsFileSystem + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.WindowsFileSystem{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.WindowsFileSystem") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.WindowsFileSystem_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/gamelift/alias/zz_controller.go b/internal/controller/gamelift/alias/zz_controller.go index 647f283544..78e3fee9fd 100755 --- a/internal/controller/gamelift/alias/zz_controller.go +++ b/internal/controller/gamelift/alias/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/gamelift/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Alias_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_gamelift_alias"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Alias_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_gamelift_alias"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Alias_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Alias + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Alias{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Alias") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Alias_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/gamelift/build/zz_controller.go b/internal/controller/gamelift/build/zz_controller.go index dc2b12baba..30a12822e1 100755 --- a/internal/controller/gamelift/build/zz_controller.go +++ b/internal/controller/gamelift/build/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/gamelift/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Build_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_gamelift_build"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Build_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_gamelift_build"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Build_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Build + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Build{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Build") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Build_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/gamelift/fleet/zz_controller.go b/internal/controller/gamelift/fleet/zz_controller.go index 148a579ce5..246ec4691b 100755 --- a/internal/controller/gamelift/fleet/zz_controller.go +++ b/internal/controller/gamelift/fleet/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/gamelift/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Fleet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_gamelift_fleet"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Fleet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_gamelift_fleet"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Fleet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Fleet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Fleet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Fleet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Fleet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/gamelift/gamesessionqueue/zz_controller.go b/internal/controller/gamelift/gamesessionqueue/zz_controller.go index deb57b55e8..d2c284749c 100755 --- a/internal/controller/gamelift/gamesessionqueue/zz_controller.go +++ b/internal/controller/gamelift/gamesessionqueue/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/gamelift/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GameSessionQueue_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_gamelift_game_session_queue"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GameSessionQueue_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_gamelift_game_session_queue"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GameSessionQueue_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GameSessionQueue + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GameSessionQueue{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GameSessionQueue") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GameSessionQueue_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/gamelift/script/zz_controller.go b/internal/controller/gamelift/script/zz_controller.go index 30a392b57c..8ee0adf45e 100755 --- a/internal/controller/gamelift/script/zz_controller.go +++ b/internal/controller/gamelift/script/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/gamelift/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Script_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_gamelift_script"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Script_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_gamelift_script"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Script_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Script + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Script{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Script") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Script_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glacier/vault/zz_controller.go b/internal/controller/glacier/vault/zz_controller.go index 4c6baf3dd9..af5fc7ff02 100755 --- a/internal/controller/glacier/vault/zz_controller.go +++ b/internal/controller/glacier/vault/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glacier/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Vault_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glacier_vault"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Vault_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glacier_vault"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Vault_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Vault + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Vault{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Vault") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Vault_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glacier/vaultlock/zz_controller.go b/internal/controller/glacier/vaultlock/zz_controller.go index 48b94b97c5..e6043d4acb 100755 --- a/internal/controller/glacier/vaultlock/zz_controller.go +++ b/internal/controller/glacier/vaultlock/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glacier/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VaultLock_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glacier_vault_lock"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VaultLock_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glacier_vault_lock"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VaultLock_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VaultLock + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VaultLock{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VaultLock") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VaultLock_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/globalaccelerator/accelerator/zz_controller.go b/internal/controller/globalaccelerator/accelerator/zz_controller.go index 5fd548ddae..3728d91de5 100755 --- a/internal/controller/globalaccelerator/accelerator/zz_controller.go +++ b/internal/controller/globalaccelerator/accelerator/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/globalaccelerator/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Accelerator_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_globalaccelerator_accelerator"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Accelerator_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_globalaccelerator_accelerator"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Accelerator_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Accelerator + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Accelerator{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Accelerator") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Accelerator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/globalaccelerator/endpointgroup/zz_controller.go b/internal/controller/globalaccelerator/endpointgroup/zz_controller.go index 59be0a3a2f..a4e1bc235e 100755 --- a/internal/controller/globalaccelerator/endpointgroup/zz_controller.go +++ b/internal/controller/globalaccelerator/endpointgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/globalaccelerator/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EndpointGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_globalaccelerator_endpoint_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EndpointGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_globalaccelerator_endpoint_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EndpointGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EndpointGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EndpointGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EndpointGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EndpointGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/globalaccelerator/listener/zz_controller.go b/internal/controller/globalaccelerator/listener/zz_controller.go index a3570be37f..51e70573d7 100755 --- a/internal/controller/globalaccelerator/listener/zz_controller.go +++ b/internal/controller/globalaccelerator/listener/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/globalaccelerator/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Listener_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_globalaccelerator_listener"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Listener_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_globalaccelerator_listener"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Listener_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Listener + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Listener{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Listener") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Listener_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/catalogdatabase/zz_controller.go b/internal/controller/glue/catalogdatabase/zz_controller.go index 92da262dd7..d33f29ac9c 100755 --- a/internal/controller/glue/catalogdatabase/zz_controller.go +++ b/internal/controller/glue/catalogdatabase/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CatalogDatabase_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_catalog_database"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CatalogDatabase_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_catalog_database"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CatalogDatabase_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CatalogDatabase + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CatalogDatabase{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CatalogDatabase") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CatalogDatabase_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/catalogtable/zz_controller.go b/internal/controller/glue/catalogtable/zz_controller.go index 78b89b6933..c47ec80fc6 100755 --- a/internal/controller/glue/catalogtable/zz_controller.go +++ b/internal/controller/glue/catalogtable/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CatalogTable_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_catalog_table"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CatalogTable_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_catalog_table"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CatalogTable_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CatalogTable + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CatalogTable{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CatalogTable") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CatalogTable_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/classifier/zz_controller.go b/internal/controller/glue/classifier/zz_controller.go index 0f4092d3cf..e954309a01 100755 --- a/internal/controller/glue/classifier/zz_controller.go +++ b/internal/controller/glue/classifier/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Classifier_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_classifier"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Classifier_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_classifier"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Classifier_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Classifier + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Classifier{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Classifier") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Classifier_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/connection/zz_controller.go b/internal/controller/glue/connection/zz_controller.go index 8787787c93..28c2eb4003 100755 --- a/internal/controller/glue/connection/zz_controller.go +++ b/internal/controller/glue/connection/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_connection"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_connection"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Connection + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Connection{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Connection") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/crawler/zz_controller.go b/internal/controller/glue/crawler/zz_controller.go index 11fb1b75f9..d290e93959 100755 --- a/internal/controller/glue/crawler/zz_controller.go +++ b/internal/controller/glue/crawler/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Crawler_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_crawler"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Crawler_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_crawler"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Crawler_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Crawler + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Crawler{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Crawler") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Crawler_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/datacatalogencryptionsettings/zz_controller.go b/internal/controller/glue/datacatalogencryptionsettings/zz_controller.go index a735349ed1..cbc68c8685 100755 --- a/internal/controller/glue/datacatalogencryptionsettings/zz_controller.go +++ b/internal/controller/glue/datacatalogencryptionsettings/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DataCatalogEncryptionSettings_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_data_catalog_encryption_settings"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataCatalogEncryptionSettings_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_data_catalog_encryption_settings"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataCatalogEncryptionSettings_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DataCatalogEncryptionSettings + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DataCatalogEncryptionSettings{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DataCatalogEncryptionSettings") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataCatalogEncryptionSettings_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/job/zz_controller.go b/internal/controller/glue/job/zz_controller.go index 7f55a86cfd..f7129d31da 100755 --- a/internal/controller/glue/job/zz_controller.go +++ b/internal/controller/glue/job/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_job"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Job_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_job"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Job_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Job + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Job{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Job") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/registry/zz_controller.go b/internal/controller/glue/registry/zz_controller.go index dc84fc300d..27cf2df297 100755 --- a/internal/controller/glue/registry/zz_controller.go +++ b/internal/controller/glue/registry/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Registry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_registry"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Registry_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_registry"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Registry_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Registry + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Registry{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Registry") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Registry_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/resourcepolicy/zz_controller.go b/internal/controller/glue/resourcepolicy/zz_controller.go index 866c5b858d..04bc9128f6 100755 --- a/internal/controller/glue/resourcepolicy/zz_controller.go +++ b/internal/controller/glue/resourcepolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourcePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_resource_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourcePolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_resource_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourcePolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResourcePolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResourcePolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResourcePolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourcePolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/schema/zz_controller.go b/internal/controller/glue/schema/zz_controller.go index 42de3eb7b8..3dd6bbe79c 100755 --- a/internal/controller/glue/schema/zz_controller.go +++ b/internal/controller/glue/schema/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Schema_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_schema"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Schema_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_schema"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Schema_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Schema + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Schema{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Schema") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Schema_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/securityconfiguration/zz_controller.go b/internal/controller/glue/securityconfiguration/zz_controller.go index 4b5480baf2..768d07a5dc 100755 --- a/internal/controller/glue/securityconfiguration/zz_controller.go +++ b/internal/controller/glue/securityconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecurityConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_security_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecurityConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_security_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecurityConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SecurityConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SecurityConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SecurityConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecurityConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/trigger/zz_controller.go b/internal/controller/glue/trigger/zz_controller.go index 7b4ad47348..e8db55aaf5 100755 --- a/internal/controller/glue/trigger/zz_controller.go +++ b/internal/controller/glue/trigger/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Trigger_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_trigger"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Trigger_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_trigger"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Trigger_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Trigger + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Trigger{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Trigger") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Trigger_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/userdefinedfunction/zz_controller.go b/internal/controller/glue/userdefinedfunction/zz_controller.go index 0aeeefada2..d2f158c837 100755 --- a/internal/controller/glue/userdefinedfunction/zz_controller.go +++ b/internal/controller/glue/userdefinedfunction/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserDefinedFunction_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_user_defined_function"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserDefinedFunction_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_user_defined_function"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserDefinedFunction_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserDefinedFunction + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserDefinedFunction{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserDefinedFunction") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserDefinedFunction_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/glue/workflow/zz_controller.go b/internal/controller/glue/workflow/zz_controller.go index d5d82a8a75..6823ebf6f6 100755 --- a/internal/controller/glue/workflow/zz_controller.go +++ b/internal/controller/glue/workflow/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/glue/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Workflow_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_workflow"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workflow_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_glue_workflow"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workflow_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Workflow + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Workflow{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Workflow") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Workflow_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/grafana/licenseassociation/zz_controller.go b/internal/controller/grafana/licenseassociation/zz_controller.go index 5473b81a99..dbc395205f 100755 --- a/internal/controller/grafana/licenseassociation/zz_controller.go +++ b/internal/controller/grafana/licenseassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/grafana/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LicenseAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_grafana_license_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LicenseAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_grafana_license_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LicenseAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LicenseAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LicenseAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LicenseAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LicenseAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/grafana/roleassociation/zz_controller.go b/internal/controller/grafana/roleassociation/zz_controller.go index ef31289ab7..f2ca96ddba 100755 --- a/internal/controller/grafana/roleassociation/zz_controller.go +++ b/internal/controller/grafana/roleassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/grafana/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RoleAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_grafana_role_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RoleAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_grafana_role_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RoleAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RoleAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RoleAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RoleAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RoleAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/grafana/workspace/zz_controller.go b/internal/controller/grafana/workspace/zz_controller.go index 0d20cfb42d..e658b3dff3 100755 --- a/internal/controller/grafana/workspace/zz_controller.go +++ b/internal/controller/grafana/workspace/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/grafana/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Workspace_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_grafana_workspace"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workspace_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_grafana_workspace"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workspace_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Workspace + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Workspace{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Workspace") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Workspace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/grafana/workspaceapikey/zz_controller.go b/internal/controller/grafana/workspaceapikey/zz_controller.go index 43de86ade3..b5b6affa5b 100755 --- a/internal/controller/grafana/workspaceapikey/zz_controller.go +++ b/internal/controller/grafana/workspaceapikey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/grafana/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WorkspaceAPIKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_grafana_workspace_api_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WorkspaceAPIKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_grafana_workspace_api_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WorkspaceAPIKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.WorkspaceAPIKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.WorkspaceAPIKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.WorkspaceAPIKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.WorkspaceAPIKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/grafana/workspacesamlconfiguration/zz_controller.go b/internal/controller/grafana/workspacesamlconfiguration/zz_controller.go index 1094aef6d4..c256ad8753 100755 --- a/internal/controller/grafana/workspacesamlconfiguration/zz_controller.go +++ b/internal/controller/grafana/workspacesamlconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/grafana/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WorkspaceSAMLConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_grafana_workspace_saml_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WorkspaceSAMLConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_grafana_workspace_saml_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WorkspaceSAMLConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.WorkspaceSAMLConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.WorkspaceSAMLConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.WorkspaceSAMLConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.WorkspaceSAMLConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/guardduty/detector/zz_controller.go b/internal/controller/guardduty/detector/zz_controller.go index 774614e46a..07a78f984e 100755 --- a/internal/controller/guardduty/detector/zz_controller.go +++ b/internal/controller/guardduty/detector/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/guardduty/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Detector_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_guardduty_detector"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Detector_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_guardduty_detector"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Detector_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Detector + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Detector{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Detector") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Detector_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/guardduty/filter/zz_controller.go b/internal/controller/guardduty/filter/zz_controller.go index bfc7e93c18..89c4b71fd2 100755 --- a/internal/controller/guardduty/filter/zz_controller.go +++ b/internal/controller/guardduty/filter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/guardduty/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Filter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_guardduty_filter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Filter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_guardduty_filter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Filter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Filter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Filter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Filter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Filter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/guardduty/member/zz_controller.go b/internal/controller/guardduty/member/zz_controller.go index 1f91b67205..5afa48fae6 100755 --- a/internal/controller/guardduty/member/zz_controller.go +++ b/internal/controller/guardduty/member/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/guardduty/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_guardduty_member"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Member_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_guardduty_member"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Member_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Member + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Member{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Member") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/accesskey/zz_controller.go b/internal/controller/iam/accesskey/zz_controller.go index 3616df103f..46f5fb9cc4 100755 --- a/internal/controller/iam/accesskey/zz_controller.go +++ b/internal/controller/iam/accesskey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_access_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_access_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AccessKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AccessKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AccessKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AccessKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/accountalias/zz_controller.go b/internal/controller/iam/accountalias/zz_controller.go index c04a09872c..278d07e940 100755 --- a/internal/controller/iam/accountalias/zz_controller.go +++ b/internal/controller/iam/accountalias/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccountAlias_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_account_alias"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccountAlias_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_account_alias"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccountAlias_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AccountAlias + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AccountAlias{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AccountAlias") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AccountAlias_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/accountpasswordpolicy/zz_controller.go b/internal/controller/iam/accountpasswordpolicy/zz_controller.go index 6f623ed0c1..57c102454a 100755 --- a/internal/controller/iam/accountpasswordpolicy/zz_controller.go +++ b/internal/controller/iam/accountpasswordpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccountPasswordPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_account_password_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccountPasswordPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_account_password_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccountPasswordPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AccountPasswordPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AccountPasswordPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AccountPasswordPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AccountPasswordPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/group/zz_controller.go b/internal/controller/iam/group/zz_controller.go index 4c5aa3c962..8ab0970098 100755 --- a/internal/controller/iam/group/zz_controller.go +++ b/internal/controller/iam/group/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Group + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Group{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Group") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/groupmembership/zz_controller.go b/internal/controller/iam/groupmembership/zz_controller.go index 899562f996..63a1e8af8c 100755 --- a/internal/controller/iam/groupmembership/zz_controller.go +++ b/internal/controller/iam/groupmembership/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GroupMembership_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_group_membership"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GroupMembership_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_group_membership"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GroupMembership_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GroupMembership + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GroupMembership{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GroupMembership") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GroupMembership_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/grouppolicyattachment/zz_controller.go b/internal/controller/iam/grouppolicyattachment/zz_controller.go index dd44738138..ce09ac5fc3 100755 --- a/internal/controller/iam/grouppolicyattachment/zz_controller.go +++ b/internal/controller/iam/grouppolicyattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GroupPolicyAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_group_policy_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GroupPolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_group_policy_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GroupPolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GroupPolicyAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GroupPolicyAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GroupPolicyAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GroupPolicyAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/instanceprofile/zz_controller.go b/internal/controller/iam/instanceprofile/zz_controller.go index c18305fc75..2a7055e74a 100755 --- a/internal/controller/iam/instanceprofile/zz_controller.go +++ b/internal/controller/iam/instanceprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_instance_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_instance_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InstanceProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InstanceProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InstanceProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InstanceProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/openidconnectprovider/zz_controller.go b/internal/controller/iam/openidconnectprovider/zz_controller.go index b27f5eaf0d..3c3e4992d2 100755 --- a/internal/controller/iam/openidconnectprovider/zz_controller.go +++ b/internal/controller/iam/openidconnectprovider/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OpenIDConnectProvider_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_openid_connect_provider"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OpenIDConnectProvider_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_openid_connect_provider"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OpenIDConnectProvider_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.OpenIDConnectProvider + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.OpenIDConnectProvider{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.OpenIDConnectProvider") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OpenIDConnectProvider_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/policy/zz_controller.go b/internal/controller/iam/policy/zz_controller.go index db1e2e84a0..f685c2a33c 100755 --- a/internal/controller/iam/policy/zz_controller.go +++ b/internal/controller/iam/policy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Policy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Policy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Policy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/role/zz_controller.go b/internal/controller/iam/role/zz_controller.go index 71660114b5..d8105685c1 100755 --- a/internal/controller/iam/role/zz_controller.go +++ b/internal/controller/iam/role/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Role_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_role"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Role_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_role"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Role_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Role + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Role{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Role") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Role_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/rolepolicy/zz_controller.go b/internal/controller/iam/rolepolicy/zz_controller.go index 0feeac504b..d762017b0c 100755 --- a/internal/controller/iam/rolepolicy/zz_controller.go +++ b/internal/controller/iam/rolepolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RolePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_role_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RolePolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_role_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RolePolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RolePolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RolePolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RolePolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RolePolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/rolepolicyattachment/zz_controller.go b/internal/controller/iam/rolepolicyattachment/zz_controller.go index 75cabe0250..9cc4856745 100755 --- a/internal/controller/iam/rolepolicyattachment/zz_controller.go +++ b/internal/controller/iam/rolepolicyattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RolePolicyAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_role_policy_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RolePolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_role_policy_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RolePolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RolePolicyAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RolePolicyAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RolePolicyAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RolePolicyAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/samlprovider/zz_controller.go b/internal/controller/iam/samlprovider/zz_controller.go index 6c3f1bc1c1..aebfb63b14 100755 --- a/internal/controller/iam/samlprovider/zz_controller.go +++ b/internal/controller/iam/samlprovider/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SAMLProvider_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_saml_provider"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SAMLProvider_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_saml_provider"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SAMLProvider_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SAMLProvider + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SAMLProvider{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SAMLProvider") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SAMLProvider_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/servercertificate/zz_controller.go b/internal/controller/iam/servercertificate/zz_controller.go index db950ee3f7..8b4dcde1ae 100755 --- a/internal/controller/iam/servercertificate/zz_controller.go +++ b/internal/controller/iam/servercertificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServerCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_server_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServerCertificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_server_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServerCertificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ServerCertificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ServerCertificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ServerCertificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ServerCertificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/servicelinkedrole/zz_controller.go b/internal/controller/iam/servicelinkedrole/zz_controller.go index e2948cce19..fbf1d0fd79 100755 --- a/internal/controller/iam/servicelinkedrole/zz_controller.go +++ b/internal/controller/iam/servicelinkedrole/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceLinkedRole_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_service_linked_role"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceLinkedRole_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_service_linked_role"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceLinkedRole_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ServiceLinkedRole + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ServiceLinkedRole{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ServiceLinkedRole") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ServiceLinkedRole_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/servicespecificcredential/zz_controller.go b/internal/controller/iam/servicespecificcredential/zz_controller.go index ed33ce1273..67e6c106c1 100755 --- a/internal/controller/iam/servicespecificcredential/zz_controller.go +++ b/internal/controller/iam/servicespecificcredential/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceSpecificCredential_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_service_specific_credential"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceSpecificCredential_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_service_specific_credential"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceSpecificCredential_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ServiceSpecificCredential + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ServiceSpecificCredential{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ServiceSpecificCredential") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ServiceSpecificCredential_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/signingcertificate/zz_controller.go b/internal/controller/iam/signingcertificate/zz_controller.go index d85a33e427..b401688d4e 100755 --- a/internal/controller/iam/signingcertificate/zz_controller.go +++ b/internal/controller/iam/signingcertificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SigningCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_signing_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SigningCertificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_signing_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SigningCertificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SigningCertificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SigningCertificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SigningCertificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SigningCertificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/user/zz_controller.go b/internal/controller/iam/user/zz_controller.go index 9ce11100dd..a5c9cbaf42 100755 --- a/internal/controller/iam/user/zz_controller.go +++ b/internal/controller/iam/user/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_user"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_user"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.User + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.User{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.User") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/usergroupmembership/zz_controller.go b/internal/controller/iam/usergroupmembership/zz_controller.go index 8a2a0c83e6..4bed003022 100755 --- a/internal/controller/iam/usergroupmembership/zz_controller.go +++ b/internal/controller/iam/usergroupmembership/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserGroupMembership_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_user_group_membership"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserGroupMembership_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_user_group_membership"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserGroupMembership_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserGroupMembership + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserGroupMembership{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserGroupMembership") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserGroupMembership_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/userloginprofile/zz_controller.go b/internal/controller/iam/userloginprofile/zz_controller.go index c8bf01595d..3459b936d3 100755 --- a/internal/controller/iam/userloginprofile/zz_controller.go +++ b/internal/controller/iam/userloginprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserLoginProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_user_login_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserLoginProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_user_login_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserLoginProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserLoginProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserLoginProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserLoginProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserLoginProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/userpolicyattachment/zz_controller.go b/internal/controller/iam/userpolicyattachment/zz_controller.go index dad46f84d3..9ac82a5fc8 100755 --- a/internal/controller/iam/userpolicyattachment/zz_controller.go +++ b/internal/controller/iam/userpolicyattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserPolicyAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_user_policy_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserPolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_user_policy_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserPolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserPolicyAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserPolicyAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserPolicyAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserPolicyAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/usersshkey/zz_controller.go b/internal/controller/iam/usersshkey/zz_controller.go index efbecb2e13..02fc42e037 100755 --- a/internal/controller/iam/usersshkey/zz_controller.go +++ b/internal/controller/iam/usersshkey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserSSHKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_user_ssh_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserSSHKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_user_ssh_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserSSHKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserSSHKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserSSHKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserSSHKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserSSHKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iam/virtualmfadevice/zz_controller.go b/internal/controller/iam/virtualmfadevice/zz_controller.go index 624d9e4dff..1fbdf7446e 100755 --- a/internal/controller/iam/virtualmfadevice/zz_controller.go +++ b/internal/controller/iam/virtualmfadevice/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iam/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VirtualMfaDevice_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_virtual_mfa_device"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VirtualMfaDevice_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iam_virtual_mfa_device"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VirtualMfaDevice_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VirtualMfaDevice + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VirtualMfaDevice{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VirtualMfaDevice") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VirtualMfaDevice_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/identitystore/group/zz_controller.go b/internal/controller/identitystore/group/zz_controller.go index 35c06502fc..9d696b3d70 100755 --- a/internal/controller/identitystore/group/zz_controller.go +++ b/internal/controller/identitystore/group/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/identitystore/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_identitystore_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_identitystore_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Group + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Group{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Group") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/identitystore/groupmembership/zz_controller.go b/internal/controller/identitystore/groupmembership/zz_controller.go index 51e1fb839a..2617ef20e1 100755 --- a/internal/controller/identitystore/groupmembership/zz_controller.go +++ b/internal/controller/identitystore/groupmembership/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/identitystore/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GroupMembership_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_identitystore_group_membership"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GroupMembership_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_identitystore_group_membership"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GroupMembership_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GroupMembership + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GroupMembership{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GroupMembership") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GroupMembership_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/identitystore/user/zz_controller.go b/internal/controller/identitystore/user/zz_controller.go index 5369de0c06..a0b5ffb68e 100755 --- a/internal/controller/identitystore/user/zz_controller.go +++ b/internal/controller/identitystore/user/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/identitystore/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_identitystore_user"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_identitystore_user"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.User + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.User{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.User") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/imagebuilder/component/zz_controller.go b/internal/controller/imagebuilder/component/zz_controller.go index d05af37d99..8d765b5ea1 100755 --- a/internal/controller/imagebuilder/component/zz_controller.go +++ b/internal/controller/imagebuilder/component/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/imagebuilder/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Component_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_component"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Component_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_component"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Component_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Component + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Component{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Component") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Component_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/imagebuilder/containerrecipe/zz_controller.go b/internal/controller/imagebuilder/containerrecipe/zz_controller.go index 0dff055f13..0b1d910a14 100755 --- a/internal/controller/imagebuilder/containerrecipe/zz_controller.go +++ b/internal/controller/imagebuilder/containerrecipe/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/imagebuilder/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ContainerRecipe_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_container_recipe"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContainerRecipe_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_container_recipe"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContainerRecipe_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ContainerRecipe + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ContainerRecipe{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ContainerRecipe") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ContainerRecipe_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/imagebuilder/distributionconfiguration/zz_controller.go b/internal/controller/imagebuilder/distributionconfiguration/zz_controller.go index cd8fbf2a2d..84af33699f 100755 --- a/internal/controller/imagebuilder/distributionconfiguration/zz_controller.go +++ b/internal/controller/imagebuilder/distributionconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/imagebuilder/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DistributionConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_distribution_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DistributionConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_distribution_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DistributionConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DistributionConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DistributionConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DistributionConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DistributionConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/imagebuilder/image/zz_controller.go b/internal/controller/imagebuilder/image/zz_controller.go index 20028ff0d0..7cc1f057c5 100755 --- a/internal/controller/imagebuilder/image/zz_controller.go +++ b/internal/controller/imagebuilder/image/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/imagebuilder/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Image_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_image"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Image_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_image"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Image_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Image + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Image{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Image") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Image_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/imagebuilder/imagepipeline/zz_controller.go b/internal/controller/imagebuilder/imagepipeline/zz_controller.go index 89021b135b..2d45395095 100755 --- a/internal/controller/imagebuilder/imagepipeline/zz_controller.go +++ b/internal/controller/imagebuilder/imagepipeline/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/imagebuilder/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ImagePipeline_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_image_pipeline"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ImagePipeline_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_image_pipeline"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ImagePipeline_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ImagePipeline + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ImagePipeline{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ImagePipeline") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ImagePipeline_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/imagebuilder/imagerecipe/zz_controller.go b/internal/controller/imagebuilder/imagerecipe/zz_controller.go index bdd8a0aef6..3201f3c253 100755 --- a/internal/controller/imagebuilder/imagerecipe/zz_controller.go +++ b/internal/controller/imagebuilder/imagerecipe/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/imagebuilder/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ImageRecipe_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_image_recipe"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ImageRecipe_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_image_recipe"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ImageRecipe_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ImageRecipe + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ImageRecipe{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ImageRecipe") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ImageRecipe_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/imagebuilder/infrastructureconfiguration/zz_controller.go b/internal/controller/imagebuilder/infrastructureconfiguration/zz_controller.go index 9f0fe63a91..fee9c30261 100755 --- a/internal/controller/imagebuilder/infrastructureconfiguration/zz_controller.go +++ b/internal/controller/imagebuilder/infrastructureconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/imagebuilder/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InfrastructureConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_infrastructure_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InfrastructureConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_imagebuilder_infrastructure_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InfrastructureConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InfrastructureConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InfrastructureConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InfrastructureConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InfrastructureConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/inspector/assessmenttarget/zz_controller.go b/internal/controller/inspector/assessmenttarget/zz_controller.go index f4c4181095..6d846f4be5 100755 --- a/internal/controller/inspector/assessmenttarget/zz_controller.go +++ b/internal/controller/inspector/assessmenttarget/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/inspector/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AssessmentTarget_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_inspector_assessment_target"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AssessmentTarget_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_inspector_assessment_target"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AssessmentTarget_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AssessmentTarget + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AssessmentTarget{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AssessmentTarget") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AssessmentTarget_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/inspector/assessmenttemplate/zz_controller.go b/internal/controller/inspector/assessmenttemplate/zz_controller.go index 6379f6e378..edadb677bc 100755 --- a/internal/controller/inspector/assessmenttemplate/zz_controller.go +++ b/internal/controller/inspector/assessmenttemplate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/inspector/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AssessmentTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_inspector_assessment_template"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AssessmentTemplate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_inspector_assessment_template"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AssessmentTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AssessmentTemplate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AssessmentTemplate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AssessmentTemplate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AssessmentTemplate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/inspector/resourcegroup/zz_controller.go b/internal/controller/inspector/resourcegroup/zz_controller.go index 99053509d0..838f704910 100755 --- a/internal/controller/inspector/resourcegroup/zz_controller.go +++ b/internal/controller/inspector/resourcegroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/inspector/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourceGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_inspector_resource_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_inspector_resource_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResourceGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResourceGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResourceGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourceGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/inspector2/enabler/zz_controller.go b/internal/controller/inspector2/enabler/zz_controller.go index f871b55f9b..183bd89ca5 100755 --- a/internal/controller/inspector2/enabler/zz_controller.go +++ b/internal/controller/inspector2/enabler/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/inspector2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Enabler_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_inspector2_enabler"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Enabler_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_inspector2_enabler"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Enabler_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Enabler + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Enabler{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Enabler") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Enabler_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/certificate/zz_controller.go b/internal/controller/iot/certificate/zz_controller.go index f192fb15e1..1f3e0f4e1e 100755 --- a/internal/controller/iot/certificate/zz_controller.go +++ b/internal/controller/iot/certificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Certificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Certificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Certificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/indexingconfiguration/zz_controller.go b/internal/controller/iot/indexingconfiguration/zz_controller.go index 299a09151c..eaae32ef95 100755 --- a/internal/controller/iot/indexingconfiguration/zz_controller.go +++ b/internal/controller/iot/indexingconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IndexingConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_indexing_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IndexingConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_indexing_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IndexingConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.IndexingConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.IndexingConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.IndexingConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IndexingConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/loggingoptions/zz_controller.go b/internal/controller/iot/loggingoptions/zz_controller.go index 33af598154..5d8c287825 100755 --- a/internal/controller/iot/loggingoptions/zz_controller.go +++ b/internal/controller/iot/loggingoptions/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LoggingOptions_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_logging_options"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LoggingOptions_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_logging_options"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LoggingOptions_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LoggingOptions + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LoggingOptions{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LoggingOptions") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LoggingOptions_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/policy/zz_controller.go b/internal/controller/iot/policy/zz_controller.go index 8faba3c8b2..2914691e0f 100755 --- a/internal/controller/iot/policy/zz_controller.go +++ b/internal/controller/iot/policy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Policy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Policy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Policy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/policyattachment/zz_controller.go b/internal/controller/iot/policyattachment/zz_controller.go index d80735bece..aa984b6ea7 100755 --- a/internal/controller/iot/policyattachment/zz_controller.go +++ b/internal/controller/iot/policyattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PolicyAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_policy_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_policy_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PolicyAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PolicyAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PolicyAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PolicyAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/provisioningtemplate/zz_controller.go b/internal/controller/iot/provisioningtemplate/zz_controller.go index 2ba6d360f1..0bf64f9f97 100755 --- a/internal/controller/iot/provisioningtemplate/zz_controller.go +++ b/internal/controller/iot/provisioningtemplate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProvisioningTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_provisioning_template"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProvisioningTemplate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_provisioning_template"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProvisioningTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ProvisioningTemplate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ProvisioningTemplate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ProvisioningTemplate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProvisioningTemplate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/rolealias/zz_controller.go b/internal/controller/iot/rolealias/zz_controller.go index c8b9b4d250..5814534e48 100755 --- a/internal/controller/iot/rolealias/zz_controller.go +++ b/internal/controller/iot/rolealias/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RoleAlias_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_role_alias"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RoleAlias_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_role_alias"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RoleAlias_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RoleAlias + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RoleAlias{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RoleAlias") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RoleAlias_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/thing/zz_controller.go b/internal/controller/iot/thing/zz_controller.go index e538e6f4e6..19456a0803 100755 --- a/internal/controller/iot/thing/zz_controller.go +++ b/internal/controller/iot/thing/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Thing_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_thing"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Thing_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_thing"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Thing_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Thing + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Thing{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Thing") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Thing_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/thinggroup/zz_controller.go b/internal/controller/iot/thinggroup/zz_controller.go index f13d9889e0..a98a82a01a 100755 --- a/internal/controller/iot/thinggroup/zz_controller.go +++ b/internal/controller/iot/thinggroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ThingGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_thing_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ThingGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_thing_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ThingGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ThingGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ThingGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ThingGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ThingGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/thinggroupmembership/zz_controller.go b/internal/controller/iot/thinggroupmembership/zz_controller.go index 76088aa06c..039f503095 100755 --- a/internal/controller/iot/thinggroupmembership/zz_controller.go +++ b/internal/controller/iot/thinggroupmembership/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ThingGroupMembership_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_thing_group_membership"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ThingGroupMembership_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_thing_group_membership"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ThingGroupMembership_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ThingGroupMembership + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ThingGroupMembership{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ThingGroupMembership") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ThingGroupMembership_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/thingprincipalattachment/zz_controller.go b/internal/controller/iot/thingprincipalattachment/zz_controller.go index 7c841662a8..b2ffe8c7cb 100755 --- a/internal/controller/iot/thingprincipalattachment/zz_controller.go +++ b/internal/controller/iot/thingprincipalattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ThingPrincipalAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_thing_principal_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ThingPrincipalAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_thing_principal_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ThingPrincipalAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ThingPrincipalAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ThingPrincipalAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ThingPrincipalAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ThingPrincipalAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/thingtype/zz_controller.go b/internal/controller/iot/thingtype/zz_controller.go index 79f8c8fba9..c022766be0 100755 --- a/internal/controller/iot/thingtype/zz_controller.go +++ b/internal/controller/iot/thingtype/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ThingType_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_thing_type"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ThingType_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_thing_type"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ThingType_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ThingType + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ThingType{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ThingType") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ThingType_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/topicrule/zz_controller.go b/internal/controller/iot/topicrule/zz_controller.go index 99a0026ef2..ca40d86075 100755 --- a/internal/controller/iot/topicrule/zz_controller.go +++ b/internal/controller/iot/topicrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TopicRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_topic_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TopicRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_topic_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TopicRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TopicRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TopicRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TopicRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TopicRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/iot/topicruledestination/zz_controller.go b/internal/controller/iot/topicruledestination/zz_controller.go index 7f3ca75568..a7514d9667 100755 --- a/internal/controller/iot/topicruledestination/zz_controller.go +++ b/internal/controller/iot/topicruledestination/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/iot/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TopicRuleDestination_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_topic_rule_destination"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TopicRuleDestination_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_iot_topic_rule_destination"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TopicRuleDestination_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TopicRuleDestination + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TopicRuleDestination{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TopicRuleDestination") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TopicRuleDestination_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ivs/channel/zz_controller.go b/internal/controller/ivs/channel/zz_controller.go index 967f4ca17f..d374c5a323 100755 --- a/internal/controller/ivs/channel/zz_controller.go +++ b/internal/controller/ivs/channel/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ivs/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Channel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ivs_channel"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Channel_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ivs_channel"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Channel_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Channel + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Channel{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Channel") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Channel_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ivs/recordingconfiguration/zz_controller.go b/internal/controller/ivs/recordingconfiguration/zz_controller.go index ab0ac2ca09..ad44cacff3 100755 --- a/internal/controller/ivs/recordingconfiguration/zz_controller.go +++ b/internal/controller/ivs/recordingconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ivs/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RecordingConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ivs_recording_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RecordingConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ivs_recording_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RecordingConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RecordingConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RecordingConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RecordingConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RecordingConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kafka/cluster/zz_controller.go b/internal/controller/kafka/cluster/zz_controller.go index eafe19c308..f3e068e7f4 100755 --- a/internal/controller/kafka/cluster/zz_controller.go +++ b/internal/controller/kafka/cluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kafka/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_msk_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_msk_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kafka/configuration/zz_controller.go b/internal/controller/kafka/configuration/zz_controller.go index 59503b41cc..2ae9e9a49c 100755 --- a/internal/controller/kafka/configuration/zz_controller.go +++ b/internal/controller/kafka/configuration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kafka/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Configuration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_msk_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Configuration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_msk_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Configuration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Configuration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Configuration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Configuration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Configuration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kafka/scramsecretassociation/zz_controller.go b/internal/controller/kafka/scramsecretassociation/zz_controller.go index dfbdc19939..e3955cc9af 100755 --- a/internal/controller/kafka/scramsecretassociation/zz_controller.go +++ b/internal/controller/kafka/scramsecretassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kafka/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ScramSecretAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_msk_scram_secret_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ScramSecretAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_msk_scram_secret_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ScramSecretAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ScramSecretAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ScramSecretAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ScramSecretAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ScramSecretAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kafka/serverlesscluster/zz_controller.go b/internal/controller/kafka/serverlesscluster/zz_controller.go index 094ee8eca6..d2d5788103 100755 --- a/internal/controller/kafka/serverlesscluster/zz_controller.go +++ b/internal/controller/kafka/serverlesscluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kafka/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServerlessCluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_msk_serverless_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServerlessCluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_msk_serverless_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServerlessCluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ServerlessCluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ServerlessCluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ServerlessCluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ServerlessCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kendra/datasource/zz_controller.go b/internal/controller/kendra/datasource/zz_controller.go index 8b243f7d75..b3d515511f 100755 --- a/internal/controller/kendra/datasource/zz_controller.go +++ b/internal/controller/kendra/datasource/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kendra/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DataSource_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kendra_data_source"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataSource_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kendra_data_source"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataSource_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DataSource + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DataSource{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DataSource") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataSource_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kendra/experience/zz_controller.go b/internal/controller/kendra/experience/zz_controller.go index 264e1d9015..271ca802e6 100755 --- a/internal/controller/kendra/experience/zz_controller.go +++ b/internal/controller/kendra/experience/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kendra/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Experience_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kendra_experience"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Experience_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kendra_experience"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Experience_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Experience + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Experience{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Experience") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Experience_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kendra/index/zz_controller.go b/internal/controller/kendra/index/zz_controller.go index ea43954486..f36703bcfa 100755 --- a/internal/controller/kendra/index/zz_controller.go +++ b/internal/controller/kendra/index/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kendra/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Index_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kendra_index"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Index_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kendra_index"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Index_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Index + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Index{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Index") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Index_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kendra/querysuggestionsblocklist/zz_controller.go b/internal/controller/kendra/querysuggestionsblocklist/zz_controller.go index 094e5d5223..de238e765d 100755 --- a/internal/controller/kendra/querysuggestionsblocklist/zz_controller.go +++ b/internal/controller/kendra/querysuggestionsblocklist/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kendra/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.QuerySuggestionsBlockList_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kendra_query_suggestions_block_list"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.QuerySuggestionsBlockList_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kendra_query_suggestions_block_list"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.QuerySuggestionsBlockList_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.QuerySuggestionsBlockList + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.QuerySuggestionsBlockList{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.QuerySuggestionsBlockList") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.QuerySuggestionsBlockList_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kendra/thesaurus/zz_controller.go b/internal/controller/kendra/thesaurus/zz_controller.go index c6f4d2aba9..6c057c2026 100755 --- a/internal/controller/kendra/thesaurus/zz_controller.go +++ b/internal/controller/kendra/thesaurus/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kendra/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Thesaurus_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kendra_thesaurus"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Thesaurus_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kendra_thesaurus"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Thesaurus_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Thesaurus + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Thesaurus{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Thesaurus") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Thesaurus_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyspaces/keyspace/zz_controller.go b/internal/controller/keyspaces/keyspace/zz_controller.go index 484df73cdc..612ce44ef9 100755 --- a/internal/controller/keyspaces/keyspace/zz_controller.go +++ b/internal/controller/keyspaces/keyspace/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/keyspaces/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Keyspace_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_keyspaces_keyspace"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Keyspace_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_keyspaces_keyspace"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Keyspace_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Keyspace + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Keyspace{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Keyspace") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Keyspace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/keyspaces/table/zz_controller.go b/internal/controller/keyspaces/table/zz_controller.go index e03540e75b..9538b71a89 100755 --- a/internal/controller/keyspaces/table/zz_controller.go +++ b/internal/controller/keyspaces/table/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/keyspaces/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Table_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_keyspaces_table"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Table_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_keyspaces_table"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Table_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Table + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Table{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Table") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Table_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kinesis/stream/zz_controller.go b/internal/controller/kinesis/stream/zz_controller.go index baf7afdca5..511359b425 100755 --- a/internal/controller/kinesis/stream/zz_controller.go +++ b/internal/controller/kinesis/stream/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kinesis/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Stream_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesis_stream"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stream_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesis_stream"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stream_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Stream + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Stream{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Stream") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Stream_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kinesis/streamconsumer/zz_controller.go b/internal/controller/kinesis/streamconsumer/zz_controller.go index 0e8b57b982..f7f785ce8f 100755 --- a/internal/controller/kinesis/streamconsumer/zz_controller.go +++ b/internal/controller/kinesis/streamconsumer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kinesis/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StreamConsumer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesis_stream_consumer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StreamConsumer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesis_stream_consumer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StreamConsumer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.StreamConsumer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.StreamConsumer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.StreamConsumer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StreamConsumer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kinesisanalytics/application/zz_controller.go b/internal/controller/kinesisanalytics/application/zz_controller.go index 3aca757486..a2f202b3c1 100755 --- a/internal/controller/kinesisanalytics/application/zz_controller.go +++ b/internal/controller/kinesisanalytics/application/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kinesisanalytics/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesis_analytics_application"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesis_analytics_application"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Application + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Application{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Application") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kinesisanalyticsv2/application/zz_controller.go b/internal/controller/kinesisanalyticsv2/application/zz_controller.go index 8a7de1de53..c298c1ce7b 100755 --- a/internal/controller/kinesisanalyticsv2/application/zz_controller.go +++ b/internal/controller/kinesisanalyticsv2/application/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kinesisanalyticsv2/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesisanalyticsv2_application"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesisanalyticsv2_application"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Application + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Application{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Application") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kinesisanalyticsv2/applicationsnapshot/zz_controller.go b/internal/controller/kinesisanalyticsv2/applicationsnapshot/zz_controller.go index 82f6696bcc..b0e498eb18 100755 --- a/internal/controller/kinesisanalyticsv2/applicationsnapshot/zz_controller.go +++ b/internal/controller/kinesisanalyticsv2/applicationsnapshot/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kinesisanalyticsv2/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ApplicationSnapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesisanalyticsv2_application_snapshot"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ApplicationSnapshot_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesisanalyticsv2_application_snapshot"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ApplicationSnapshot_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ApplicationSnapshot + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ApplicationSnapshot{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ApplicationSnapshot") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ApplicationSnapshot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kinesisvideo/stream/zz_controller.go b/internal/controller/kinesisvideo/stream/zz_controller.go index 64560777f3..7d95f98576 100755 --- a/internal/controller/kinesisvideo/stream/zz_controller.go +++ b/internal/controller/kinesisvideo/stream/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kinesisvideo/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Stream_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesis_video_stream"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stream_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kinesis_video_stream"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stream_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Stream + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Stream{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Stream") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Stream_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kms/alias/zz_controller.go b/internal/controller/kms/alias/zz_controller.go index 9970c49480..4e82f2d6a2 100755 --- a/internal/controller/kms/alias/zz_controller.go +++ b/internal/controller/kms/alias/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Alias_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_alias"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Alias_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_alias"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Alias_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Alias + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Alias{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Alias") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Alias_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kms/ciphertext/zz_controller.go b/internal/controller/kms/ciphertext/zz_controller.go index da5346dac5..22cf7e71ac 100755 --- a/internal/controller/kms/ciphertext/zz_controller.go +++ b/internal/controller/kms/ciphertext/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Ciphertext_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_ciphertext"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Ciphertext_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_ciphertext"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Ciphertext_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Ciphertext + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Ciphertext{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Ciphertext") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Ciphertext_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kms/externalkey/zz_controller.go b/internal/controller/kms/externalkey/zz_controller.go index 5c1fe428ca..7f73cfe06a 100755 --- a/internal/controller/kms/externalkey/zz_controller.go +++ b/internal/controller/kms/externalkey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ExternalKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_external_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ExternalKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_external_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ExternalKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ExternalKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ExternalKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ExternalKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ExternalKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kms/grant/zz_controller.go b/internal/controller/kms/grant/zz_controller.go index 8c0c56d805..ea8aa254ca 100755 --- a/internal/controller/kms/grant/zz_controller.go +++ b/internal/controller/kms/grant/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Grant_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_grant"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Grant_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_grant"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Grant_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Grant + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Grant{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Grant") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Grant_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kms/key/zz_controller.go b/internal/controller/kms/key/zz_controller.go index d2b50da6b8..dd4ca524e6 100755 --- a/internal/controller/kms/key/zz_controller.go +++ b/internal/controller/kms/key/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Key_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Key_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Key_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Key + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Key{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Key") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Key_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kms/replicaexternalkey/zz_controller.go b/internal/controller/kms/replicaexternalkey/zz_controller.go index 7dc0f6179a..a124dd59d5 100755 --- a/internal/controller/kms/replicaexternalkey/zz_controller.go +++ b/internal/controller/kms/replicaexternalkey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReplicaExternalKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_replica_external_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicaExternalKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_replica_external_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicaExternalKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReplicaExternalKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReplicaExternalKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReplicaExternalKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReplicaExternalKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/kms/replicakey/zz_controller.go b/internal/controller/kms/replicakey/zz_controller.go index 5a8869e05c..74a9dda27d 100755 --- a/internal/controller/kms/replicakey/zz_controller.go +++ b/internal/controller/kms/replicakey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReplicaKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_replica_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicaKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_kms_replica_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReplicaKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReplicaKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReplicaKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReplicaKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReplicaKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lakeformation/datalakesettings/zz_controller.go b/internal/controller/lakeformation/datalakesettings/zz_controller.go index dc6f03ba90..79f48dd93e 100755 --- a/internal/controller/lakeformation/datalakesettings/zz_controller.go +++ b/internal/controller/lakeformation/datalakesettings/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lakeformation/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DataLakeSettings_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lakeformation_data_lake_settings"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataLakeSettings_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lakeformation_data_lake_settings"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataLakeSettings_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DataLakeSettings + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DataLakeSettings{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DataLakeSettings") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DataLakeSettings_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lakeformation/permissions/zz_controller.go b/internal/controller/lakeformation/permissions/zz_controller.go index ae5cac9bcd..64e49b2237 100755 --- a/internal/controller/lakeformation/permissions/zz_controller.go +++ b/internal/controller/lakeformation/permissions/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lakeformation/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Permissions_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lakeformation_permissions"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Permissions_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lakeformation_permissions"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Permissions_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Permissions + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Permissions{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Permissions") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Permissions_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lakeformation/resource/zz_controller.go b/internal/controller/lakeformation/resource/zz_controller.go index 7c3c4d56c4..3cf95f431c 100755 --- a/internal/controller/lakeformation/resource/zz_controller.go +++ b/internal/controller/lakeformation/resource/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lakeformation/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Resource_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lakeformation_resource"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Resource_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lakeformation_resource"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Resource_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Resource + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Resource{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Resource") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Resource_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lambda/alias/zz_controller.go b/internal/controller/lambda/alias/zz_controller.go index 2e63528448..48a5142d89 100755 --- a/internal/controller/lambda/alias/zz_controller.go +++ b/internal/controller/lambda/alias/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Alias_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_alias"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Alias_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_alias"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Alias_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Alias + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Alias{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Alias") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Alias_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lambda/codesigningconfig/zz_controller.go b/internal/controller/lambda/codesigningconfig/zz_controller.go index 8c3eb8ea0d..10ff780e34 100755 --- a/internal/controller/lambda/codesigningconfig/zz_controller.go +++ b/internal/controller/lambda/codesigningconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CodeSigningConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_code_signing_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CodeSigningConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_code_signing_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CodeSigningConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CodeSigningConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CodeSigningConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CodeSigningConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CodeSigningConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lambda/eventsourcemapping/zz_controller.go b/internal/controller/lambda/eventsourcemapping/zz_controller.go index 1c7c51cc03..37738ca95c 100755 --- a/internal/controller/lambda/eventsourcemapping/zz_controller.go +++ b/internal/controller/lambda/eventsourcemapping/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EventSourceMapping_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_event_source_mapping"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSourceMapping_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_event_source_mapping"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSourceMapping_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EventSourceMapping + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EventSourceMapping{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EventSourceMapping") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventSourceMapping_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lambda/function/zz_controller.go b/internal/controller/lambda/function/zz_controller.go index 3b6aca4cf6..7305545d07 100755 --- a/internal/controller/lambda/function/zz_controller.go +++ b/internal/controller/lambda/function/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Function_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_function"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Function_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_function"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Function_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Function + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Function{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Function") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Function_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lambda/functioneventinvokeconfig/zz_controller.go b/internal/controller/lambda/functioneventinvokeconfig/zz_controller.go index 1f96f3b107..d8711e631a 100755 --- a/internal/controller/lambda/functioneventinvokeconfig/zz_controller.go +++ b/internal/controller/lambda/functioneventinvokeconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FunctionEventInvokeConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_function_event_invoke_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FunctionEventInvokeConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_function_event_invoke_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FunctionEventInvokeConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FunctionEventInvokeConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FunctionEventInvokeConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FunctionEventInvokeConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FunctionEventInvokeConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lambda/functionurl/zz_controller.go b/internal/controller/lambda/functionurl/zz_controller.go index bc7ac83ae2..79cb750932 100755 --- a/internal/controller/lambda/functionurl/zz_controller.go +++ b/internal/controller/lambda/functionurl/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FunctionURL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_function_url"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FunctionURL_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_function_url"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FunctionURL_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FunctionURL + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FunctionURL{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FunctionURL") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FunctionURL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lambda/invocation/zz_controller.go b/internal/controller/lambda/invocation/zz_controller.go index 0aa5ccaf1a..172302f09a 100755 --- a/internal/controller/lambda/invocation/zz_controller.go +++ b/internal/controller/lambda/invocation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Invocation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_invocation"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Invocation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_invocation"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Invocation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Invocation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Invocation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Invocation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Invocation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lambda/layerversion/zz_controller.go b/internal/controller/lambda/layerversion/zz_controller.go index 3aa070d8ee..d317091155 100755 --- a/internal/controller/lambda/layerversion/zz_controller.go +++ b/internal/controller/lambda/layerversion/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LayerVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_layer_version"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LayerVersion_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_layer_version"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LayerVersion_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LayerVersion + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LayerVersion{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LayerVersion") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LayerVersion_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lambda/layerversionpermission/zz_controller.go b/internal/controller/lambda/layerversionpermission/zz_controller.go index 7d1f2fda80..88aff63937 100755 --- a/internal/controller/lambda/layerversionpermission/zz_controller.go +++ b/internal/controller/lambda/layerversionpermission/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LayerVersionPermission_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_layer_version_permission"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LayerVersionPermission_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_layer_version_permission"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LayerVersionPermission_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LayerVersionPermission + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LayerVersionPermission{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LayerVersionPermission") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LayerVersionPermission_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lambda/permission/zz_controller.go b/internal/controller/lambda/permission/zz_controller.go index 9b123ba542..37c956864e 100755 --- a/internal/controller/lambda/permission/zz_controller.go +++ b/internal/controller/lambda/permission/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Permission_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_permission"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Permission_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_permission"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Permission_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Permission + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Permission{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Permission") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Permission_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lambda/provisionedconcurrencyconfig/zz_controller.go b/internal/controller/lambda/provisionedconcurrencyconfig/zz_controller.go index f5091230ad..a0a04857fb 100755 --- a/internal/controller/lambda/provisionedconcurrencyconfig/zz_controller.go +++ b/internal/controller/lambda/provisionedconcurrencyconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lambda/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProvisionedConcurrencyConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_provisioned_concurrency_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProvisionedConcurrencyConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lambda_provisioned_concurrency_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProvisionedConcurrencyConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ProvisionedConcurrencyConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ProvisionedConcurrencyConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ProvisionedConcurrencyConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProvisionedConcurrencyConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lexmodels/bot/zz_controller.go b/internal/controller/lexmodels/bot/zz_controller.go index 8195ab9a74..7522f0f839 100755 --- a/internal/controller/lexmodels/bot/zz_controller.go +++ b/internal/controller/lexmodels/bot/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lexmodels/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Bot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lex_bot"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Bot_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lex_bot"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Bot_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Bot + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Bot{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Bot") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Bot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lexmodels/botalias/zz_controller.go b/internal/controller/lexmodels/botalias/zz_controller.go index 3bd079d232..40b9d07ac9 100755 --- a/internal/controller/lexmodels/botalias/zz_controller.go +++ b/internal/controller/lexmodels/botalias/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lexmodels/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BotAlias_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lex_bot_alias"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BotAlias_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lex_bot_alias"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BotAlias_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BotAlias + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BotAlias{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BotAlias") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BotAlias_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lexmodels/intent/zz_controller.go b/internal/controller/lexmodels/intent/zz_controller.go index 1b2c2e07a9..b0189b4186 100755 --- a/internal/controller/lexmodels/intent/zz_controller.go +++ b/internal/controller/lexmodels/intent/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lexmodels/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Intent_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lex_intent"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Intent_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lex_intent"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Intent_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Intent + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Intent{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Intent") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Intent_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lexmodels/slottype/zz_controller.go b/internal/controller/lexmodels/slottype/zz_controller.go index ff460dc14a..29228a799f 100755 --- a/internal/controller/lexmodels/slottype/zz_controller.go +++ b/internal/controller/lexmodels/slottype/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lexmodels/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SlotType_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lex_slot_type"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SlotType_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lex_slot_type"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SlotType_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SlotType + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SlotType{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SlotType") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SlotType_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/licensemanager/association/zz_controller.go b/internal/controller/licensemanager/association/zz_controller.go index 59a4ecda23..7772aef7dc 100755 --- a/internal/controller/licensemanager/association/zz_controller.go +++ b/internal/controller/licensemanager/association/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/licensemanager/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Association_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_licensemanager_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Association_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_licensemanager_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Association_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Association + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Association{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Association") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Association_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/licensemanager/licenseconfiguration/zz_controller.go b/internal/controller/licensemanager/licenseconfiguration/zz_controller.go index ef2215c50e..581a8c1d10 100755 --- a/internal/controller/licensemanager/licenseconfiguration/zz_controller.go +++ b/internal/controller/licensemanager/licenseconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/licensemanager/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LicenseConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_licensemanager_license_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LicenseConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_licensemanager_license_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LicenseConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LicenseConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LicenseConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LicenseConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LicenseConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/bucket/zz_controller.go b/internal/controller/lightsail/bucket/zz_controller.go index a020aeb83b..e98f815450 100755 --- a/internal/controller/lightsail/bucket/zz_controller.go +++ b/internal/controller/lightsail/bucket/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Bucket_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_bucket"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Bucket_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_bucket"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Bucket_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Bucket + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Bucket{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Bucket") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Bucket_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/certificate/zz_controller.go b/internal/controller/lightsail/certificate/zz_controller.go index 60f6b22c41..1f1a1412e5 100755 --- a/internal/controller/lightsail/certificate/zz_controller.go +++ b/internal/controller/lightsail/certificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Certificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Certificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Certificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/containerservice/zz_controller.go b/internal/controller/lightsail/containerservice/zz_controller.go index ecf1fb8e99..64c9d39e63 100755 --- a/internal/controller/lightsail/containerservice/zz_controller.go +++ b/internal/controller/lightsail/containerservice/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ContainerService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_container_service"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContainerService_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_container_service"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContainerService_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ContainerService + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ContainerService{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ContainerService") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ContainerService_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/disk/zz_controller.go b/internal/controller/lightsail/disk/zz_controller.go index 3a92a5c38f..62f28be76f 100755 --- a/internal/controller/lightsail/disk/zz_controller.go +++ b/internal/controller/lightsail/disk/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Disk_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_disk"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Disk_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_disk"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Disk_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Disk + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Disk{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Disk") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Disk_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/diskattachment/zz_controller.go b/internal/controller/lightsail/diskattachment/zz_controller.go index e9f6a6b0fa..4185276da7 100755 --- a/internal/controller/lightsail/diskattachment/zz_controller.go +++ b/internal/controller/lightsail/diskattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DiskAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_disk_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DiskAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_disk_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DiskAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DiskAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DiskAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DiskAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DiskAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/domain/zz_controller.go b/internal/controller/lightsail/domain/zz_controller.go index f4d37f733c..5c315c42a7 100755 --- a/internal/controller/lightsail/domain/zz_controller.go +++ b/internal/controller/lightsail/domain/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_domain"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_domain"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Domain + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Domain{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Domain") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/domainentry/zz_controller.go b/internal/controller/lightsail/domainentry/zz_controller.go index d1a9c8ad31..5fa1e64e10 100755 --- a/internal/controller/lightsail/domainentry/zz_controller.go +++ b/internal/controller/lightsail/domainentry/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainEntry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_domain_entry"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainEntry_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_domain_entry"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainEntry_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DomainEntry + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DomainEntry{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DomainEntry") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainEntry_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/instance/zz_controller.go b/internal/controller/lightsail/instance/zz_controller.go index 24d3fbe926..91a2de3ccf 100755 --- a/internal/controller/lightsail/instance/zz_controller.go +++ b/internal/controller/lightsail/instance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Instance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Instance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Instance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/instancepublicports/zz_controller.go b/internal/controller/lightsail/instancepublicports/zz_controller.go index f156c7a94f..25f57ee03c 100755 --- a/internal/controller/lightsail/instancepublicports/zz_controller.go +++ b/internal/controller/lightsail/instancepublicports/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstancePublicPorts_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_instance_public_ports"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstancePublicPorts_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_instance_public_ports"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstancePublicPorts_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InstancePublicPorts + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InstancePublicPorts{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InstancePublicPorts") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InstancePublicPorts_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/keypair/zz_controller.go b/internal/controller/lightsail/keypair/zz_controller.go index b10ca748a4..0495fad3fd 100755 --- a/internal/controller/lightsail/keypair/zz_controller.go +++ b/internal/controller/lightsail/keypair/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.KeyPair_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_key_pair"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.KeyPair_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_key_pair"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.KeyPair_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.KeyPair + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.KeyPair{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.KeyPair") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.KeyPair_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/lb/zz_controller.go b/internal/controller/lightsail/lb/zz_controller.go index 67adab3330..b3a350f975 100755 --- a/internal/controller/lightsail/lb/zz_controller.go +++ b/internal/controller/lightsail/lb/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LB_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_lb"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LB_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_lb"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LB_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LB + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LB{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LB") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LB_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/lbattachment/zz_controller.go b/internal/controller/lightsail/lbattachment/zz_controller.go index e95d3c85eb..2c8a1a5134 100755 --- a/internal/controller/lightsail/lbattachment/zz_controller.go +++ b/internal/controller/lightsail/lbattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LBAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_lb_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_lb_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LBAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LBAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LBAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LBAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/lbcertificate/zz_controller.go b/internal/controller/lightsail/lbcertificate/zz_controller.go index 34456ae1e5..8776a63069 100755 --- a/internal/controller/lightsail/lbcertificate/zz_controller.go +++ b/internal/controller/lightsail/lbcertificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LBCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_lb_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBCertificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_lb_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBCertificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LBCertificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LBCertificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LBCertificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LBCertificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/lbstickinesspolicy/zz_controller.go b/internal/controller/lightsail/lbstickinesspolicy/zz_controller.go index 025bbed90f..a3e593e458 100755 --- a/internal/controller/lightsail/lbstickinesspolicy/zz_controller.go +++ b/internal/controller/lightsail/lbstickinesspolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LBStickinessPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_lb_stickiness_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBStickinessPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_lb_stickiness_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LBStickinessPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LBStickinessPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LBStickinessPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LBStickinessPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LBStickinessPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/staticip/zz_controller.go b/internal/controller/lightsail/staticip/zz_controller.go index 2ebe106032..5f131538a4 100755 --- a/internal/controller/lightsail/staticip/zz_controller.go +++ b/internal/controller/lightsail/staticip/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StaticIP_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_static_ip"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StaticIP_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_static_ip"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StaticIP_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.StaticIP + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.StaticIP{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.StaticIP") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StaticIP_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/lightsail/staticipattachment/zz_controller.go b/internal/controller/lightsail/staticipattachment/zz_controller.go index aa58124f24..70261f8975 100755 --- a/internal/controller/lightsail/staticipattachment/zz_controller.go +++ b/internal/controller/lightsail/staticipattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/lightsail/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StaticIPAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_static_ip_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StaticIPAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_lightsail_static_ip_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StaticIPAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.StaticIPAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.StaticIPAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.StaticIPAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StaticIPAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/location/geofencecollection/zz_controller.go b/internal/controller/location/geofencecollection/zz_controller.go index 0bf7c502ed..4f830e699b 100755 --- a/internal/controller/location/geofencecollection/zz_controller.go +++ b/internal/controller/location/geofencecollection/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/location/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GeofenceCollection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_location_geofence_collection"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GeofenceCollection_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_location_geofence_collection"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GeofenceCollection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GeofenceCollection + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GeofenceCollection{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GeofenceCollection") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GeofenceCollection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/location/placeindex/zz_controller.go b/internal/controller/location/placeindex/zz_controller.go index 47268bf46b..e81818be27 100755 --- a/internal/controller/location/placeindex/zz_controller.go +++ b/internal/controller/location/placeindex/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/location/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PlaceIndex_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_location_place_index"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PlaceIndex_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_location_place_index"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PlaceIndex_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PlaceIndex + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PlaceIndex{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PlaceIndex") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PlaceIndex_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/location/routecalculator/zz_controller.go b/internal/controller/location/routecalculator/zz_controller.go index 869c74d453..fe151dd5f9 100755 --- a/internal/controller/location/routecalculator/zz_controller.go +++ b/internal/controller/location/routecalculator/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/location/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RouteCalculator_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_location_route_calculator"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RouteCalculator_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_location_route_calculator"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RouteCalculator_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RouteCalculator + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RouteCalculator{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RouteCalculator") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RouteCalculator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/location/tracker/zz_controller.go b/internal/controller/location/tracker/zz_controller.go index a835435c1a..7d498b2727 100755 --- a/internal/controller/location/tracker/zz_controller.go +++ b/internal/controller/location/tracker/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/location/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Tracker_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_location_tracker"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Tracker_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_location_tracker"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Tracker_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Tracker + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Tracker{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Tracker") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Tracker_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/location/trackerassociation/zz_controller.go b/internal/controller/location/trackerassociation/zz_controller.go index 771ddc2c0c..f09df63351 100755 --- a/internal/controller/location/trackerassociation/zz_controller.go +++ b/internal/controller/location/trackerassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/location/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TrackerAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_location_tracker_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TrackerAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_location_tracker_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TrackerAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TrackerAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TrackerAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TrackerAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TrackerAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/macie2/account/zz_controller.go b/internal/controller/macie2/account/zz_controller.go index e393a206aa..89cfc9f2c9 100755 --- a/internal/controller/macie2/account/zz_controller.go +++ b/internal/controller/macie2/account/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/macie2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Account_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_account"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Account_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_account"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Account_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Account + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Account{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Account") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/macie2/classificationjob/zz_controller.go b/internal/controller/macie2/classificationjob/zz_controller.go index 51c14a851d..aa30c27f7f 100755 --- a/internal/controller/macie2/classificationjob/zz_controller.go +++ b/internal/controller/macie2/classificationjob/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/macie2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClassificationJob_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_classification_job"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClassificationJob_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_classification_job"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClassificationJob_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClassificationJob + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClassificationJob{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClassificationJob") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClassificationJob_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/macie2/customdataidentifier/zz_controller.go b/internal/controller/macie2/customdataidentifier/zz_controller.go index 34ebf4eb48..9c87395cfc 100755 --- a/internal/controller/macie2/customdataidentifier/zz_controller.go +++ b/internal/controller/macie2/customdataidentifier/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/macie2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CustomDataIdentifier_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_custom_data_identifier"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomDataIdentifier_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_custom_data_identifier"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomDataIdentifier_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CustomDataIdentifier + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CustomDataIdentifier{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CustomDataIdentifier") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CustomDataIdentifier_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/macie2/findingsfilter/zz_controller.go b/internal/controller/macie2/findingsfilter/zz_controller.go index 803b50084a..6616a00816 100755 --- a/internal/controller/macie2/findingsfilter/zz_controller.go +++ b/internal/controller/macie2/findingsfilter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/macie2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FindingsFilter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_findings_filter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FindingsFilter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_findings_filter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FindingsFilter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FindingsFilter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FindingsFilter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FindingsFilter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FindingsFilter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/macie2/invitationaccepter/zz_controller.go b/internal/controller/macie2/invitationaccepter/zz_controller.go index 2874048d55..8a17dbe183 100755 --- a/internal/controller/macie2/invitationaccepter/zz_controller.go +++ b/internal/controller/macie2/invitationaccepter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/macie2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InvitationAccepter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_invitation_accepter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InvitationAccepter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_invitation_accepter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InvitationAccepter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InvitationAccepter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InvitationAccepter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InvitationAccepter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InvitationAccepter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/macie2/member/zz_controller.go b/internal/controller/macie2/member/zz_controller.go index 2f634c672d..4a461f2917 100755 --- a/internal/controller/macie2/member/zz_controller.go +++ b/internal/controller/macie2/member/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/macie2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_member"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Member_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_macie2_member"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Member_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Member + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Member{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Member") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/mediaconvert/queue/zz_controller.go b/internal/controller/mediaconvert/queue/zz_controller.go index eb5a6802a9..9affbd2e93 100755 --- a/internal/controller/mediaconvert/queue/zz_controller.go +++ b/internal/controller/mediaconvert/queue/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/mediaconvert/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Queue_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_media_convert_queue"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Queue_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_media_convert_queue"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Queue_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Queue + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Queue{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Queue") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Queue_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/medialive/channel/zz_controller.go b/internal/controller/medialive/channel/zz_controller.go index 8eba968f79..4d66dfee25 100755 --- a/internal/controller/medialive/channel/zz_controller.go +++ b/internal/controller/medialive/channel/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/medialive/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Channel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_medialive_channel"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Channel_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_medialive_channel"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Channel_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Channel + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Channel{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Channel") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Channel_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/medialive/input/zz_controller.go b/internal/controller/medialive/input/zz_controller.go index 33f3efc1c5..7e63cf37f4 100755 --- a/internal/controller/medialive/input/zz_controller.go +++ b/internal/controller/medialive/input/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/medialive/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Input_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_medialive_input"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Input_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_medialive_input"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Input_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Input + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Input{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Input") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Input_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/medialive/inputsecuritygroup/zz_controller.go b/internal/controller/medialive/inputsecuritygroup/zz_controller.go index c63882542e..65a274101c 100755 --- a/internal/controller/medialive/inputsecuritygroup/zz_controller.go +++ b/internal/controller/medialive/inputsecuritygroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/medialive/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InputSecurityGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_medialive_input_security_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InputSecurityGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_medialive_input_security_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InputSecurityGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InputSecurityGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InputSecurityGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InputSecurityGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InputSecurityGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/medialive/multiplex/zz_controller.go b/internal/controller/medialive/multiplex/zz_controller.go index b41f9eb0f4..5a21b4eb91 100755 --- a/internal/controller/medialive/multiplex/zz_controller.go +++ b/internal/controller/medialive/multiplex/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/medialive/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Multiplex_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_medialive_multiplex"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Multiplex_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_medialive_multiplex"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Multiplex_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Multiplex + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Multiplex{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Multiplex") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Multiplex_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/mediapackage/channel/zz_controller.go b/internal/controller/mediapackage/channel/zz_controller.go index 958dc47d7e..2e74d87ccd 100755 --- a/internal/controller/mediapackage/channel/zz_controller.go +++ b/internal/controller/mediapackage/channel/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/mediapackage/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Channel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_media_package_channel"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Channel_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_media_package_channel"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Channel_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Channel + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Channel{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Channel") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Channel_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/mediastore/container/zz_controller.go b/internal/controller/mediastore/container/zz_controller.go index 2c0a0d96a2..7f6c1a4e5d 100755 --- a/internal/controller/mediastore/container/zz_controller.go +++ b/internal/controller/mediastore/container/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/mediastore/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Container_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_media_store_container"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Container_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_media_store_container"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Container_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Container + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Container{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Container") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Container_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/mediastore/containerpolicy/zz_controller.go b/internal/controller/mediastore/containerpolicy/zz_controller.go index d9da10df95..163ab4af14 100755 --- a/internal/controller/mediastore/containerpolicy/zz_controller.go +++ b/internal/controller/mediastore/containerpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/mediastore/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ContainerPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_media_store_container_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContainerPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_media_store_container_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ContainerPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ContainerPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ContainerPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ContainerPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ContainerPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/memorydb/acl/zz_controller.go b/internal/controller/memorydb/acl/zz_controller.go index 0dd6e9beaa..03f96dfb88 100755 --- a/internal/controller/memorydb/acl/zz_controller.go +++ b/internal/controller/memorydb/acl/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/memorydb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_memorydb_acl"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ACL_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_memorydb_acl"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ACL_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ACL + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ACL{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ACL") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ACL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/memorydb/cluster/zz_controller.go b/internal/controller/memorydb/cluster/zz_controller.go index 28bfff1cde..1342a3b20e 100755 --- a/internal/controller/memorydb/cluster/zz_controller.go +++ b/internal/controller/memorydb/cluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/memorydb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_memorydb_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_memorydb_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/memorydb/parametergroup/zz_controller.go b/internal/controller/memorydb/parametergroup/zz_controller.go index e26ec880c5..7a4d453c0f 100755 --- a/internal/controller/memorydb/parametergroup/zz_controller.go +++ b/internal/controller/memorydb/parametergroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/memorydb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_memorydb_parameter_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_memorydb_parameter_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ParameterGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ParameterGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ParameterGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/memorydb/snapshot/zz_controller.go b/internal/controller/memorydb/snapshot/zz_controller.go index a03a53b712..df11babe17 100755 --- a/internal/controller/memorydb/snapshot/zz_controller.go +++ b/internal/controller/memorydb/snapshot/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/memorydb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Snapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_memorydb_snapshot"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Snapshot_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_memorydb_snapshot"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Snapshot_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Snapshot + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Snapshot{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Snapshot") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Snapshot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/memorydb/subnetgroup/zz_controller.go b/internal/controller/memorydb/subnetgroup/zz_controller.go index 5b57779742..79f5b9a8f9 100755 --- a/internal/controller/memorydb/subnetgroup/zz_controller.go +++ b/internal/controller/memorydb/subnetgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/memorydb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_memorydb_subnet_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_memorydb_subnet_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SubnetGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SubnetGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SubnetGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/mq/broker/zz_controller.go b/internal/controller/mq/broker/zz_controller.go index 272923853e..a401b7eab4 100755 --- a/internal/controller/mq/broker/zz_controller.go +++ b/internal/controller/mq/broker/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/mq/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Broker_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_mq_broker"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Broker_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_mq_broker"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Broker_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Broker + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Broker{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Broker") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Broker_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/mq/configuration/zz_controller.go b/internal/controller/mq/configuration/zz_controller.go index 1372acd9ce..d024e6c8e7 100755 --- a/internal/controller/mq/configuration/zz_controller.go +++ b/internal/controller/mq/configuration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/mq/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Configuration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_mq_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Configuration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_mq_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Configuration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Configuration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Configuration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Configuration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Configuration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/neptune/cluster/zz_controller.go b/internal/controller/neptune/cluster/zz_controller.go index 5978637e00..172863b252 100755 --- a/internal/controller/neptune/cluster/zz_controller.go +++ b/internal/controller/neptune/cluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/neptune/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/neptune/clusterendpoint/zz_controller.go b/internal/controller/neptune/clusterendpoint/zz_controller.go index 4a0a8b847e..5a8135464c 100755 --- a/internal/controller/neptune/clusterendpoint/zz_controller.go +++ b/internal/controller/neptune/clusterendpoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/neptune/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterEndpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_cluster_endpoint"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterEndpoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_cluster_endpoint"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterEndpoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterEndpoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterEndpoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterEndpoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/neptune/clusterinstance/zz_controller.go b/internal/controller/neptune/clusterinstance/zz_controller.go index 86651aa32c..2140318bb9 100755 --- a/internal/controller/neptune/clusterinstance/zz_controller.go +++ b/internal/controller/neptune/clusterinstance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/neptune/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_cluster_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterInstance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_cluster_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterInstance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterInstance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterInstance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterInstance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterInstance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/neptune/clusterparametergroup/zz_controller.go b/internal/controller/neptune/clusterparametergroup/zz_controller.go index 45ee316c1a..bafef2e2b3 100755 --- a/internal/controller/neptune/clusterparametergroup/zz_controller.go +++ b/internal/controller/neptune/clusterparametergroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/neptune/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterParameterGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_cluster_parameter_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterParameterGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_cluster_parameter_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterParameterGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterParameterGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterParameterGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterParameterGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterParameterGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/neptune/clustersnapshot/zz_controller.go b/internal/controller/neptune/clustersnapshot/zz_controller.go index 3fabffa4c2..9179de9d4f 100755 --- a/internal/controller/neptune/clustersnapshot/zz_controller.go +++ b/internal/controller/neptune/clustersnapshot/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/neptune/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterSnapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_cluster_snapshot"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterSnapshot_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_cluster_snapshot"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterSnapshot_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterSnapshot + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterSnapshot{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterSnapshot") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterSnapshot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/neptune/eventsubscription/zz_controller.go b/internal/controller/neptune/eventsubscription/zz_controller.go index ffaf85b47f..d651ad5fb5 100755 --- a/internal/controller/neptune/eventsubscription/zz_controller.go +++ b/internal/controller/neptune/eventsubscription/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/neptune/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EventSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_event_subscription"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSubscription_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_event_subscription"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EventSubscription + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EventSubscription{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EventSubscription") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/neptune/globalcluster/zz_controller.go b/internal/controller/neptune/globalcluster/zz_controller.go index 76fc274eb0..018f6d667a 100755 --- a/internal/controller/neptune/globalcluster/zz_controller.go +++ b/internal/controller/neptune/globalcluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/neptune/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalCluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_global_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalCluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_global_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalCluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GlobalCluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GlobalCluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GlobalCluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GlobalCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/neptune/parametergroup/zz_controller.go b/internal/controller/neptune/parametergroup/zz_controller.go index 34334201d3..627768c300 100755 --- a/internal/controller/neptune/parametergroup/zz_controller.go +++ b/internal/controller/neptune/parametergroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/neptune/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_parameter_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_parameter_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ParameterGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ParameterGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ParameterGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/neptune/subnetgroup/zz_controller.go b/internal/controller/neptune/subnetgroup/zz_controller.go index a0b6a23b4d..b589849cb5 100755 --- a/internal/controller/neptune/subnetgroup/zz_controller.go +++ b/internal/controller/neptune/subnetgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/neptune/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_subnet_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_neptune_subnet_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SubnetGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SubnetGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SubnetGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkfirewall/firewall/zz_controller.go b/internal/controller/networkfirewall/firewall/zz_controller.go index a26e042912..af2f391407 100755 --- a/internal/controller/networkfirewall/firewall/zz_controller.go +++ b/internal/controller/networkfirewall/firewall/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkfirewall/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Firewall_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkfirewall_firewall"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Firewall_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkfirewall_firewall"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Firewall_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Firewall + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Firewall{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Firewall") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Firewall_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkfirewall/firewallpolicy/zz_controller.go b/internal/controller/networkfirewall/firewallpolicy/zz_controller.go index 929671cc1d..685d4c7ab1 100755 --- a/internal/controller/networkfirewall/firewallpolicy/zz_controller.go +++ b/internal/controller/networkfirewall/firewallpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkfirewall/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FirewallPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkfirewall_firewall_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FirewallPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkfirewall_firewall_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FirewallPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FirewallPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FirewallPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FirewallPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FirewallPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkfirewall/loggingconfiguration/zz_controller.go b/internal/controller/networkfirewall/loggingconfiguration/zz_controller.go index f5346141b9..d4eaf0cdf9 100755 --- a/internal/controller/networkfirewall/loggingconfiguration/zz_controller.go +++ b/internal/controller/networkfirewall/loggingconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkfirewall/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LoggingConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkfirewall_logging_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LoggingConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkfirewall_logging_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LoggingConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LoggingConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LoggingConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LoggingConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LoggingConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkfirewall/rulegroup/zz_controller.go b/internal/controller/networkfirewall/rulegroup/zz_controller.go index ff8adb88f8..27cd141d14 100755 --- a/internal/controller/networkfirewall/rulegroup/zz_controller.go +++ b/internal/controller/networkfirewall/rulegroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkfirewall/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RuleGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkfirewall_rule_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RuleGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkfirewall_rule_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RuleGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RuleGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RuleGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RuleGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RuleGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/attachmentaccepter/zz_controller.go b/internal/controller/networkmanager/attachmentaccepter/zz_controller.go index b4af0cc496..4cc4cb7e72 100755 --- a/internal/controller/networkmanager/attachmentaccepter/zz_controller.go +++ b/internal/controller/networkmanager/attachmentaccepter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AttachmentAccepter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_attachment_accepter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AttachmentAccepter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_attachment_accepter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AttachmentAccepter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AttachmentAccepter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AttachmentAccepter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AttachmentAccepter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AttachmentAccepter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/connectattachment/zz_controller.go b/internal/controller/networkmanager/connectattachment/zz_controller.go index 804d7e727b..be6a361fdc 100755 --- a/internal/controller/networkmanager/connectattachment/zz_controller.go +++ b/internal/controller/networkmanager/connectattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConnectAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_connect_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConnectAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_connect_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConnectAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConnectAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConnectAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConnectAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConnectAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/connection/zz_controller.go b/internal/controller/networkmanager/connection/zz_controller.go index 8b36b4e715..7f70aeb91b 100755 --- a/internal/controller/networkmanager/connection/zz_controller.go +++ b/internal/controller/networkmanager/connection/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_connection"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_connection"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Connection + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Connection{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Connection") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/corenetwork/zz_controller.go b/internal/controller/networkmanager/corenetwork/zz_controller.go index 4040bc067b..4bd477424f 100755 --- a/internal/controller/networkmanager/corenetwork/zz_controller.go +++ b/internal/controller/networkmanager/corenetwork/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CoreNetwork_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_core_network"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CoreNetwork_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_core_network"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CoreNetwork_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CoreNetwork + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CoreNetwork{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CoreNetwork") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CoreNetwork_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/customergatewayassociation/zz_controller.go b/internal/controller/networkmanager/customergatewayassociation/zz_controller.go index ef0cd4ae11..1bd6d41d4d 100755 --- a/internal/controller/networkmanager/customergatewayassociation/zz_controller.go +++ b/internal/controller/networkmanager/customergatewayassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CustomerGatewayAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_customer_gateway_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomerGatewayAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_customer_gateway_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomerGatewayAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CustomerGatewayAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CustomerGatewayAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CustomerGatewayAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CustomerGatewayAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/device/zz_controller.go b/internal/controller/networkmanager/device/zz_controller.go index d7fee3427e..074601d7c8 100755 --- a/internal/controller/networkmanager/device/zz_controller.go +++ b/internal/controller/networkmanager/device/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Device_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_device"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Device_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_device"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Device_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Device + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Device{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Device") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Device_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/globalnetwork/zz_controller.go b/internal/controller/networkmanager/globalnetwork/zz_controller.go index 6f424c28a7..230e8eef4d 100755 --- a/internal/controller/networkmanager/globalnetwork/zz_controller.go +++ b/internal/controller/networkmanager/globalnetwork/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalNetwork_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_global_network"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalNetwork_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_global_network"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalNetwork_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GlobalNetwork + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GlobalNetwork{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GlobalNetwork") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GlobalNetwork_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/link/zz_controller.go b/internal/controller/networkmanager/link/zz_controller.go index 39f4634642..877193b3c9 100755 --- a/internal/controller/networkmanager/link/zz_controller.go +++ b/internal/controller/networkmanager/link/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Link_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_link"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Link_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_link"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Link_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Link + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Link{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Link") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Link_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/linkassociation/zz_controller.go b/internal/controller/networkmanager/linkassociation/zz_controller.go index 4498c49105..f76f2cc75b 100755 --- a/internal/controller/networkmanager/linkassociation/zz_controller.go +++ b/internal/controller/networkmanager/linkassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LinkAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_link_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LinkAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_link_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LinkAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LinkAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LinkAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LinkAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LinkAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/site/zz_controller.go b/internal/controller/networkmanager/site/zz_controller.go index fe3c931d29..8edf55b2be 100755 --- a/internal/controller/networkmanager/site/zz_controller.go +++ b/internal/controller/networkmanager/site/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Site_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_site"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Site_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_site"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Site_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Site + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Site{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Site") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Site_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/transitgatewayconnectpeerassociation/zz_controller.go b/internal/controller/networkmanager/transitgatewayconnectpeerassociation/zz_controller.go index 7192c1a4e4..2a0711cad4 100755 --- a/internal/controller/networkmanager/transitgatewayconnectpeerassociation/zz_controller.go +++ b/internal/controller/networkmanager/transitgatewayconnectpeerassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayConnectPeerAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_transit_gateway_connect_peer_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayConnectPeerAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_transit_gateway_connect_peer_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayConnectPeerAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayConnectPeerAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayConnectPeerAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayConnectPeerAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayConnectPeerAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/transitgatewayregistration/zz_controller.go b/internal/controller/networkmanager/transitgatewayregistration/zz_controller.go index 6fdaf5f10b..f7a2134e16 100755 --- a/internal/controller/networkmanager/transitgatewayregistration/zz_controller.go +++ b/internal/controller/networkmanager/transitgatewayregistration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayRegistration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_transit_gateway_registration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayRegistration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_transit_gateway_registration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TransitGatewayRegistration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TransitGatewayRegistration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TransitGatewayRegistration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TransitGatewayRegistration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TransitGatewayRegistration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/networkmanager/vpcattachment/zz_controller.go b/internal/controller/networkmanager/vpcattachment/zz_controller.go index 91b6ee90bf..e2f6549934 100755 --- a/internal/controller/networkmanager/vpcattachment/zz_controller.go +++ b/internal/controller/networkmanager/vpcattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/networkmanager/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_vpc_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_networkmanager_vpc_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opensearch/domain/zz_controller.go b/internal/controller/opensearch/domain/zz_controller.go index 1d1cd79268..a8415f8c34 100755 --- a/internal/controller/opensearch/domain/zz_controller.go +++ b/internal/controller/opensearch/domain/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opensearch/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opensearch_domain"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opensearch_domain"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Domain + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Domain{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Domain") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opensearch/domainpolicy/zz_controller.go b/internal/controller/opensearch/domainpolicy/zz_controller.go index c253a66350..fa068b5111 100755 --- a/internal/controller/opensearch/domainpolicy/zz_controller.go +++ b/internal/controller/opensearch/domainpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opensearch/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opensearch_domain_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opensearch_domain_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DomainPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DomainPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DomainPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opensearch/domainsamloptions/zz_controller.go b/internal/controller/opensearch/domainsamloptions/zz_controller.go index ddac79d683..2798001dc0 100755 --- a/internal/controller/opensearch/domainsamloptions/zz_controller.go +++ b/internal/controller/opensearch/domainsamloptions/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opensearch/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainSAMLOptions_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opensearch_domain_saml_options"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainSAMLOptions_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opensearch_domain_saml_options"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainSAMLOptions_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DomainSAMLOptions + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DomainSAMLOptions{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DomainSAMLOptions") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainSAMLOptions_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/application/zz_controller.go b/internal/controller/opsworks/application/zz_controller.go index 869529695e..47bee5d03f 100755 --- a/internal/controller/opsworks/application/zz_controller.go +++ b/internal/controller/opsworks/application/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_application"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_application"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Application + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Application{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Application") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/customlayer/zz_controller.go b/internal/controller/opsworks/customlayer/zz_controller.go index ef72419ce1..1f5eb78bc9 100755 --- a/internal/controller/opsworks/customlayer/zz_controller.go +++ b/internal/controller/opsworks/customlayer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CustomLayer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_custom_layer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomLayer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_custom_layer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomLayer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CustomLayer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CustomLayer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CustomLayer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CustomLayer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/ecsclusterlayer/zz_controller.go b/internal/controller/opsworks/ecsclusterlayer/zz_controller.go index 6b554129d4..d54a5c64fa 100755 --- a/internal/controller/opsworks/ecsclusterlayer/zz_controller.go +++ b/internal/controller/opsworks/ecsclusterlayer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EcsClusterLayer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_ecs_cluster_layer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EcsClusterLayer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_ecs_cluster_layer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EcsClusterLayer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EcsClusterLayer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EcsClusterLayer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EcsClusterLayer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EcsClusterLayer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/ganglialayer/zz_controller.go b/internal/controller/opsworks/ganglialayer/zz_controller.go index 1902d27967..986b9c9643 100755 --- a/internal/controller/opsworks/ganglialayer/zz_controller.go +++ b/internal/controller/opsworks/ganglialayer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GangliaLayer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_ganglia_layer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GangliaLayer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_ganglia_layer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GangliaLayer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GangliaLayer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GangliaLayer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GangliaLayer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GangliaLayer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/haproxylayer/zz_controller.go b/internal/controller/opsworks/haproxylayer/zz_controller.go index fa76e3265c..0cabbe3594 100755 --- a/internal/controller/opsworks/haproxylayer/zz_controller.go +++ b/internal/controller/opsworks/haproxylayer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HAProxyLayer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_haproxy_layer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HAProxyLayer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_haproxy_layer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HAProxyLayer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HAProxyLayer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HAProxyLayer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HAProxyLayer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HAProxyLayer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/instance/zz_controller.go b/internal/controller/opsworks/instance/zz_controller.go index 177e6a47b7..74c264f698 100755 --- a/internal/controller/opsworks/instance/zz_controller.go +++ b/internal/controller/opsworks/instance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Instance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Instance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Instance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/javaapplayer/zz_controller.go b/internal/controller/opsworks/javaapplayer/zz_controller.go index 5536dca9fb..e391cdb8a4 100755 --- a/internal/controller/opsworks/javaapplayer/zz_controller.go +++ b/internal/controller/opsworks/javaapplayer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.JavaAppLayer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_java_app_layer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.JavaAppLayer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_java_app_layer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.JavaAppLayer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.JavaAppLayer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.JavaAppLayer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.JavaAppLayer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.JavaAppLayer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/memcachedlayer/zz_controller.go b/internal/controller/opsworks/memcachedlayer/zz_controller.go index cb8707473d..f24123f527 100755 --- a/internal/controller/opsworks/memcachedlayer/zz_controller.go +++ b/internal/controller/opsworks/memcachedlayer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MemcachedLayer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_memcached_layer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MemcachedLayer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_memcached_layer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MemcachedLayer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MemcachedLayer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MemcachedLayer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MemcachedLayer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MemcachedLayer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/mysqllayer/zz_controller.go b/internal/controller/opsworks/mysqllayer/zz_controller.go index 4b7e87f538..af38edc0e0 100755 --- a/internal/controller/opsworks/mysqllayer/zz_controller.go +++ b/internal/controller/opsworks/mysqllayer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MySQLLayer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_mysql_layer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MySQLLayer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_mysql_layer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MySQLLayer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MySQLLayer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MySQLLayer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MySQLLayer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MySQLLayer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/nodejsapplayer/zz_controller.go b/internal/controller/opsworks/nodejsapplayer/zz_controller.go index 6b713ddda3..c113b3bbc3 100755 --- a/internal/controller/opsworks/nodejsapplayer/zz_controller.go +++ b/internal/controller/opsworks/nodejsapplayer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodeJSAppLayer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_nodejs_app_layer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NodeJSAppLayer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_nodejs_app_layer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NodeJSAppLayer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NodeJSAppLayer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NodeJSAppLayer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NodeJSAppLayer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NodeJSAppLayer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/permission/zz_controller.go b/internal/controller/opsworks/permission/zz_controller.go index dc8fd6fc70..349d1359a5 100755 --- a/internal/controller/opsworks/permission/zz_controller.go +++ b/internal/controller/opsworks/permission/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Permission_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_permission"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Permission_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_permission"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Permission_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Permission + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Permission{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Permission") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Permission_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/phpapplayer/zz_controller.go b/internal/controller/opsworks/phpapplayer/zz_controller.go index 8eda3668f0..dc734d570c 100755 --- a/internal/controller/opsworks/phpapplayer/zz_controller.go +++ b/internal/controller/opsworks/phpapplayer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PHPAppLayer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_php_app_layer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PHPAppLayer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_php_app_layer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PHPAppLayer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PHPAppLayer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PHPAppLayer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PHPAppLayer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PHPAppLayer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/railsapplayer/zz_controller.go b/internal/controller/opsworks/railsapplayer/zz_controller.go index 61f58b311b..11ecdc69fc 100755 --- a/internal/controller/opsworks/railsapplayer/zz_controller.go +++ b/internal/controller/opsworks/railsapplayer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RailsAppLayer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_rails_app_layer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RailsAppLayer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_rails_app_layer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RailsAppLayer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RailsAppLayer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RailsAppLayer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RailsAppLayer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RailsAppLayer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/rdsdbinstance/zz_controller.go b/internal/controller/opsworks/rdsdbinstance/zz_controller.go index 0383bb6c05..7bd3e3f743 100755 --- a/internal/controller/opsworks/rdsdbinstance/zz_controller.go +++ b/internal/controller/opsworks/rdsdbinstance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RDSDBInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_rds_db_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RDSDBInstance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_rds_db_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RDSDBInstance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RDSDBInstance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RDSDBInstance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RDSDBInstance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RDSDBInstance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/stack/zz_controller.go b/internal/controller/opsworks/stack/zz_controller.go index 8b62c9bea1..3deb1bd961 100755 --- a/internal/controller/opsworks/stack/zz_controller.go +++ b/internal/controller/opsworks/stack/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Stack_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_stack"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stack_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_stack"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stack_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Stack + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Stack{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Stack") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Stack_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/staticweblayer/zz_controller.go b/internal/controller/opsworks/staticweblayer/zz_controller.go index 9d1a1be706..e8bbabe816 100755 --- a/internal/controller/opsworks/staticweblayer/zz_controller.go +++ b/internal/controller/opsworks/staticweblayer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StaticWebLayer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_static_web_layer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StaticWebLayer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_static_web_layer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StaticWebLayer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.StaticWebLayer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.StaticWebLayer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.StaticWebLayer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StaticWebLayer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/opsworks/userprofile/zz_controller.go b/internal/controller/opsworks/userprofile/zz_controller.go index a5fb3ba8a0..c259c493af 100755 --- a/internal/controller/opsworks/userprofile/zz_controller.go +++ b/internal/controller/opsworks/userprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/opsworks/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_user_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_opsworks_user_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/organizations/account/zz_controller.go b/internal/controller/organizations/account/zz_controller.go index 3bfe1cd179..a6836a3887 100755 --- a/internal/controller/organizations/account/zz_controller.go +++ b/internal/controller/organizations/account/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/organizations/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Account_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_account"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Account_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_account"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Account_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Account + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Account{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Account") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/organizations/delegatedadministrator/zz_controller.go b/internal/controller/organizations/delegatedadministrator/zz_controller.go index e9c6130832..9c0d68898d 100755 --- a/internal/controller/organizations/delegatedadministrator/zz_controller.go +++ b/internal/controller/organizations/delegatedadministrator/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/organizations/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DelegatedAdministrator_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_delegated_administrator"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DelegatedAdministrator_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_delegated_administrator"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DelegatedAdministrator_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DelegatedAdministrator + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DelegatedAdministrator{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DelegatedAdministrator") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DelegatedAdministrator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/organizations/organization/zz_controller.go b/internal/controller/organizations/organization/zz_controller.go index 9274294078..dca1095f87 100755 --- a/internal/controller/organizations/organization/zz_controller.go +++ b/internal/controller/organizations/organization/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/organizations/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Organization_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_organization"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Organization_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_organization"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Organization_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Organization + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Organization{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Organization") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Organization_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/organizations/organizationalunit/zz_controller.go b/internal/controller/organizations/organizationalunit/zz_controller.go index fe005f7b30..c4baa8a869 100755 --- a/internal/controller/organizations/organizationalunit/zz_controller.go +++ b/internal/controller/organizations/organizationalunit/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/organizations/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OrganizationalUnit_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_organizational_unit"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OrganizationalUnit_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_organizational_unit"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OrganizationalUnit_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.OrganizationalUnit + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.OrganizationalUnit{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.OrganizationalUnit") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OrganizationalUnit_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/organizations/policy/zz_controller.go b/internal/controller/organizations/policy/zz_controller.go index d8e4426652..2558b61c6d 100755 --- a/internal/controller/organizations/policy/zz_controller.go +++ b/internal/controller/organizations/policy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/organizations/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Policy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Policy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Policy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/organizations/policyattachment/zz_controller.go b/internal/controller/organizations/policyattachment/zz_controller.go index 0be4bcefb5..20cb0408f7 100755 --- a/internal/controller/organizations/policyattachment/zz_controller.go +++ b/internal/controller/organizations/policyattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/organizations/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PolicyAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_policy_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_organizations_policy_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PolicyAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PolicyAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PolicyAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PolicyAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/pinpoint/app/zz_controller.go b/internal/controller/pinpoint/app/zz_controller.go index d62a05179f..9b305f2e22 100755 --- a/internal/controller/pinpoint/app/zz_controller.go +++ b/internal/controller/pinpoint/app/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/pinpoint/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.App_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_pinpoint_app"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.App_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_pinpoint_app"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.App_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.App + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.App{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.App") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.App_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/pinpoint/smschannel/zz_controller.go b/internal/controller/pinpoint/smschannel/zz_controller.go index a978568276..c1042d5d30 100755 --- a/internal/controller/pinpoint/smschannel/zz_controller.go +++ b/internal/controller/pinpoint/smschannel/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/pinpoint/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SMSChannel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_pinpoint_sms_channel"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SMSChannel_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_pinpoint_sms_channel"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SMSChannel_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SMSChannel + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SMSChannel{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SMSChannel") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SMSChannel_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/qldb/ledger/zz_controller.go b/internal/controller/qldb/ledger/zz_controller.go index 34651e6a99..38616483e9 100755 --- a/internal/controller/qldb/ledger/zz_controller.go +++ b/internal/controller/qldb/ledger/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/qldb/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Ledger_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_qldb_ledger"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Ledger_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_qldb_ledger"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Ledger_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Ledger + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Ledger{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Ledger") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Ledger_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/qldb/stream/zz_controller.go b/internal/controller/qldb/stream/zz_controller.go index b08f7550fb..54aca08b6b 100755 --- a/internal/controller/qldb/stream/zz_controller.go +++ b/internal/controller/qldb/stream/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/qldb/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Stream_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_qldb_stream"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stream_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_qldb_stream"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Stream_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Stream + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Stream{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Stream") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Stream_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/quicksight/group/zz_controller.go b/internal/controller/quicksight/group/zz_controller.go index 7858494133..20070244cb 100755 --- a/internal/controller/quicksight/group/zz_controller.go +++ b/internal/controller/quicksight/group/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/quicksight/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_quicksight_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_quicksight_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Group + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Group{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Group") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/quicksight/user/zz_controller.go b/internal/controller/quicksight/user/zz_controller.go index 3afa1a01af..7e01bf6be6 100755 --- a/internal/controller/quicksight/user/zz_controller.go +++ b/internal/controller/quicksight/user/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/quicksight/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_quicksight_user"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_quicksight_user"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.User + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.User{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.User") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ram/principalassociation/zz_controller.go b/internal/controller/ram/principalassociation/zz_controller.go index d5ac1dc080..24b6da5573 100755 --- a/internal/controller/ram/principalassociation/zz_controller.go +++ b/internal/controller/ram/principalassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ram/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PrincipalAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ram_principal_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PrincipalAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ram_principal_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PrincipalAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PrincipalAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PrincipalAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PrincipalAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrincipalAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ram/resourceassociation/zz_controller.go b/internal/controller/ram/resourceassociation/zz_controller.go index 95ec34b4f3..daec01abac 100755 --- a/internal/controller/ram/resourceassociation/zz_controller.go +++ b/internal/controller/ram/resourceassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ram/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourceAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ram_resource_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ram_resource_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResourceAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResourceAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResourceAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourceAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ram/resourceshare/zz_controller.go b/internal/controller/ram/resourceshare/zz_controller.go index d70c6dad9d..e940bf0a4b 100755 --- a/internal/controller/ram/resourceshare/zz_controller.go +++ b/internal/controller/ram/resourceshare/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ram/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourceShare_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ram_resource_share"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceShare_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ram_resource_share"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceShare_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResourceShare + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResourceShare{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResourceShare") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourceShare_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ram/resourceshareaccepter/zz_controller.go b/internal/controller/ram/resourceshareaccepter/zz_controller.go index 8b7d950a47..2b035bab0e 100755 --- a/internal/controller/ram/resourceshareaccepter/zz_controller.go +++ b/internal/controller/ram/resourceshareaccepter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ram/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourceShareAccepter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ram_resource_share_accepter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceShareAccepter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ram_resource_share_accepter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceShareAccepter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResourceShareAccepter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResourceShareAccepter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResourceShareAccepter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourceShareAccepter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/cluster/zz_controller.go b/internal/controller/rds/cluster/zz_controller.go index e1480efb5a..087f6a4364 100755 --- a/internal/controller/rds/cluster/zz_controller.go +++ b/internal/controller/rds/cluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/clusteractivitystream/zz_controller.go b/internal/controller/rds/clusteractivitystream/zz_controller.go index 9de2e7f304..3525b55f19 100755 --- a/internal/controller/rds/clusteractivitystream/zz_controller.go +++ b/internal/controller/rds/clusteractivitystream/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterActivityStream_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster_activity_stream"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterActivityStream_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster_activity_stream"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterActivityStream_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterActivityStream + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterActivityStream{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterActivityStream") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterActivityStream_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/clusterendpoint/zz_controller.go b/internal/controller/rds/clusterendpoint/zz_controller.go index bf7673d25a..9d2395e910 100755 --- a/internal/controller/rds/clusterendpoint/zz_controller.go +++ b/internal/controller/rds/clusterendpoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterEndpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster_endpoint"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterEndpoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster_endpoint"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterEndpoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterEndpoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterEndpoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterEndpoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/clusterinstance/zz_controller.go b/internal/controller/rds/clusterinstance/zz_controller.go index cfbe14127f..3a09060f78 100755 --- a/internal/controller/rds/clusterinstance/zz_controller.go +++ b/internal/controller/rds/clusterinstance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterInstance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterInstance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterInstance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterInstance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterInstance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterInstance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/clusterparametergroup/zz_controller.go b/internal/controller/rds/clusterparametergroup/zz_controller.go index 0369213430..496998f722 100755 --- a/internal/controller/rds/clusterparametergroup/zz_controller.go +++ b/internal/controller/rds/clusterparametergroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterParameterGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster_parameter_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterParameterGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster_parameter_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterParameterGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterParameterGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterParameterGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterParameterGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterParameterGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/clusterroleassociation/zz_controller.go b/internal/controller/rds/clusterroleassociation/zz_controller.go index 3b05cccd07..a67ab996c1 100755 --- a/internal/controller/rds/clusterroleassociation/zz_controller.go +++ b/internal/controller/rds/clusterroleassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterRoleAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster_role_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterRoleAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_cluster_role_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterRoleAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterRoleAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterRoleAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterRoleAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterRoleAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/clustersnapshot/zz_controller.go b/internal/controller/rds/clustersnapshot/zz_controller.go index 69720f2987..c058955e37 100755 --- a/internal/controller/rds/clustersnapshot/zz_controller.go +++ b/internal/controller/rds/clustersnapshot/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ClusterSnapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_cluster_snapshot"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterSnapshot_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_cluster_snapshot"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ClusterSnapshot_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ClusterSnapshot + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ClusterSnapshot{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ClusterSnapshot") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ClusterSnapshot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/dbinstanceautomatedbackupsreplication/zz_controller.go b/internal/controller/rds/dbinstanceautomatedbackupsreplication/zz_controller.go index 689225b8e2..67a0d533d7 100755 --- a/internal/controller/rds/dbinstanceautomatedbackupsreplication/zz_controller.go +++ b/internal/controller/rds/dbinstanceautomatedbackupsreplication/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DBInstanceAutomatedBackupsReplication_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_instance_automated_backups_replication"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DBInstanceAutomatedBackupsReplication_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_instance_automated_backups_replication"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DBInstanceAutomatedBackupsReplication_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DBInstanceAutomatedBackupsReplication + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DBInstanceAutomatedBackupsReplication{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DBInstanceAutomatedBackupsReplication") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DBInstanceAutomatedBackupsReplication_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/dbsnapshotcopy/zz_controller.go b/internal/controller/rds/dbsnapshotcopy/zz_controller.go index 2c3fca6c8e..f1494f2839 100755 --- a/internal/controller/rds/dbsnapshotcopy/zz_controller.go +++ b/internal/controller/rds/dbsnapshotcopy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DBSnapshotCopy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_snapshot_copy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DBSnapshotCopy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_snapshot_copy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DBSnapshotCopy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DBSnapshotCopy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DBSnapshotCopy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DBSnapshotCopy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DBSnapshotCopy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/eventsubscription/zz_controller.go b/internal/controller/rds/eventsubscription/zz_controller.go index 4006e2ba20..d81d411f05 100755 --- a/internal/controller/rds/eventsubscription/zz_controller.go +++ b/internal/controller/rds/eventsubscription/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EventSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_event_subscription"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSubscription_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_event_subscription"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EventSubscription + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EventSubscription{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EventSubscription") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/globalcluster/zz_controller.go b/internal/controller/rds/globalcluster/zz_controller.go index 4f2b197511..63f758fe5e 100755 --- a/internal/controller/rds/globalcluster/zz_controller.go +++ b/internal/controller/rds/globalcluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalCluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_global_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalCluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rds_global_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalCluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GlobalCluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GlobalCluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GlobalCluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GlobalCluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/instance/zz_controller.go b/internal/controller/rds/instance/zz_controller.go index f56f998667..e989b3772a 100755 --- a/internal/controller/rds/instance/zz_controller.go +++ b/internal/controller/rds/instance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Instance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Instance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Instance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/instanceroleassociation/zz_controller.go b/internal/controller/rds/instanceroleassociation/zz_controller.go index 4feb17e71e..588031069a 100755 --- a/internal/controller/rds/instanceroleassociation/zz_controller.go +++ b/internal/controller/rds/instanceroleassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceRoleAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_instance_role_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceRoleAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_instance_role_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceRoleAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InstanceRoleAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InstanceRoleAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InstanceRoleAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InstanceRoleAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/optiongroup/zz_controller.go b/internal/controller/rds/optiongroup/zz_controller.go index f4d9c522ba..ae39f6adec 100755 --- a/internal/controller/rds/optiongroup/zz_controller.go +++ b/internal/controller/rds/optiongroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OptionGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_option_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OptionGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_option_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OptionGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.OptionGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.OptionGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.OptionGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.OptionGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/parametergroup/zz_controller.go b/internal/controller/rds/parametergroup/zz_controller.go index f730120b99..7e8d1926c2 100755 --- a/internal/controller/rds/parametergroup/zz_controller.go +++ b/internal/controller/rds/parametergroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_parameter_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_parameter_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ParameterGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ParameterGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ParameterGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/proxy/zz_controller.go b/internal/controller/rds/proxy/zz_controller.go index c1478aed75..5dd2971f2f 100755 --- a/internal/controller/rds/proxy/zz_controller.go +++ b/internal/controller/rds/proxy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Proxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_proxy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Proxy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_proxy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Proxy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Proxy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Proxy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Proxy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Proxy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/proxydefaulttargetgroup/zz_controller.go b/internal/controller/rds/proxydefaulttargetgroup/zz_controller.go index 2c29930abd..db6c392c67 100755 --- a/internal/controller/rds/proxydefaulttargetgroup/zz_controller.go +++ b/internal/controller/rds/proxydefaulttargetgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProxyDefaultTargetGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_proxy_default_target_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProxyDefaultTargetGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_proxy_default_target_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProxyDefaultTargetGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ProxyDefaultTargetGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ProxyDefaultTargetGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ProxyDefaultTargetGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProxyDefaultTargetGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/proxyendpoint/zz_controller.go b/internal/controller/rds/proxyendpoint/zz_controller.go index 2a4b63408c..731e33dc37 100755 --- a/internal/controller/rds/proxyendpoint/zz_controller.go +++ b/internal/controller/rds/proxyendpoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProxyEndpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_proxy_endpoint"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProxyEndpoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_proxy_endpoint"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProxyEndpoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ProxyEndpoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ProxyEndpoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ProxyEndpoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProxyEndpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/proxytarget/zz_controller.go b/internal/controller/rds/proxytarget/zz_controller.go index 8846bed12f..c9c81ee48b 100755 --- a/internal/controller/rds/proxytarget/zz_controller.go +++ b/internal/controller/rds/proxytarget/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProxyTarget_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_proxy_target"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProxyTarget_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_proxy_target"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProxyTarget_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ProxyTarget + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ProxyTarget{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ProxyTarget") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProxyTarget_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/snapshot/zz_controller.go b/internal/controller/rds/snapshot/zz_controller.go index 0b8c4be103..06ba6d079b 100755 --- a/internal/controller/rds/snapshot/zz_controller.go +++ b/internal/controller/rds/snapshot/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Snapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_snapshot"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Snapshot_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_snapshot"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Snapshot_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Snapshot + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Snapshot{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Snapshot") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Snapshot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rds/subnetgroup/zz_controller.go b/internal/controller/rds/subnetgroup/zz_controller.go index 8666e55aa4..ce8dcba883 100755 --- a/internal/controller/rds/subnetgroup/zz_controller.go +++ b/internal/controller/rds/subnetgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rds/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_subnet_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_db_subnet_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SubnetGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SubnetGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SubnetGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/authenticationprofile/zz_controller.go b/internal/controller/redshift/authenticationprofile/zz_controller.go index a6f7b0d19c..f0ffe439eb 100755 --- a/internal/controller/redshift/authenticationprofile/zz_controller.go +++ b/internal/controller/redshift/authenticationprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AuthenticationProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_authentication_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AuthenticationProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_authentication_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AuthenticationProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AuthenticationProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AuthenticationProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AuthenticationProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AuthenticationProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/cluster/zz_controller.go b/internal/controller/redshift/cluster/zz_controller.go index b3a4fd4919..d544954d18 100755 --- a/internal/controller/redshift/cluster/zz_controller.go +++ b/internal/controller/redshift/cluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/eventsubscription/zz_controller.go b/internal/controller/redshift/eventsubscription/zz_controller.go index 436190ea6f..ec2b859408 100755 --- a/internal/controller/redshift/eventsubscription/zz_controller.go +++ b/internal/controller/redshift/eventsubscription/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EventSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_event_subscription"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSubscription_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_event_subscription"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EventSubscription + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EventSubscription{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EventSubscription") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/hsmclientcertificate/zz_controller.go b/internal/controller/redshift/hsmclientcertificate/zz_controller.go index 08724810ee..5bfbb66763 100755 --- a/internal/controller/redshift/hsmclientcertificate/zz_controller.go +++ b/internal/controller/redshift/hsmclientcertificate/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HSMClientCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_hsm_client_certificate"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HSMClientCertificate_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_hsm_client_certificate"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HSMClientCertificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HSMClientCertificate + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HSMClientCertificate{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HSMClientCertificate") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HSMClientCertificate_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/hsmconfiguration/zz_controller.go b/internal/controller/redshift/hsmconfiguration/zz_controller.go index 2ef13cca6b..3badc81e1e 100755 --- a/internal/controller/redshift/hsmconfiguration/zz_controller.go +++ b/internal/controller/redshift/hsmconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HSMConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_hsm_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HSMConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_hsm_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HSMConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HSMConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HSMConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HSMConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HSMConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/parametergroup/zz_controller.go b/internal/controller/redshift/parametergroup/zz_controller.go index 6c5511e2f4..630ba344f9 100755 --- a/internal/controller/redshift/parametergroup/zz_controller.go +++ b/internal/controller/redshift/parametergroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_parameter_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_parameter_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ParameterGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ParameterGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ParameterGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ParameterGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ParameterGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/scheduledaction/zz_controller.go b/internal/controller/redshift/scheduledaction/zz_controller.go index b8fe3c5065..1dd4929fea 100755 --- a/internal/controller/redshift/scheduledaction/zz_controller.go +++ b/internal/controller/redshift/scheduledaction/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ScheduledAction_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_scheduled_action"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ScheduledAction_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_scheduled_action"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ScheduledAction_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ScheduledAction + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ScheduledAction{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ScheduledAction") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ScheduledAction_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/snapshotcopygrant/zz_controller.go b/internal/controller/redshift/snapshotcopygrant/zz_controller.go index cd0eac4b1e..c88014f872 100755 --- a/internal/controller/redshift/snapshotcopygrant/zz_controller.go +++ b/internal/controller/redshift/snapshotcopygrant/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SnapshotCopyGrant_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_snapshot_copy_grant"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SnapshotCopyGrant_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_snapshot_copy_grant"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SnapshotCopyGrant_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SnapshotCopyGrant + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SnapshotCopyGrant{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SnapshotCopyGrant") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SnapshotCopyGrant_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/snapshotschedule/zz_controller.go b/internal/controller/redshift/snapshotschedule/zz_controller.go index 9a20aab3ab..989b06e232 100755 --- a/internal/controller/redshift/snapshotschedule/zz_controller.go +++ b/internal/controller/redshift/snapshotschedule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SnapshotSchedule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_snapshot_schedule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SnapshotSchedule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_snapshot_schedule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SnapshotSchedule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SnapshotSchedule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SnapshotSchedule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SnapshotSchedule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SnapshotSchedule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/snapshotscheduleassociation/zz_controller.go b/internal/controller/redshift/snapshotscheduleassociation/zz_controller.go index 6e3cd1d62f..e729dd39fe 100755 --- a/internal/controller/redshift/snapshotscheduleassociation/zz_controller.go +++ b/internal/controller/redshift/snapshotscheduleassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SnapshotScheduleAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_snapshot_schedule_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SnapshotScheduleAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_snapshot_schedule_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SnapshotScheduleAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SnapshotScheduleAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SnapshotScheduleAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SnapshotScheduleAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SnapshotScheduleAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/subnetgroup/zz_controller.go b/internal/controller/redshift/subnetgroup/zz_controller.go index 4cf8d8f657..42f48a97d7 100755 --- a/internal/controller/redshift/subnetgroup/zz_controller.go +++ b/internal/controller/redshift/subnetgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_subnet_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_subnet_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SubnetGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SubnetGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SubnetGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SubnetGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshift/usagelimit/zz_controller.go b/internal/controller/redshift/usagelimit/zz_controller.go index 74ec40ba6a..531478b351 100755 --- a/internal/controller/redshift/usagelimit/zz_controller.go +++ b/internal/controller/redshift/usagelimit/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshift/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UsageLimit_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_usage_limit"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UsageLimit_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshift_usage_limit"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UsageLimit_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UsageLimit + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UsageLimit{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UsageLimit") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UsageLimit_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshiftserverless/endpointaccess/zz_controller.go b/internal/controller/redshiftserverless/endpointaccess/zz_controller.go index 77d67f5eab..6ad38cc53b 100755 --- a/internal/controller/redshiftserverless/endpointaccess/zz_controller.go +++ b/internal/controller/redshiftserverless/endpointaccess/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshiftserverless/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EndpointAccess_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_endpoint_access"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EndpointAccess_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_endpoint_access"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EndpointAccess_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EndpointAccess + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EndpointAccess{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EndpointAccess") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EndpointAccess_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshiftserverless/redshiftserverlessnamespace/zz_controller.go b/internal/controller/redshiftserverless/redshiftserverlessnamespace/zz_controller.go index 72bd2eebf1..c7c9d05df9 100755 --- a/internal/controller/redshiftserverless/redshiftserverlessnamespace/zz_controller.go +++ b/internal/controller/redshiftserverless/redshiftserverlessnamespace/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshiftserverless/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RedshiftServerlessNamespace_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_namespace"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RedshiftServerlessNamespace_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_namespace"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RedshiftServerlessNamespace_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RedshiftServerlessNamespace + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RedshiftServerlessNamespace{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RedshiftServerlessNamespace") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RedshiftServerlessNamespace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshiftserverless/resourcepolicy/zz_controller.go b/internal/controller/redshiftserverless/resourcepolicy/zz_controller.go index f9e4c1eac0..caa14247f5 100755 --- a/internal/controller/redshiftserverless/resourcepolicy/zz_controller.go +++ b/internal/controller/redshiftserverless/resourcepolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshiftserverless/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourcePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_resource_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourcePolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_resource_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourcePolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResourcePolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResourcePolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResourcePolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourcePolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshiftserverless/snapshot/zz_controller.go b/internal/controller/redshiftserverless/snapshot/zz_controller.go index da56915e91..1a84ca671a 100755 --- a/internal/controller/redshiftserverless/snapshot/zz_controller.go +++ b/internal/controller/redshiftserverless/snapshot/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshiftserverless/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Snapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_snapshot"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Snapshot_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_snapshot"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Snapshot_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Snapshot + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Snapshot{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Snapshot") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Snapshot_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshiftserverless/usagelimit/zz_controller.go b/internal/controller/redshiftserverless/usagelimit/zz_controller.go index 52531d5afb..318a77df55 100755 --- a/internal/controller/redshiftserverless/usagelimit/zz_controller.go +++ b/internal/controller/redshiftserverless/usagelimit/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshiftserverless/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UsageLimit_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_usage_limit"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UsageLimit_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_usage_limit"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UsageLimit_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UsageLimit + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UsageLimit{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UsageLimit") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UsageLimit_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/redshiftserverless/workgroup/zz_controller.go b/internal/controller/redshiftserverless/workgroup/zz_controller.go index 7ed7540270..fcb4ed1889 100755 --- a/internal/controller/redshiftserverless/workgroup/zz_controller.go +++ b/internal/controller/redshiftserverless/workgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/redshiftserverless/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Workgroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_workgroup"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workgroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_redshiftserverless_workgroup"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workgroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Workgroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Workgroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Workgroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Workgroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/resourcegroups/group/zz_controller.go b/internal/controller/resourcegroups/group/zz_controller.go index 6366bea7ba..54234b4aae 100755 --- a/internal/controller/resourcegroups/group/zz_controller.go +++ b/internal/controller/resourcegroups/group/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/resourcegroups/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_resourcegroups_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_resourcegroups_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Group + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Group{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Group") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rolesanywhere/profile/zz_controller.go b/internal/controller/rolesanywhere/profile/zz_controller.go index ba3ae471a9..eaf7f23c41 100755 --- a/internal/controller/rolesanywhere/profile/zz_controller.go +++ b/internal/controller/rolesanywhere/profile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rolesanywhere/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Profile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rolesanywhere_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Profile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rolesanywhere_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Profile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Profile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Profile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Profile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Profile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53/delegationset/zz_controller.go b/internal/controller/route53/delegationset/zz_controller.go index 3b43157238..af82da3faf 100755 --- a/internal/controller/route53/delegationset/zz_controller.go +++ b/internal/controller/route53/delegationset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DelegationSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_delegation_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DelegationSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_delegation_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DelegationSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DelegationSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DelegationSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DelegationSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DelegationSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53/healthcheck/zz_controller.go b/internal/controller/route53/healthcheck/zz_controller.go index 0279507b3f..84196fa33b 100755 --- a/internal/controller/route53/healthcheck/zz_controller.go +++ b/internal/controller/route53/healthcheck/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HealthCheck_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_health_check"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HealthCheck_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_health_check"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HealthCheck_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HealthCheck + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HealthCheck{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HealthCheck") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HealthCheck_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53/hostedzonednssec/zz_controller.go b/internal/controller/route53/hostedzonednssec/zz_controller.go index 912a4eb244..b754da974e 100755 --- a/internal/controller/route53/hostedzonednssec/zz_controller.go +++ b/internal/controller/route53/hostedzonednssec/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HostedZoneDNSSEC_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_hosted_zone_dnssec"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedZoneDNSSEC_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_hosted_zone_dnssec"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HostedZoneDNSSEC_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HostedZoneDNSSEC + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HostedZoneDNSSEC{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HostedZoneDNSSEC") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HostedZoneDNSSEC_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53/record/zz_controller.go b/internal/controller/route53/record/zz_controller.go index d99f68e74f..9b3ff4b0cd 100755 --- a/internal/controller/route53/record/zz_controller.go +++ b/internal/controller/route53/record/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Record_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_record"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Record_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_record"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Record_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Record + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Record{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Record") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Record_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53/resolverconfig/zz_controller.go b/internal/controller/route53/resolverconfig/zz_controller.go index 44d77321f1..575a23a0cf 100755 --- a/internal/controller/route53/resolverconfig/zz_controller.go +++ b/internal/controller/route53/resolverconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResolverConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_resolver_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResolverConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_resolver_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResolverConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResolverConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResolverConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResolverConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResolverConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53/trafficpolicy/zz_controller.go b/internal/controller/route53/trafficpolicy/zz_controller.go index 5ba175f2f2..f304ec896c 100755 --- a/internal/controller/route53/trafficpolicy/zz_controller.go +++ b/internal/controller/route53/trafficpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TrafficPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_traffic_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TrafficPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_traffic_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TrafficPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TrafficPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TrafficPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TrafficPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TrafficPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53/trafficpolicyinstance/zz_controller.go b/internal/controller/route53/trafficpolicyinstance/zz_controller.go index 7fb1882fc6..2c40449ae9 100755 --- a/internal/controller/route53/trafficpolicyinstance/zz_controller.go +++ b/internal/controller/route53/trafficpolicyinstance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TrafficPolicyInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_traffic_policy_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TrafficPolicyInstance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_traffic_policy_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TrafficPolicyInstance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TrafficPolicyInstance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TrafficPolicyInstance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TrafficPolicyInstance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TrafficPolicyInstance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53/vpcassociationauthorization/zz_controller.go b/internal/controller/route53/vpcassociationauthorization/zz_controller.go index 86aa4b9cf5..7153cee9e2 100755 --- a/internal/controller/route53/vpcassociationauthorization/zz_controller.go +++ b/internal/controller/route53/vpcassociationauthorization/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPCAssociationAuthorization_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_vpc_association_authorization"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCAssociationAuthorization_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_vpc_association_authorization"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPCAssociationAuthorization_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VPCAssociationAuthorization + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VPCAssociationAuthorization{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VPCAssociationAuthorization") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VPCAssociationAuthorization_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53/zone/zz_controller.go b/internal/controller/route53/zone/zz_controller.go index ddf6088ff6..334bf787bf 100755 --- a/internal/controller/route53/zone/zz_controller.go +++ b/internal/controller/route53/zone/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Zone_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_zone"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Zone_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_zone"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Zone_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Zone + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Zone{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Zone") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Zone_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53/zoneassociation/zz_controller.go b/internal/controller/route53/zoneassociation/zz_controller.go index 1310b0ae0f..da4a504bac 100755 --- a/internal/controller/route53/zoneassociation/zz_controller.go +++ b/internal/controller/route53/zoneassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ZoneAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_zone_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ZoneAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_zone_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ZoneAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ZoneAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ZoneAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ZoneAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ZoneAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53recoverycontrolconfig/cluster/zz_controller.go b/internal/controller/route53recoverycontrolconfig/cluster/zz_controller.go index cf9ae14b82..459a0e0bdf 100755 --- a/internal/controller/route53recoverycontrolconfig/cluster/zz_controller.go +++ b/internal/controller/route53recoverycontrolconfig/cluster/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53recoverycontrolconfig/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoverycontrolconfig_cluster"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoverycontrolconfig_cluster"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cluster + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cluster{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cluster") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53recoverycontrolconfig/controlpanel/zz_controller.go b/internal/controller/route53recoverycontrolconfig/controlpanel/zz_controller.go index 2e5e8efef9..3fdea3a1b7 100755 --- a/internal/controller/route53recoverycontrolconfig/controlpanel/zz_controller.go +++ b/internal/controller/route53recoverycontrolconfig/controlpanel/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53recoverycontrolconfig/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ControlPanel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoverycontrolconfig_control_panel"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ControlPanel_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoverycontrolconfig_control_panel"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ControlPanel_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ControlPanel + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ControlPanel{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ControlPanel") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ControlPanel_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53recoverycontrolconfig/routingcontrol/zz_controller.go b/internal/controller/route53recoverycontrolconfig/routingcontrol/zz_controller.go index baf224c29c..2c476c3942 100755 --- a/internal/controller/route53recoverycontrolconfig/routingcontrol/zz_controller.go +++ b/internal/controller/route53recoverycontrolconfig/routingcontrol/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53recoverycontrolconfig/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RoutingControl_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoverycontrolconfig_routing_control"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RoutingControl_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoverycontrolconfig_routing_control"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RoutingControl_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RoutingControl + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RoutingControl{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RoutingControl") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RoutingControl_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53recoverycontrolconfig/safetyrule/zz_controller.go b/internal/controller/route53recoverycontrolconfig/safetyrule/zz_controller.go index a1bc019230..aceec96a6e 100755 --- a/internal/controller/route53recoverycontrolconfig/safetyrule/zz_controller.go +++ b/internal/controller/route53recoverycontrolconfig/safetyrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53recoverycontrolconfig/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SafetyRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoverycontrolconfig_safety_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SafetyRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoverycontrolconfig_safety_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SafetyRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SafetyRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SafetyRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SafetyRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SafetyRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53recoveryreadiness/cell/zz_controller.go b/internal/controller/route53recoveryreadiness/cell/zz_controller.go index 566a78aa48..04322e6ca8 100755 --- a/internal/controller/route53recoveryreadiness/cell/zz_controller.go +++ b/internal/controller/route53recoveryreadiness/cell/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53recoveryreadiness/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cell_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoveryreadiness_cell"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cell_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoveryreadiness_cell"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cell_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Cell + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Cell{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Cell") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Cell_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53recoveryreadiness/readinesscheck/zz_controller.go b/internal/controller/route53recoveryreadiness/readinesscheck/zz_controller.go index d245a304ae..36ba018fd1 100755 --- a/internal/controller/route53recoveryreadiness/readinesscheck/zz_controller.go +++ b/internal/controller/route53recoveryreadiness/readinesscheck/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53recoveryreadiness/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReadinessCheck_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoveryreadiness_readiness_check"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReadinessCheck_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoveryreadiness_readiness_check"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReadinessCheck_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReadinessCheck + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReadinessCheck{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReadinessCheck") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReadinessCheck_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53recoveryreadiness/recoverygroup/zz_controller.go b/internal/controller/route53recoveryreadiness/recoverygroup/zz_controller.go index 79c270e4bf..9991ecf997 100755 --- a/internal/controller/route53recoveryreadiness/recoverygroup/zz_controller.go +++ b/internal/controller/route53recoveryreadiness/recoverygroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53recoveryreadiness/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RecoveryGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoveryreadiness_recovery_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RecoveryGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoveryreadiness_recovery_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RecoveryGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RecoveryGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RecoveryGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RecoveryGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RecoveryGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53recoveryreadiness/resourceset/zz_controller.go b/internal/controller/route53recoveryreadiness/resourceset/zz_controller.go index 0d7ad69480..fdb77c9107 100755 --- a/internal/controller/route53recoveryreadiness/resourceset/zz_controller.go +++ b/internal/controller/route53recoveryreadiness/resourceset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53recoveryreadiness/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourceSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoveryreadiness_resource_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53recoveryreadiness_resource_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResourceSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResourceSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResourceSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourceSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53resolver/endpoint/zz_controller.go b/internal/controller/route53resolver/endpoint/zz_controller.go index 6792afbd64..9f6bcad36a 100755 --- a/internal/controller/route53resolver/endpoint/zz_controller.go +++ b/internal/controller/route53resolver/endpoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53resolver/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Endpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_resolver_endpoint"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Endpoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_resolver_endpoint"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Endpoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Endpoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Endpoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Endpoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Endpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53resolver/rule/zz_controller.go b/internal/controller/route53resolver/rule/zz_controller.go index ad3f7ab570..372aec186d 100755 --- a/internal/controller/route53resolver/rule/zz_controller.go +++ b/internal/controller/route53resolver/rule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53resolver/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Rule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_resolver_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Rule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_resolver_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Rule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Rule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Rule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Rule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Rule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/route53resolver/ruleassociation/zz_controller.go b/internal/controller/route53resolver/ruleassociation/zz_controller.go index 0d15cd5f8d..04d508884b 100755 --- a/internal/controller/route53resolver/ruleassociation/zz_controller.go +++ b/internal/controller/route53resolver/ruleassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/route53resolver/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RuleAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_resolver_rule_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RuleAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_route53_resolver_rule_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RuleAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RuleAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RuleAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RuleAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RuleAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rum/appmonitor/zz_controller.go b/internal/controller/rum/appmonitor/zz_controller.go index 2408bee9d1..be3e5725a3 100755 --- a/internal/controller/rum/appmonitor/zz_controller.go +++ b/internal/controller/rum/appmonitor/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rum/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppMonitor_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rum_app_monitor"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppMonitor_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rum_app_monitor"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppMonitor_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AppMonitor + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AppMonitor{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AppMonitor") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppMonitor_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/rum/metricsdestination/zz_controller.go b/internal/controller/rum/metricsdestination/zz_controller.go index a33d207051..4774813439 100755 --- a/internal/controller/rum/metricsdestination/zz_controller.go +++ b/internal/controller/rum/metricsdestination/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/rum/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MetricsDestination_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rum_metrics_destination"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MetricsDestination_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_rum_metrics_destination"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MetricsDestination_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MetricsDestination + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MetricsDestination{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MetricsDestination") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MetricsDestination_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucket/zz_controller.go b/internal/controller/s3/bucket/zz_controller.go index b815d70df4..e2963c2a9b 100755 --- a/internal/controller/s3/bucket/zz_controller.go +++ b/internal/controller/s3/bucket/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Bucket_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Bucket_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Bucket_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Bucket + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Bucket{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Bucket") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Bucket_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketaccelerateconfiguration/zz_controller.go b/internal/controller/s3/bucketaccelerateconfiguration/zz_controller.go index 64511b62ed..eee835647d 100755 --- a/internal/controller/s3/bucketaccelerateconfiguration/zz_controller.go +++ b/internal/controller/s3/bucketaccelerateconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketAccelerateConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_accelerate_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketAccelerateConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_accelerate_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketAccelerateConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketAccelerateConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketAccelerateConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketAccelerateConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketAccelerateConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketacl/zz_controller.go b/internal/controller/s3/bucketacl/zz_controller.go index e84e23fe20..b0b4b37a78 100755 --- a/internal/controller/s3/bucketacl/zz_controller.go +++ b/internal/controller/s3/bucketacl/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_acl"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketACL_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_acl"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketACL_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketACL + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketACL{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketACL") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketACL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketanalyticsconfiguration/zz_controller.go b/internal/controller/s3/bucketanalyticsconfiguration/zz_controller.go index dcdab16d12..fd24d56f6e 100755 --- a/internal/controller/s3/bucketanalyticsconfiguration/zz_controller.go +++ b/internal/controller/s3/bucketanalyticsconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketAnalyticsConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_analytics_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketAnalyticsConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_analytics_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketAnalyticsConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketAnalyticsConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketAnalyticsConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketAnalyticsConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketAnalyticsConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketcorsconfiguration/zz_controller.go b/internal/controller/s3/bucketcorsconfiguration/zz_controller.go index 733471c4f3..82ac5068a7 100755 --- a/internal/controller/s3/bucketcorsconfiguration/zz_controller.go +++ b/internal/controller/s3/bucketcorsconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketCorsConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_cors_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketCorsConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_cors_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketCorsConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketCorsConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketCorsConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketCorsConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketCorsConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketintelligenttieringconfiguration/zz_controller.go b/internal/controller/s3/bucketintelligenttieringconfiguration/zz_controller.go index fc4859181f..eb3eb0f43f 100755 --- a/internal/controller/s3/bucketintelligenttieringconfiguration/zz_controller.go +++ b/internal/controller/s3/bucketintelligenttieringconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketIntelligentTieringConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_intelligent_tiering_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketIntelligentTieringConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_intelligent_tiering_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketIntelligentTieringConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketIntelligentTieringConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketIntelligentTieringConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketIntelligentTieringConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketIntelligentTieringConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketinventory/zz_controller.go b/internal/controller/s3/bucketinventory/zz_controller.go index e9925417ee..9c2497d6c3 100755 --- a/internal/controller/s3/bucketinventory/zz_controller.go +++ b/internal/controller/s3/bucketinventory/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketInventory_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_inventory"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketInventory_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_inventory"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketInventory_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketInventory + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketInventory{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketInventory") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketInventory_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketlifecycleconfiguration/zz_controller.go b/internal/controller/s3/bucketlifecycleconfiguration/zz_controller.go index f0178c9327..1883a6d19c 100755 --- a/internal/controller/s3/bucketlifecycleconfiguration/zz_controller.go +++ b/internal/controller/s3/bucketlifecycleconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketLifecycleConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_lifecycle_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketLifecycleConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_lifecycle_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketLifecycleConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketLifecycleConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketLifecycleConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketLifecycleConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketLifecycleConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketlogging/zz_controller.go b/internal/controller/s3/bucketlogging/zz_controller.go index 62577f95bb..96decb34ad 100755 --- a/internal/controller/s3/bucketlogging/zz_controller.go +++ b/internal/controller/s3/bucketlogging/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketLogging_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_logging"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketLogging_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_logging"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketLogging_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketLogging + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketLogging{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketLogging") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketLogging_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketmetric/zz_controller.go b/internal/controller/s3/bucketmetric/zz_controller.go index ba66207f85..1310d2180d 100755 --- a/internal/controller/s3/bucketmetric/zz_controller.go +++ b/internal/controller/s3/bucketmetric/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketMetric_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_metric"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketMetric_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_metric"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketMetric_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketMetric + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketMetric{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketMetric") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketMetric_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketnotification/zz_controller.go b/internal/controller/s3/bucketnotification/zz_controller.go index 9f9b4d1671..b90297bf14 100755 --- a/internal/controller/s3/bucketnotification/zz_controller.go +++ b/internal/controller/s3/bucketnotification/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketNotification_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_notification"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketNotification_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_notification"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketNotification_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketNotification + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketNotification{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketNotification") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketNotification_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketobject/zz_controller.go b/internal/controller/s3/bucketobject/zz_controller.go index 5728dba15c..9829054d76 100755 --- a/internal/controller/s3/bucketobject/zz_controller.go +++ b/internal/controller/s3/bucketobject/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketObject_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_object"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketObject_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_object"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketObject_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketObject + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketObject{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketObject") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketObject_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketobjectlockconfiguration/zz_controller.go b/internal/controller/s3/bucketobjectlockconfiguration/zz_controller.go index cb8de3efc7..0c452a6929 100755 --- a/internal/controller/s3/bucketobjectlockconfiguration/zz_controller.go +++ b/internal/controller/s3/bucketobjectlockconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketObjectLockConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_object_lock_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketObjectLockConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_object_lock_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketObjectLockConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketObjectLockConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketObjectLockConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketObjectLockConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketObjectLockConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketownershipcontrols/zz_controller.go b/internal/controller/s3/bucketownershipcontrols/zz_controller.go index f56fb4dd7e..728975a6e2 100755 --- a/internal/controller/s3/bucketownershipcontrols/zz_controller.go +++ b/internal/controller/s3/bucketownershipcontrols/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketOwnershipControls_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_ownership_controls"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketOwnershipControls_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_ownership_controls"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketOwnershipControls_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketOwnershipControls + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketOwnershipControls{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketOwnershipControls") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketOwnershipControls_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketpolicy/zz_controller.go b/internal/controller/s3/bucketpolicy/zz_controller.go index 5dd11083e5..78f83ed509 100755 --- a/internal/controller/s3/bucketpolicy/zz_controller.go +++ b/internal/controller/s3/bucketpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketpublicaccessblock/zz_controller.go b/internal/controller/s3/bucketpublicaccessblock/zz_controller.go index 8e67982973..441755507b 100755 --- a/internal/controller/s3/bucketpublicaccessblock/zz_controller.go +++ b/internal/controller/s3/bucketpublicaccessblock/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketPublicAccessBlock_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_public_access_block"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketPublicAccessBlock_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_public_access_block"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketPublicAccessBlock_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketPublicAccessBlock + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketPublicAccessBlock{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketPublicAccessBlock") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketPublicAccessBlock_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketreplicationconfiguration/zz_controller.go b/internal/controller/s3/bucketreplicationconfiguration/zz_controller.go index 27055f9ff1..17405ee3ee 100755 --- a/internal/controller/s3/bucketreplicationconfiguration/zz_controller.go +++ b/internal/controller/s3/bucketreplicationconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketReplicationConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_replication_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketReplicationConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_replication_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketReplicationConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketReplicationConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketReplicationConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketReplicationConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketReplicationConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketrequestpaymentconfiguration/zz_controller.go b/internal/controller/s3/bucketrequestpaymentconfiguration/zz_controller.go index aa3b9779c4..b4d362346b 100755 --- a/internal/controller/s3/bucketrequestpaymentconfiguration/zz_controller.go +++ b/internal/controller/s3/bucketrequestpaymentconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketRequestPaymentConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_request_payment_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketRequestPaymentConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_request_payment_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketRequestPaymentConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketRequestPaymentConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketRequestPaymentConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketRequestPaymentConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketRequestPaymentConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketserversideencryptionconfiguration/zz_controller.go b/internal/controller/s3/bucketserversideencryptionconfiguration/zz_controller.go index 8405d1b188..87db5b622d 100755 --- a/internal/controller/s3/bucketserversideencryptionconfiguration/zz_controller.go +++ b/internal/controller/s3/bucketserversideencryptionconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketServerSideEncryptionConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_server_side_encryption_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketServerSideEncryptionConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_server_side_encryption_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketServerSideEncryptionConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketServerSideEncryptionConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketServerSideEncryptionConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketServerSideEncryptionConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketServerSideEncryptionConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketversioning/zz_controller.go b/internal/controller/s3/bucketversioning/zz_controller.go index a1b80ef559..eac9dc9c76 100755 --- a/internal/controller/s3/bucketversioning/zz_controller.go +++ b/internal/controller/s3/bucketversioning/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketVersioning_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_versioning"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketVersioning_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_versioning"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketVersioning_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketVersioning + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketVersioning{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketVersioning") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketVersioning_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/bucketwebsiteconfiguration/zz_controller.go b/internal/controller/s3/bucketwebsiteconfiguration/zz_controller.go index abe1bedd1c..c40d1c6559 100755 --- a/internal/controller/s3/bucketwebsiteconfiguration/zz_controller.go +++ b/internal/controller/s3/bucketwebsiteconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketWebsiteConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_website_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketWebsiteConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_bucket_website_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketWebsiteConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BucketWebsiteConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BucketWebsiteConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BucketWebsiteConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BucketWebsiteConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/object/zz_controller.go b/internal/controller/s3/object/zz_controller.go index 3840df4ea4..7e8af12253 100755 --- a/internal/controller/s3/object/zz_controller.go +++ b/internal/controller/s3/object/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Object_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_object"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Object_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_object"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Object_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Object + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Object{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Object") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Object_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3/objectcopy/zz_controller.go b/internal/controller/s3/objectcopy/zz_controller.go index efed53fcec..c53cc56ef0 100755 --- a/internal/controller/s3/objectcopy/zz_controller.go +++ b/internal/controller/s3/objectcopy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ObjectCopy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_object_copy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ObjectCopy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_object_copy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ObjectCopy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ObjectCopy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ObjectCopy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ObjectCopy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ObjectCopy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3control/accesspoint/zz_controller.go b/internal/controller/s3control/accesspoint/zz_controller.go index aef1cd90ae..d1ea512e51 100755 --- a/internal/controller/s3control/accesspoint/zz_controller.go +++ b/internal/controller/s3control/accesspoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3control/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessPoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_access_point"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessPoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_access_point"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessPoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AccessPoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AccessPoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AccessPoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AccessPoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3control/accesspointpolicy/zz_controller.go b/internal/controller/s3control/accesspointpolicy/zz_controller.go index 9310b1a480..a4bbfa3eeb 100755 --- a/internal/controller/s3control/accesspointpolicy/zz_controller.go +++ b/internal/controller/s3control/accesspointpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3control/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessPointPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_access_point_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessPointPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_access_point_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessPointPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AccessPointPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AccessPointPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AccessPointPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AccessPointPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3control/accountpublicaccessblock/zz_controller.go b/internal/controller/s3control/accountpublicaccessblock/zz_controller.go index c053f4ea3f..460b44cbd4 100755 --- a/internal/controller/s3control/accountpublicaccessblock/zz_controller.go +++ b/internal/controller/s3control/accountpublicaccessblock/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3control/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccountPublicAccessBlock_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_account_public_access_block"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccountPublicAccessBlock_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3_account_public_access_block"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccountPublicAccessBlock_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AccountPublicAccessBlock + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AccountPublicAccessBlock{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AccountPublicAccessBlock") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AccountPublicAccessBlock_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3control/multiregionaccesspoint/zz_controller.go b/internal/controller/s3control/multiregionaccesspoint/zz_controller.go index f080d3570a..a149db828b 100755 --- a/internal/controller/s3control/multiregionaccesspoint/zz_controller.go +++ b/internal/controller/s3control/multiregionaccesspoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3control/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MultiRegionAccessPoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_multi_region_access_point"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MultiRegionAccessPoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_multi_region_access_point"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MultiRegionAccessPoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MultiRegionAccessPoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MultiRegionAccessPoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MultiRegionAccessPoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MultiRegionAccessPoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3control/multiregionaccesspointpolicy/zz_controller.go b/internal/controller/s3control/multiregionaccesspointpolicy/zz_controller.go index 6bb6791a16..72ba831a5a 100755 --- a/internal/controller/s3control/multiregionaccesspointpolicy/zz_controller.go +++ b/internal/controller/s3control/multiregionaccesspointpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3control/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MultiRegionAccessPointPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_multi_region_access_point_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MultiRegionAccessPointPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_multi_region_access_point_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MultiRegionAccessPointPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MultiRegionAccessPointPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MultiRegionAccessPointPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MultiRegionAccessPointPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MultiRegionAccessPointPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3control/objectlambdaaccesspoint/zz_controller.go b/internal/controller/s3control/objectlambdaaccesspoint/zz_controller.go index 7090d21179..5ff33f64be 100755 --- a/internal/controller/s3control/objectlambdaaccesspoint/zz_controller.go +++ b/internal/controller/s3control/objectlambdaaccesspoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3control/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ObjectLambdaAccessPoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_object_lambda_access_point"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ObjectLambdaAccessPoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_object_lambda_access_point"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ObjectLambdaAccessPoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ObjectLambdaAccessPoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ObjectLambdaAccessPoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ObjectLambdaAccessPoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ObjectLambdaAccessPoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3control/objectlambdaaccesspointpolicy/zz_controller.go b/internal/controller/s3control/objectlambdaaccesspointpolicy/zz_controller.go index 529a1a8a40..5064aa12af 100755 --- a/internal/controller/s3control/objectlambdaaccesspointpolicy/zz_controller.go +++ b/internal/controller/s3control/objectlambdaaccesspointpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3control/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ObjectLambdaAccessPointPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_object_lambda_access_point_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ObjectLambdaAccessPointPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_object_lambda_access_point_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ObjectLambdaAccessPointPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ObjectLambdaAccessPointPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ObjectLambdaAccessPointPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ObjectLambdaAccessPointPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ObjectLambdaAccessPointPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/s3control/storagelensconfiguration/zz_controller.go b/internal/controller/s3control/storagelensconfiguration/zz_controller.go index c61d2edd17..639fa12a6a 100755 --- a/internal/controller/s3control/storagelensconfiguration/zz_controller.go +++ b/internal/controller/s3control/storagelensconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/s3control/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StorageLensConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_storage_lens_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StorageLensConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_s3control_storage_lens_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StorageLensConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.StorageLensConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.StorageLensConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.StorageLensConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StorageLensConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/app/zz_controller.go b/internal/controller/sagemaker/app/zz_controller.go index c4fb1218da..ad5013b7ec 100755 --- a/internal/controller/sagemaker/app/zz_controller.go +++ b/internal/controller/sagemaker/app/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.App_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_app"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.App_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_app"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.App_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.App + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.App{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.App") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.App_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/appimageconfig/zz_controller.go b/internal/controller/sagemaker/appimageconfig/zz_controller.go index a1954551df..0d0bbf4339 100755 --- a/internal/controller/sagemaker/appimageconfig/zz_controller.go +++ b/internal/controller/sagemaker/appimageconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppImageConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_app_image_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppImageConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_app_image_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppImageConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AppImageConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AppImageConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AppImageConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AppImageConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/coderepository/zz_controller.go b/internal/controller/sagemaker/coderepository/zz_controller.go index 428fa8917e..22c16337e3 100755 --- a/internal/controller/sagemaker/coderepository/zz_controller.go +++ b/internal/controller/sagemaker/coderepository/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CodeRepository_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_code_repository"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CodeRepository_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_code_repository"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CodeRepository_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CodeRepository + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CodeRepository{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CodeRepository") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CodeRepository_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/device/zz_controller.go b/internal/controller/sagemaker/device/zz_controller.go index 647a6a78dc..7e42d1f010 100755 --- a/internal/controller/sagemaker/device/zz_controller.go +++ b/internal/controller/sagemaker/device/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Device_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_device"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Device_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_device"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Device_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Device + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Device{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Device") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Device_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/devicefleet/zz_controller.go b/internal/controller/sagemaker/devicefleet/zz_controller.go index 952fdf94e1..141f78fed7 100755 --- a/internal/controller/sagemaker/devicefleet/zz_controller.go +++ b/internal/controller/sagemaker/devicefleet/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DeviceFleet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_device_fleet"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeviceFleet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_device_fleet"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeviceFleet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DeviceFleet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DeviceFleet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DeviceFleet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DeviceFleet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/domain/zz_controller.go b/internal/controller/sagemaker/domain/zz_controller.go index 77714275d3..ec656e68e9 100755 --- a/internal/controller/sagemaker/domain/zz_controller.go +++ b/internal/controller/sagemaker/domain/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_domain"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_domain"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Domain + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Domain{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Domain") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/endpoint/zz_controller.go b/internal/controller/sagemaker/endpoint/zz_controller.go index eca9532458..7c2093bb86 100755 --- a/internal/controller/sagemaker/endpoint/zz_controller.go +++ b/internal/controller/sagemaker/endpoint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Endpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_endpoint"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Endpoint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_endpoint"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Endpoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Endpoint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Endpoint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Endpoint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Endpoint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/endpointconfiguration/zz_controller.go b/internal/controller/sagemaker/endpointconfiguration/zz_controller.go index ab5d809097..fb8573c757 100755 --- a/internal/controller/sagemaker/endpointconfiguration/zz_controller.go +++ b/internal/controller/sagemaker/endpointconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EndpointConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_endpoint_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EndpointConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_endpoint_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EndpointConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EndpointConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EndpointConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EndpointConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EndpointConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/featuregroup/zz_controller.go b/internal/controller/sagemaker/featuregroup/zz_controller.go index 96b32e9f3c..1fd5c2abf5 100755 --- a/internal/controller/sagemaker/featuregroup/zz_controller.go +++ b/internal/controller/sagemaker/featuregroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FeatureGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_feature_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FeatureGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_feature_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FeatureGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FeatureGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FeatureGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FeatureGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FeatureGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/image/zz_controller.go b/internal/controller/sagemaker/image/zz_controller.go index 5e0fe0d5b3..0d773af069 100755 --- a/internal/controller/sagemaker/image/zz_controller.go +++ b/internal/controller/sagemaker/image/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Image_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_image"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Image_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_image"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Image_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Image + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Image{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Image") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Image_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/imageversion/zz_controller.go b/internal/controller/sagemaker/imageversion/zz_controller.go index 6086ffd729..6912d21bb0 100755 --- a/internal/controller/sagemaker/imageversion/zz_controller.go +++ b/internal/controller/sagemaker/imageversion/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ImageVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_image_version"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ImageVersion_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_image_version"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ImageVersion_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ImageVersion + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ImageVersion{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ImageVersion") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ImageVersion_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/model/zz_controller.go b/internal/controller/sagemaker/model/zz_controller.go index 86af861fc6..5a4178b209 100755 --- a/internal/controller/sagemaker/model/zz_controller.go +++ b/internal/controller/sagemaker/model/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Model_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_model"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Model_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_model"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Model_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Model + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Model{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Model") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Model_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/modelpackagegroup/zz_controller.go b/internal/controller/sagemaker/modelpackagegroup/zz_controller.go index da010ed2a9..54c3eaaf34 100755 --- a/internal/controller/sagemaker/modelpackagegroup/zz_controller.go +++ b/internal/controller/sagemaker/modelpackagegroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ModelPackageGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_model_package_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ModelPackageGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_model_package_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ModelPackageGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ModelPackageGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ModelPackageGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ModelPackageGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ModelPackageGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/modelpackagegrouppolicy/zz_controller.go b/internal/controller/sagemaker/modelpackagegrouppolicy/zz_controller.go index dcfa6a8580..8d244aa568 100755 --- a/internal/controller/sagemaker/modelpackagegrouppolicy/zz_controller.go +++ b/internal/controller/sagemaker/modelpackagegrouppolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ModelPackageGroupPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_model_package_group_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ModelPackageGroupPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_model_package_group_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ModelPackageGroupPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ModelPackageGroupPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ModelPackageGroupPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ModelPackageGroupPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ModelPackageGroupPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/notebookinstance/zz_controller.go b/internal/controller/sagemaker/notebookinstance/zz_controller.go index 67a1244abe..e77147b8fc 100755 --- a/internal/controller/sagemaker/notebookinstance/zz_controller.go +++ b/internal/controller/sagemaker/notebookinstance/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NotebookInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_notebook_instance"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NotebookInstance_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_notebook_instance"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NotebookInstance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NotebookInstance + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NotebookInstance{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NotebookInstance") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NotebookInstance_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/notebookinstancelifecycleconfiguration/zz_controller.go b/internal/controller/sagemaker/notebookinstancelifecycleconfiguration/zz_controller.go index 2758f687db..88e9149ff4 100755 --- a/internal/controller/sagemaker/notebookinstancelifecycleconfiguration/zz_controller.go +++ b/internal/controller/sagemaker/notebookinstancelifecycleconfiguration/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NotebookInstanceLifecycleConfiguration_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_notebook_instance_lifecycle_configuration"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NotebookInstanceLifecycleConfiguration_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_notebook_instance_lifecycle_configuration"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NotebookInstanceLifecycleConfiguration_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NotebookInstanceLifecycleConfiguration + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NotebookInstanceLifecycleConfiguration{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NotebookInstanceLifecycleConfiguration") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NotebookInstanceLifecycleConfiguration_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/servicecatalogportfoliostatus/zz_controller.go b/internal/controller/sagemaker/servicecatalogportfoliostatus/zz_controller.go index 53958f0236..1e14df08fd 100755 --- a/internal/controller/sagemaker/servicecatalogportfoliostatus/zz_controller.go +++ b/internal/controller/sagemaker/servicecatalogportfoliostatus/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServicecatalogPortfolioStatus_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_servicecatalog_portfolio_status"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServicecatalogPortfolioStatus_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_servicecatalog_portfolio_status"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServicecatalogPortfolioStatus_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ServicecatalogPortfolioStatus + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ServicecatalogPortfolioStatus{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ServicecatalogPortfolioStatus") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ServicecatalogPortfolioStatus_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/space/zz_controller.go b/internal/controller/sagemaker/space/zz_controller.go index 84fb303a02..d0fde7fd4d 100755 --- a/internal/controller/sagemaker/space/zz_controller.go +++ b/internal/controller/sagemaker/space/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Space_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_space"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Space_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_space"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Space_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Space + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Space{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Space") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Space_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/studiolifecycleconfig/zz_controller.go b/internal/controller/sagemaker/studiolifecycleconfig/zz_controller.go index 34c57f7a09..296629d5cb 100755 --- a/internal/controller/sagemaker/studiolifecycleconfig/zz_controller.go +++ b/internal/controller/sagemaker/studiolifecycleconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StudioLifecycleConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_studio_lifecycle_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StudioLifecycleConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_studio_lifecycle_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StudioLifecycleConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.StudioLifecycleConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.StudioLifecycleConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.StudioLifecycleConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StudioLifecycleConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/userprofile/zz_controller.go b/internal/controller/sagemaker/userprofile/zz_controller.go index ab302dd42a..e79733bb9f 100755 --- a/internal/controller/sagemaker/userprofile/zz_controller.go +++ b/internal/controller/sagemaker/userprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UserProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_user_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_user_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UserProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.UserProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.UserProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.UserProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.UserProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/workforce/zz_controller.go b/internal/controller/sagemaker/workforce/zz_controller.go index 5612ea0093..7e3e86b368 100755 --- a/internal/controller/sagemaker/workforce/zz_controller.go +++ b/internal/controller/sagemaker/workforce/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Workforce_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_workforce"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workforce_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_workforce"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workforce_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Workforce + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Workforce{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Workforce") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Workforce_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sagemaker/workteam/zz_controller.go b/internal/controller/sagemaker/workteam/zz_controller.go index ea9fad69e0..52cf3a5761 100755 --- a/internal/controller/sagemaker/workteam/zz_controller.go +++ b/internal/controller/sagemaker/workteam/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sagemaker/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Workteam_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_workteam"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workteam_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sagemaker_workteam"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workteam_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Workteam + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Workteam{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Workteam") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Workteam_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/scheduler/schedule/zz_controller.go b/internal/controller/scheduler/schedule/zz_controller.go index 04bc456109..c82d075f99 100755 --- a/internal/controller/scheduler/schedule/zz_controller.go +++ b/internal/controller/scheduler/schedule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/scheduler/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Schedule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_scheduler_schedule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Schedule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_scheduler_schedule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Schedule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Schedule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Schedule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Schedule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Schedule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/scheduler/schedulegroup/zz_controller.go b/internal/controller/scheduler/schedulegroup/zz_controller.go index c08b303d72..d923547d57 100755 --- a/internal/controller/scheduler/schedulegroup/zz_controller.go +++ b/internal/controller/scheduler/schedulegroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/scheduler/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ScheduleGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_scheduler_schedule_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ScheduleGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_scheduler_schedule_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ScheduleGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ScheduleGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ScheduleGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ScheduleGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ScheduleGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/schemas/discoverer/zz_controller.go b/internal/controller/schemas/discoverer/zz_controller.go index ae351c6940..7263b8d75c 100755 --- a/internal/controller/schemas/discoverer/zz_controller.go +++ b/internal/controller/schemas/discoverer/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/schemas/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Discoverer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_schemas_discoverer"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Discoverer_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_schemas_discoverer"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Discoverer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Discoverer + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Discoverer{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Discoverer") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Discoverer_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/schemas/registry/zz_controller.go b/internal/controller/schemas/registry/zz_controller.go index 08626739a7..170d935d49 100755 --- a/internal/controller/schemas/registry/zz_controller.go +++ b/internal/controller/schemas/registry/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/schemas/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Registry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_schemas_registry"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Registry_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_schemas_registry"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Registry_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Registry + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Registry{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Registry") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Registry_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/schemas/schema/zz_controller.go b/internal/controller/schemas/schema/zz_controller.go index a6a95913c5..70a4d0b047 100755 --- a/internal/controller/schemas/schema/zz_controller.go +++ b/internal/controller/schemas/schema/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/schemas/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Schema_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_schemas_schema"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Schema_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_schemas_schema"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Schema_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Schema + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Schema{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Schema") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Schema_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/secretsmanager/secret/zz_controller.go b/internal/controller/secretsmanager/secret/zz_controller.go index ea7f6a5445..42ae919cc6 100755 --- a/internal/controller/secretsmanager/secret/zz_controller.go +++ b/internal/controller/secretsmanager/secret/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/secretsmanager/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Secret_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_secretsmanager_secret"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Secret_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_secretsmanager_secret"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Secret_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Secret + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Secret{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Secret") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Secret_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/secretsmanager/secretpolicy/zz_controller.go b/internal/controller/secretsmanager/secretpolicy/zz_controller.go index 69c9466881..ed27ba6587 100755 --- a/internal/controller/secretsmanager/secretpolicy/zz_controller.go +++ b/internal/controller/secretsmanager/secretpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/secretsmanager/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecretPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_secretsmanager_secret_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecretPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_secretsmanager_secret_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecretPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SecretPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SecretPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SecretPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecretPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/secretsmanager/secretrotation/zz_controller.go b/internal/controller/secretsmanager/secretrotation/zz_controller.go index 4960e025d1..f589c4fe61 100755 --- a/internal/controller/secretsmanager/secretrotation/zz_controller.go +++ b/internal/controller/secretsmanager/secretrotation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/secretsmanager/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecretRotation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_secretsmanager_secret_rotation"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecretRotation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_secretsmanager_secret_rotation"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecretRotation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SecretRotation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SecretRotation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SecretRotation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecretRotation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/secretsmanager/secretversion/zz_controller.go b/internal/controller/secretsmanager/secretversion/zz_controller.go index a722636bf0..dda168013e 100755 --- a/internal/controller/secretsmanager/secretversion/zz_controller.go +++ b/internal/controller/secretsmanager/secretversion/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/secretsmanager/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecretVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_secretsmanager_secret_version"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecretVersion_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_secretsmanager_secret_version"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecretVersion_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SecretVersion + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SecretVersion{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SecretVersion") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SecretVersion_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityhub/account/zz_controller.go b/internal/controller/securityhub/account/zz_controller.go index 83180c1c2e..fb4479d7d7 100755 --- a/internal/controller/securityhub/account/zz_controller.go +++ b/internal/controller/securityhub/account/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/securityhub/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Account_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_account"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Account_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_account"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Account_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Account + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Account{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Account") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Account_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityhub/actiontarget/zz_controller.go b/internal/controller/securityhub/actiontarget/zz_controller.go index 9aa4f4db74..132ed9c4a1 100755 --- a/internal/controller/securityhub/actiontarget/zz_controller.go +++ b/internal/controller/securityhub/actiontarget/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/securityhub/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ActionTarget_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_action_target"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ActionTarget_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_action_target"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ActionTarget_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ActionTarget + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ActionTarget{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ActionTarget") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ActionTarget_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityhub/findingaggregator/zz_controller.go b/internal/controller/securityhub/findingaggregator/zz_controller.go index 1eece19eae..6f29f254cd 100755 --- a/internal/controller/securityhub/findingaggregator/zz_controller.go +++ b/internal/controller/securityhub/findingaggregator/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/securityhub/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FindingAggregator_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_finding_aggregator"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FindingAggregator_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_finding_aggregator"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FindingAggregator_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.FindingAggregator + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.FindingAggregator{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.FindingAggregator") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.FindingAggregator_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityhub/insight/zz_controller.go b/internal/controller/securityhub/insight/zz_controller.go index 53a5330ef2..bab87406fc 100755 --- a/internal/controller/securityhub/insight/zz_controller.go +++ b/internal/controller/securityhub/insight/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/securityhub/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Insight_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_insight"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Insight_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_insight"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Insight_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Insight + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Insight{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Insight") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Insight_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityhub/inviteaccepter/zz_controller.go b/internal/controller/securityhub/inviteaccepter/zz_controller.go index 4d1e644272..6b55568486 100755 --- a/internal/controller/securityhub/inviteaccepter/zz_controller.go +++ b/internal/controller/securityhub/inviteaccepter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/securityhub/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InviteAccepter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_invite_accepter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InviteAccepter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_invite_accepter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InviteAccepter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InviteAccepter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InviteAccepter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InviteAccepter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InviteAccepter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityhub/member/zz_controller.go b/internal/controller/securityhub/member/zz_controller.go index 6f9d3bcb45..c5a621ef97 100755 --- a/internal/controller/securityhub/member/zz_controller.go +++ b/internal/controller/securityhub/member/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/securityhub/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_member"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Member_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_member"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Member_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Member + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Member{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Member") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Member_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityhub/productsubscription/zz_controller.go b/internal/controller/securityhub/productsubscription/zz_controller.go index b0f06505f9..500944848b 100755 --- a/internal/controller/securityhub/productsubscription/zz_controller.go +++ b/internal/controller/securityhub/productsubscription/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/securityhub/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProductSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_product_subscription"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProductSubscription_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_product_subscription"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProductSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ProductSubscription + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ProductSubscription{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ProductSubscription") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProductSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/securityhub/standardssubscription/zz_controller.go b/internal/controller/securityhub/standardssubscription/zz_controller.go index 8271f71c7f..82fb1c1ba7 100755 --- a/internal/controller/securityhub/standardssubscription/zz_controller.go +++ b/internal/controller/securityhub/standardssubscription/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/securityhub/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StandardsSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_standards_subscription"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StandardsSubscription_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_securityhub_standards_subscription"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StandardsSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.StandardsSubscription + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.StandardsSubscription{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.StandardsSubscription") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StandardsSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/serverlessrepo/cloudformationstack/zz_controller.go b/internal/controller/serverlessrepo/cloudformationstack/zz_controller.go index 77e125e188..65fd01ea0a 100755 --- a/internal/controller/serverlessrepo/cloudformationstack/zz_controller.go +++ b/internal/controller/serverlessrepo/cloudformationstack/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/serverlessrepo/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CloudFormationStack_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_serverlessapplicationrepository_cloudformation_stack"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CloudFormationStack_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_serverlessapplicationrepository_cloudformation_stack"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CloudFormationStack_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CloudFormationStack + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CloudFormationStack{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CloudFormationStack") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CloudFormationStack_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicecatalog/budgetresourceassociation/zz_controller.go b/internal/controller/servicecatalog/budgetresourceassociation/zz_controller.go index 46c0e7d959..cbc9beab05 100755 --- a/internal/controller/servicecatalog/budgetresourceassociation/zz_controller.go +++ b/internal/controller/servicecatalog/budgetresourceassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicecatalog/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BudgetResourceAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_budget_resource_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BudgetResourceAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_budget_resource_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BudgetResourceAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.BudgetResourceAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.BudgetResourceAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.BudgetResourceAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.BudgetResourceAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicecatalog/constraint/zz_controller.go b/internal/controller/servicecatalog/constraint/zz_controller.go index 5c697bba3a..9e071db5e7 100755 --- a/internal/controller/servicecatalog/constraint/zz_controller.go +++ b/internal/controller/servicecatalog/constraint/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicecatalog/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Constraint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_constraint"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Constraint_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_constraint"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Constraint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Constraint + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Constraint{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Constraint") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Constraint_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicecatalog/portfolio/zz_controller.go b/internal/controller/servicecatalog/portfolio/zz_controller.go index fdd9ba2fd7..428800f78a 100755 --- a/internal/controller/servicecatalog/portfolio/zz_controller.go +++ b/internal/controller/servicecatalog/portfolio/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicecatalog/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Portfolio_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_portfolio"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Portfolio_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_portfolio"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Portfolio_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Portfolio + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Portfolio{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Portfolio") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Portfolio_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicecatalog/portfolioshare/zz_controller.go b/internal/controller/servicecatalog/portfolioshare/zz_controller.go index 43fb5042e8..38e0538f24 100755 --- a/internal/controller/servicecatalog/portfolioshare/zz_controller.go +++ b/internal/controller/servicecatalog/portfolioshare/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicecatalog/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PortfolioShare_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_portfolio_share"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PortfolioShare_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_portfolio_share"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PortfolioShare_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PortfolioShare + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PortfolioShare{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PortfolioShare") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PortfolioShare_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicecatalog/principalportfolioassociation/zz_controller.go b/internal/controller/servicecatalog/principalportfolioassociation/zz_controller.go index f9d2343207..9eb2f52eac 100755 --- a/internal/controller/servicecatalog/principalportfolioassociation/zz_controller.go +++ b/internal/controller/servicecatalog/principalportfolioassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicecatalog/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PrincipalPortfolioAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_principal_portfolio_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PrincipalPortfolioAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_principal_portfolio_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PrincipalPortfolioAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PrincipalPortfolioAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PrincipalPortfolioAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PrincipalPortfolioAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrincipalPortfolioAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicecatalog/product/zz_controller.go b/internal/controller/servicecatalog/product/zz_controller.go index 46e3dedcc2..fcfd03e62f 100755 --- a/internal/controller/servicecatalog/product/zz_controller.go +++ b/internal/controller/servicecatalog/product/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicecatalog/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Product_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_product"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Product_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_product"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Product_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Product + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Product{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Product") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Product_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicecatalog/productportfolioassociation/zz_controller.go b/internal/controller/servicecatalog/productportfolioassociation/zz_controller.go index f6b60d2622..1e39ee84a6 100755 --- a/internal/controller/servicecatalog/productportfolioassociation/zz_controller.go +++ b/internal/controller/servicecatalog/productportfolioassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicecatalog/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProductPortfolioAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_product_portfolio_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProductPortfolioAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_product_portfolio_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProductPortfolioAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ProductPortfolioAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ProductPortfolioAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ProductPortfolioAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProductPortfolioAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicecatalog/provisioningartifact/zz_controller.go b/internal/controller/servicecatalog/provisioningartifact/zz_controller.go index c1577b75bc..c5e4cbb0ac 100755 --- a/internal/controller/servicecatalog/provisioningartifact/zz_controller.go +++ b/internal/controller/servicecatalog/provisioningartifact/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicecatalog/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProvisioningArtifact_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_provisioning_artifact"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProvisioningArtifact_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_provisioning_artifact"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProvisioningArtifact_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ProvisioningArtifact + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ProvisioningArtifact{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ProvisioningArtifact") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ProvisioningArtifact_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicecatalog/serviceaction/zz_controller.go b/internal/controller/servicecatalog/serviceaction/zz_controller.go index 15a150395f..907e435b15 100755 --- a/internal/controller/servicecatalog/serviceaction/zz_controller.go +++ b/internal/controller/servicecatalog/serviceaction/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicecatalog/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceAction_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_service_action"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceAction_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_service_action"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceAction_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ServiceAction + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ServiceAction{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ServiceAction") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ServiceAction_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicecatalog/tagoption/zz_controller.go b/internal/controller/servicecatalog/tagoption/zz_controller.go index b7f0fc1ab6..7950ff0076 100755 --- a/internal/controller/servicecatalog/tagoption/zz_controller.go +++ b/internal/controller/servicecatalog/tagoption/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicecatalog/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TagOption_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_tag_option"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TagOption_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_tag_option"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TagOption_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TagOption + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TagOption{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TagOption") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TagOption_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicecatalog/tagoptionresourceassociation/zz_controller.go b/internal/controller/servicecatalog/tagoptionresourceassociation/zz_controller.go index 6f2ff006f7..0f6700280d 100755 --- a/internal/controller/servicecatalog/tagoptionresourceassociation/zz_controller.go +++ b/internal/controller/servicecatalog/tagoptionresourceassociation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicecatalog/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TagOptionResourceAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_tag_option_resource_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TagOptionResourceAssociation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicecatalog_tag_option_resource_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TagOptionResourceAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TagOptionResourceAssociation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TagOptionResourceAssociation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TagOptionResourceAssociation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TagOptionResourceAssociation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicediscovery/httpnamespace/zz_controller.go b/internal/controller/servicediscovery/httpnamespace/zz_controller.go index bcd62459ea..d84584a165 100755 --- a/internal/controller/servicediscovery/httpnamespace/zz_controller.go +++ b/internal/controller/servicediscovery/httpnamespace/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicediscovery/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HTTPNamespace_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_service_discovery_http_namespace"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HTTPNamespace_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_service_discovery_http_namespace"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HTTPNamespace_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.HTTPNamespace + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.HTTPNamespace{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.HTTPNamespace") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.HTTPNamespace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicediscovery/privatednsnamespace/zz_controller.go b/internal/controller/servicediscovery/privatednsnamespace/zz_controller.go index 114bbc0256..653ec6c4d7 100755 --- a/internal/controller/servicediscovery/privatednsnamespace/zz_controller.go +++ b/internal/controller/servicediscovery/privatednsnamespace/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicediscovery/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PrivateDNSNamespace_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_service_discovery_private_dns_namespace"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PrivateDNSNamespace_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_service_discovery_private_dns_namespace"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PrivateDNSNamespace_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PrivateDNSNamespace + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PrivateDNSNamespace{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PrivateDNSNamespace") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PrivateDNSNamespace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicediscovery/publicdnsnamespace/zz_controller.go b/internal/controller/servicediscovery/publicdnsnamespace/zz_controller.go index b940984a13..55da309222 100755 --- a/internal/controller/servicediscovery/publicdnsnamespace/zz_controller.go +++ b/internal/controller/servicediscovery/publicdnsnamespace/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicediscovery/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PublicDNSNamespace_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_service_discovery_public_dns_namespace"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PublicDNSNamespace_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_service_discovery_public_dns_namespace"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PublicDNSNamespace_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PublicDNSNamespace + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PublicDNSNamespace{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PublicDNSNamespace") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PublicDNSNamespace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicediscovery/service/zz_controller.go b/internal/controller/servicediscovery/service/zz_controller.go index e6020d3d03..68d69ad092 100755 --- a/internal/controller/servicediscovery/service/zz_controller.go +++ b/internal/controller/servicediscovery/service/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicediscovery/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Service_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_service_discovery_service"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Service_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_service_discovery_service"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Service_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Service + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Service{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Service") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Service_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/servicequotas/servicequota/zz_controller.go b/internal/controller/servicequotas/servicequota/zz_controller.go index 0822a90130..d7143032ed 100755 --- a/internal/controller/servicequotas/servicequota/zz_controller.go +++ b/internal/controller/servicequotas/servicequota/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/servicequotas/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceQuota_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicequotas_service_quota"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceQuota_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_servicequotas_service_quota"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceQuota_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ServiceQuota + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ServiceQuota{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ServiceQuota") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ServiceQuota_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/activereceiptruleset/zz_controller.go b/internal/controller/ses/activereceiptruleset/zz_controller.go index b2ff5fe716..35909cd6af 100755 --- a/internal/controller/ses/activereceiptruleset/zz_controller.go +++ b/internal/controller/ses/activereceiptruleset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ActiveReceiptRuleSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_active_receipt_rule_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ActiveReceiptRuleSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_active_receipt_rule_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ActiveReceiptRuleSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ActiveReceiptRuleSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ActiveReceiptRuleSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ActiveReceiptRuleSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ActiveReceiptRuleSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/configurationset/zz_controller.go b/internal/controller/ses/configurationset/zz_controller.go index b067e94481..cc4657259b 100755 --- a/internal/controller/ses/configurationset/zz_controller.go +++ b/internal/controller/ses/configurationset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConfigurationSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_configuration_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_configuration_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConfigurationSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConfigurationSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConfigurationSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConfigurationSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/domaindkim/zz_controller.go b/internal/controller/ses/domaindkim/zz_controller.go index ba759f82d0..ff5f1cee35 100755 --- a/internal/controller/ses/domaindkim/zz_controller.go +++ b/internal/controller/ses/domaindkim/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainDKIM_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_domain_dkim"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainDKIM_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_domain_dkim"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainDKIM_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DomainDKIM + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DomainDKIM{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DomainDKIM") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainDKIM_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/domainidentity/zz_controller.go b/internal/controller/ses/domainidentity/zz_controller.go index e227e9c865..68db560e1c 100755 --- a/internal/controller/ses/domainidentity/zz_controller.go +++ b/internal/controller/ses/domainidentity/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainIdentity_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_domain_identity"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainIdentity_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_domain_identity"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainIdentity_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DomainIdentity + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DomainIdentity{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DomainIdentity") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainIdentity_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/domainmailfrom/zz_controller.go b/internal/controller/ses/domainmailfrom/zz_controller.go index df66678a36..49cf990262 100755 --- a/internal/controller/ses/domainmailfrom/zz_controller.go +++ b/internal/controller/ses/domainmailfrom/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainMailFrom_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_domain_mail_from"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainMailFrom_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_domain_mail_from"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainMailFrom_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DomainMailFrom + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DomainMailFrom{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DomainMailFrom") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DomainMailFrom_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/emailidentity/zz_controller.go b/internal/controller/ses/emailidentity/zz_controller.go index 1be0e674de..f001ebd936 100755 --- a/internal/controller/ses/emailidentity/zz_controller.go +++ b/internal/controller/ses/emailidentity/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EmailIdentity_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_email_identity"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EmailIdentity_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_email_identity"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EmailIdentity_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EmailIdentity + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EmailIdentity{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EmailIdentity") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EmailIdentity_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/eventdestination/zz_controller.go b/internal/controller/ses/eventdestination/zz_controller.go index 50c6347f78..c60f424636 100755 --- a/internal/controller/ses/eventdestination/zz_controller.go +++ b/internal/controller/ses/eventdestination/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EventDestination_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_event_destination"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventDestination_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_event_destination"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EventDestination_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EventDestination + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EventDestination{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EventDestination") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EventDestination_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/identitynotificationtopic/zz_controller.go b/internal/controller/ses/identitynotificationtopic/zz_controller.go index faa553c161..9373fe3e63 100755 --- a/internal/controller/ses/identitynotificationtopic/zz_controller.go +++ b/internal/controller/ses/identitynotificationtopic/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IdentityNotificationTopic_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_identity_notification_topic"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IdentityNotificationTopic_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_identity_notification_topic"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IdentityNotificationTopic_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.IdentityNotificationTopic + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.IdentityNotificationTopic{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.IdentityNotificationTopic") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IdentityNotificationTopic_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/identitypolicy/zz_controller.go b/internal/controller/ses/identitypolicy/zz_controller.go index af5be28e4a..d0cef7396c 100755 --- a/internal/controller/ses/identitypolicy/zz_controller.go +++ b/internal/controller/ses/identitypolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IdentityPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_identity_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IdentityPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_identity_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IdentityPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.IdentityPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.IdentityPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.IdentityPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IdentityPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/receiptfilter/zz_controller.go b/internal/controller/ses/receiptfilter/zz_controller.go index 0b57bf5105..9038804586 100755 --- a/internal/controller/ses/receiptfilter/zz_controller.go +++ b/internal/controller/ses/receiptfilter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReceiptFilter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_receipt_filter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReceiptFilter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_receipt_filter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReceiptFilter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReceiptFilter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReceiptFilter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReceiptFilter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReceiptFilter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/receiptrule/zz_controller.go b/internal/controller/ses/receiptrule/zz_controller.go index 4b7ceaf3c1..025a3c880c 100755 --- a/internal/controller/ses/receiptrule/zz_controller.go +++ b/internal/controller/ses/receiptrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReceiptRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_receipt_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReceiptRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_receipt_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReceiptRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReceiptRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReceiptRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReceiptRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReceiptRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/receiptruleset/zz_controller.go b/internal/controller/ses/receiptruleset/zz_controller.go index c181b15e2e..2447b3e0bc 100755 --- a/internal/controller/ses/receiptruleset/zz_controller.go +++ b/internal/controller/ses/receiptruleset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReceiptRuleSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_receipt_rule_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReceiptRuleSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_receipt_rule_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReceiptRuleSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ReceiptRuleSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ReceiptRuleSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ReceiptRuleSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ReceiptRuleSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ses/template/zz_controller.go b/internal/controller/ses/template/zz_controller.go index 5cbb31e0ad..b8b247d1a0 100755 --- a/internal/controller/ses/template/zz_controller.go +++ b/internal/controller/ses/template/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ses/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Template_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_template"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Template_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ses_template"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Template_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Template + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Template{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Template") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Template_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sesv2/configurationset/zz_controller.go b/internal/controller/sesv2/configurationset/zz_controller.go index 3766161c7a..e0dc5dff29 100755 --- a/internal/controller/sesv2/configurationset/zz_controller.go +++ b/internal/controller/sesv2/configurationset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sesv2/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConfigurationSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_configuration_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_configuration_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConfigurationSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConfigurationSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConfigurationSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConfigurationSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sesv2/configurationseteventdestination/zz_controller.go b/internal/controller/sesv2/configurationseteventdestination/zz_controller.go index 6023a37119..cfc62b1f38 100755 --- a/internal/controller/sesv2/configurationseteventdestination/zz_controller.go +++ b/internal/controller/sesv2/configurationseteventdestination/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sesv2/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConfigurationSetEventDestination_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_configuration_set_event_destination"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationSetEventDestination_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_configuration_set_event_destination"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConfigurationSetEventDestination_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ConfigurationSetEventDestination + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ConfigurationSetEventDestination{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ConfigurationSetEventDestination") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ConfigurationSetEventDestination_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sesv2/dedicatedippool/zz_controller.go b/internal/controller/sesv2/dedicatedippool/zz_controller.go index 7ba352c622..ae5563f552 100755 --- a/internal/controller/sesv2/dedicatedippool/zz_controller.go +++ b/internal/controller/sesv2/dedicatedippool/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sesv2/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DedicatedIPPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_dedicated_ip_pool"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DedicatedIPPool_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_dedicated_ip_pool"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DedicatedIPPool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DedicatedIPPool + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DedicatedIPPool{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DedicatedIPPool") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DedicatedIPPool_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sesv2/emailidentity/zz_controller.go b/internal/controller/sesv2/emailidentity/zz_controller.go index 25742d4ffe..a9bc44207c 100755 --- a/internal/controller/sesv2/emailidentity/zz_controller.go +++ b/internal/controller/sesv2/emailidentity/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sesv2/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EmailIdentity_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_email_identity"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EmailIdentity_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_email_identity"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EmailIdentity_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EmailIdentity + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EmailIdentity{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EmailIdentity") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EmailIdentity_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sesv2/emailidentityfeedbackattributes/zz_controller.go b/internal/controller/sesv2/emailidentityfeedbackattributes/zz_controller.go index bc3707b000..83782638d3 100755 --- a/internal/controller/sesv2/emailidentityfeedbackattributes/zz_controller.go +++ b/internal/controller/sesv2/emailidentityfeedbackattributes/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sesv2/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EmailIdentityFeedbackAttributes_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_email_identity_feedback_attributes"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EmailIdentityFeedbackAttributes_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_email_identity_feedback_attributes"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EmailIdentityFeedbackAttributes_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EmailIdentityFeedbackAttributes + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EmailIdentityFeedbackAttributes{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EmailIdentityFeedbackAttributes") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EmailIdentityFeedbackAttributes_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sesv2/emailidentitymailfromattributes/zz_controller.go b/internal/controller/sesv2/emailidentitymailfromattributes/zz_controller.go index 6ea7dd643c..8d12d80c03 100755 --- a/internal/controller/sesv2/emailidentitymailfromattributes/zz_controller.go +++ b/internal/controller/sesv2/emailidentitymailfromattributes/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sesv2/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EmailIdentityMailFromAttributes_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_email_identity_mail_from_attributes"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EmailIdentityMailFromAttributes_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sesv2_email_identity_mail_from_attributes"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EmailIdentityMailFromAttributes_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EmailIdentityMailFromAttributes + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EmailIdentityMailFromAttributes{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EmailIdentityMailFromAttributes") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EmailIdentityMailFromAttributes_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sfn/activity/zz_controller.go b/internal/controller/sfn/activity/zz_controller.go index 10ce67d3cd..38ac895415 100755 --- a/internal/controller/sfn/activity/zz_controller.go +++ b/internal/controller/sfn/activity/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sfn/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Activity_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sfn_activity"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Activity_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sfn_activity"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Activity_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Activity + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Activity{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Activity") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Activity_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sfn/statemachine/zz_controller.go b/internal/controller/sfn/statemachine/zz_controller.go index 3a6b3a51c3..e2572027d9 100755 --- a/internal/controller/sfn/statemachine/zz_controller.go +++ b/internal/controller/sfn/statemachine/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sfn/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StateMachine_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sfn_state_machine"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StateMachine_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sfn_state_machine"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StateMachine_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.StateMachine + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.StateMachine{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.StateMachine") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.StateMachine_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/signer/signingjob/zz_controller.go b/internal/controller/signer/signingjob/zz_controller.go index 2e37b4f7c4..9d9c6a74b6 100755 --- a/internal/controller/signer/signingjob/zz_controller.go +++ b/internal/controller/signer/signingjob/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/signer/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SigningJob_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_signer_signing_job"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SigningJob_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_signer_signing_job"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SigningJob_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SigningJob + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SigningJob{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SigningJob") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SigningJob_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/signer/signingprofile/zz_controller.go b/internal/controller/signer/signingprofile/zz_controller.go index 4a0fcaf016..fbdc5992d1 100755 --- a/internal/controller/signer/signingprofile/zz_controller.go +++ b/internal/controller/signer/signingprofile/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/signer/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SigningProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_signer_signing_profile"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SigningProfile_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_signer_signing_profile"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SigningProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SigningProfile + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SigningProfile{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SigningProfile") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SigningProfile_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/signer/signingprofilepermission/zz_controller.go b/internal/controller/signer/signingprofilepermission/zz_controller.go index ecd031eed1..1f8b983fc5 100755 --- a/internal/controller/signer/signingprofilepermission/zz_controller.go +++ b/internal/controller/signer/signingprofilepermission/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/signer/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SigningProfilePermission_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_signer_signing_profile_permission"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SigningProfilePermission_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_signer_signing_profile_permission"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SigningProfilePermission_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SigningProfilePermission + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SigningProfilePermission{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SigningProfilePermission") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SigningProfilePermission_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/simpledb/domain/zz_controller.go b/internal/controller/simpledb/domain/zz_controller.go index d7a748eb70..78e5e04473 100755 --- a/internal/controller/simpledb/domain/zz_controller.go +++ b/internal/controller/simpledb/domain/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/terraform" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/simpledb/v1beta1" @@ -56,6 +57,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Domain + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Domain{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Domain") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sns/platformapplication/zz_controller.go b/internal/controller/sns/platformapplication/zz_controller.go index 90fff803a2..1ed61202c4 100755 --- a/internal/controller/sns/platformapplication/zz_controller.go +++ b/internal/controller/sns/platformapplication/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sns/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PlatformApplication_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sns_platform_application"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PlatformApplication_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sns_platform_application"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PlatformApplication_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PlatformApplication + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PlatformApplication{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PlatformApplication") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PlatformApplication_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sns/smspreferences/zz_controller.go b/internal/controller/sns/smspreferences/zz_controller.go index 9faf3d7890..de99ff82aa 100755 --- a/internal/controller/sns/smspreferences/zz_controller.go +++ b/internal/controller/sns/smspreferences/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sns/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SMSPreferences_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sns_sms_preferences"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SMSPreferences_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sns_sms_preferences"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SMSPreferences_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SMSPreferences + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SMSPreferences{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SMSPreferences") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SMSPreferences_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sns/topic/zz_controller.go b/internal/controller/sns/topic/zz_controller.go index 554ef706be..b611a6176d 100755 --- a/internal/controller/sns/topic/zz_controller.go +++ b/internal/controller/sns/topic/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sns/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Topic_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sns_topic"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Topic_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sns_topic"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Topic_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Topic + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Topic{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Topic") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Topic_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sns/topicpolicy/zz_controller.go b/internal/controller/sns/topicpolicy/zz_controller.go index 89701a2d9f..857b6da42f 100755 --- a/internal/controller/sns/topicpolicy/zz_controller.go +++ b/internal/controller/sns/topicpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sns/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TopicPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sns_topic_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TopicPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sns_topic_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TopicPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TopicPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TopicPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TopicPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TopicPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sns/topicsubscription/zz_controller.go b/internal/controller/sns/topicsubscription/zz_controller.go index b0b250bc2a..ccb7f4d3ec 100755 --- a/internal/controller/sns/topicsubscription/zz_controller.go +++ b/internal/controller/sns/topicsubscription/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sns/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TopicSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sns_topic_subscription"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TopicSubscription_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sns_topic_subscription"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TopicSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.TopicSubscription + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TopicSubscription{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TopicSubscription") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TopicSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sqs/queue/zz_controller.go b/internal/controller/sqs/queue/zz_controller.go index d42897e1cf..1e6c5d91fa 100755 --- a/internal/controller/sqs/queue/zz_controller.go +++ b/internal/controller/sqs/queue/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sqs/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Queue_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sqs_queue"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Queue_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sqs_queue"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Queue_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Queue + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Queue{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Queue") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Queue_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sqs/queuepolicy/zz_controller.go b/internal/controller/sqs/queuepolicy/zz_controller.go index e99b4a3bea..7be142b84b 100755 --- a/internal/controller/sqs/queuepolicy/zz_controller.go +++ b/internal/controller/sqs/queuepolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sqs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.QueuePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sqs_queue_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.QueuePolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sqs_queue_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.QueuePolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.QueuePolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.QueuePolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.QueuePolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.QueuePolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sqs/queueredriveallowpolicy/zz_controller.go b/internal/controller/sqs/queueredriveallowpolicy/zz_controller.go index 3b178b7bcf..787ab8433d 100755 --- a/internal/controller/sqs/queueredriveallowpolicy/zz_controller.go +++ b/internal/controller/sqs/queueredriveallowpolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sqs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.QueueRedriveAllowPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sqs_queue_redrive_allow_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.QueueRedriveAllowPolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sqs_queue_redrive_allow_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.QueueRedriveAllowPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.QueueRedriveAllowPolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.QueueRedriveAllowPolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.QueueRedriveAllowPolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.QueueRedriveAllowPolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/sqs/queueredrivepolicy/zz_controller.go b/internal/controller/sqs/queueredrivepolicy/zz_controller.go index e96f0decfe..256143ba2f 100755 --- a/internal/controller/sqs/queueredrivepolicy/zz_controller.go +++ b/internal/controller/sqs/queueredrivepolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/sqs/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.QueueRedrivePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sqs_queue_redrive_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.QueueRedrivePolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_sqs_queue_redrive_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.QueueRedrivePolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.QueueRedrivePolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.QueueRedrivePolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.QueueRedrivePolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.QueueRedrivePolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/activation/zz_controller.go b/internal/controller/ssm/activation/zz_controller.go index 37dd37b4cd..11709eb646 100755 --- a/internal/controller/ssm/activation/zz_controller.go +++ b/internal/controller/ssm/activation/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Activation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_activation"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Activation_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_activation"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Activation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Activation + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Activation{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Activation") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Activation_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/association/zz_controller.go b/internal/controller/ssm/association/zz_controller.go index e5791285f4..ad75123cc2 100755 --- a/internal/controller/ssm/association/zz_controller.go +++ b/internal/controller/ssm/association/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Association_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_association"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Association_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_association"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Association_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Association + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Association{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Association") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Association_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/defaultpatchbaseline/zz_controller.go b/internal/controller/ssm/defaultpatchbaseline/zz_controller.go index 72096b2d65..2f9a129759 100755 --- a/internal/controller/ssm/defaultpatchbaseline/zz_controller.go +++ b/internal/controller/ssm/defaultpatchbaseline/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultPatchBaseline_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_default_patch_baseline"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultPatchBaseline_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_default_patch_baseline"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultPatchBaseline_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.DefaultPatchBaseline + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.DefaultPatchBaseline{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.DefaultPatchBaseline") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.DefaultPatchBaseline_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/document/zz_controller.go b/internal/controller/ssm/document/zz_controller.go index eb9350e665..3050e78bf2 100755 --- a/internal/controller/ssm/document/zz_controller.go +++ b/internal/controller/ssm/document/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Document_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_document"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Document_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_document"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Document_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Document + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Document{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Document") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Document_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/maintenancewindow/zz_controller.go b/internal/controller/ssm/maintenancewindow/zz_controller.go index ef6c3508ca..30b9c7a83c 100755 --- a/internal/controller/ssm/maintenancewindow/zz_controller.go +++ b/internal/controller/ssm/maintenancewindow/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MaintenanceWindow_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_maintenance_window"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MaintenanceWindow_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_maintenance_window"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MaintenanceWindow_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MaintenanceWindow + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MaintenanceWindow{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MaintenanceWindow") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MaintenanceWindow_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/maintenancewindowtarget/zz_controller.go b/internal/controller/ssm/maintenancewindowtarget/zz_controller.go index 3a251dd37d..abce9cfcbd 100755 --- a/internal/controller/ssm/maintenancewindowtarget/zz_controller.go +++ b/internal/controller/ssm/maintenancewindowtarget/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MaintenanceWindowTarget_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_maintenance_window_target"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MaintenanceWindowTarget_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_maintenance_window_target"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MaintenanceWindowTarget_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MaintenanceWindowTarget + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MaintenanceWindowTarget{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MaintenanceWindowTarget") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MaintenanceWindowTarget_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/maintenancewindowtask/zz_controller.go b/internal/controller/ssm/maintenancewindowtask/zz_controller.go index 4320d4eb88..e3d8373dcb 100755 --- a/internal/controller/ssm/maintenancewindowtask/zz_controller.go +++ b/internal/controller/ssm/maintenancewindowtask/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MaintenanceWindowTask_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_maintenance_window_task"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MaintenanceWindowTask_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_maintenance_window_task"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MaintenanceWindowTask_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.MaintenanceWindowTask + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.MaintenanceWindowTask{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.MaintenanceWindowTask") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.MaintenanceWindowTask_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/parameter/zz_controller.go b/internal/controller/ssm/parameter/zz_controller.go index b53beb9e27..fe06f26109 100755 --- a/internal/controller/ssm/parameter/zz_controller.go +++ b/internal/controller/ssm/parameter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Parameter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_parameter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Parameter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_parameter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Parameter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Parameter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Parameter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Parameter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Parameter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/patchbaseline/zz_controller.go b/internal/controller/ssm/patchbaseline/zz_controller.go index dbe37beb70..5e4b7bedcd 100755 --- a/internal/controller/ssm/patchbaseline/zz_controller.go +++ b/internal/controller/ssm/patchbaseline/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PatchBaseline_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_patch_baseline"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PatchBaseline_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_patch_baseline"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PatchBaseline_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PatchBaseline + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PatchBaseline{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PatchBaseline") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PatchBaseline_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/patchgroup/zz_controller.go b/internal/controller/ssm/patchgroup/zz_controller.go index 61128895e3..f145822926 100755 --- a/internal/controller/ssm/patchgroup/zz_controller.go +++ b/internal/controller/ssm/patchgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PatchGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_patch_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PatchGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_patch_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PatchGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PatchGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PatchGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PatchGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PatchGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/resourcedatasync/zz_controller.go b/internal/controller/ssm/resourcedatasync/zz_controller.go index 628924980c..34af4d3a0d 100755 --- a/internal/controller/ssm/resourcedatasync/zz_controller.go +++ b/internal/controller/ssm/resourcedatasync/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourceDataSync_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_resource_data_sync"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceDataSync_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_resource_data_sync"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourceDataSync_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ResourceDataSync + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ResourceDataSync{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ResourceDataSync") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ResourceDataSync_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssm/servicesetting/zz_controller.go b/internal/controller/ssm/servicesetting/zz_controller.go index 350dbec391..d82d8dc9f5 100755 --- a/internal/controller/ssm/servicesetting/zz_controller.go +++ b/internal/controller/ssm/servicesetting/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssm/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceSetting_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_service_setting"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceSetting_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssm_service_setting"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceSetting_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ServiceSetting + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ServiceSetting{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ServiceSetting") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ServiceSetting_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssoadmin/accountassignment/zz_controller.go b/internal/controller/ssoadmin/accountassignment/zz_controller.go index cebfab9f47..9a2c781d6b 100755 --- a/internal/controller/ssoadmin/accountassignment/zz_controller.go +++ b/internal/controller/ssoadmin/accountassignment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssoadmin/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccountAssignment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_account_assignment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccountAssignment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_account_assignment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccountAssignment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.AccountAssignment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.AccountAssignment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.AccountAssignment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.AccountAssignment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssoadmin/customermanagedpolicyattachment/zz_controller.go b/internal/controller/ssoadmin/customermanagedpolicyattachment/zz_controller.go index f3ed31a01a..4b7d71c039 100755 --- a/internal/controller/ssoadmin/customermanagedpolicyattachment/zz_controller.go +++ b/internal/controller/ssoadmin/customermanagedpolicyattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssoadmin/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CustomerManagedPolicyAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_customer_managed_policy_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomerManagedPolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_customer_managed_policy_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomerManagedPolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.CustomerManagedPolicyAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.CustomerManagedPolicyAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.CustomerManagedPolicyAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.CustomerManagedPolicyAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssoadmin/instanceaccesscontrolattributes/zz_controller.go b/internal/controller/ssoadmin/instanceaccesscontrolattributes/zz_controller.go index adbdc3f699..906a922247 100755 --- a/internal/controller/ssoadmin/instanceaccesscontrolattributes/zz_controller.go +++ b/internal/controller/ssoadmin/instanceaccesscontrolattributes/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssoadmin/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceAccessControlAttributes_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_instance_access_control_attributes"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceAccessControlAttributes_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_instance_access_control_attributes"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceAccessControlAttributes_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.InstanceAccessControlAttributes + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.InstanceAccessControlAttributes{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.InstanceAccessControlAttributes") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.InstanceAccessControlAttributes_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssoadmin/managedpolicyattachment/zz_controller.go b/internal/controller/ssoadmin/managedpolicyattachment/zz_controller.go index 3310726c44..98ecee3f1f 100755 --- a/internal/controller/ssoadmin/managedpolicyattachment/zz_controller.go +++ b/internal/controller/ssoadmin/managedpolicyattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssoadmin/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ManagedPolicyAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_managed_policy_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ManagedPolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_managed_policy_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ManagedPolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ManagedPolicyAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ManagedPolicyAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ManagedPolicyAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ManagedPolicyAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssoadmin/permissionsboundaryattachment/zz_controller.go b/internal/controller/ssoadmin/permissionsboundaryattachment/zz_controller.go index e5cd2bcf2f..0bc5aad6ec 100755 --- a/internal/controller/ssoadmin/permissionsboundaryattachment/zz_controller.go +++ b/internal/controller/ssoadmin/permissionsboundaryattachment/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssoadmin/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PermissionsBoundaryAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_permissions_boundary_attachment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PermissionsBoundaryAttachment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_permissions_boundary_attachment"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PermissionsBoundaryAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PermissionsBoundaryAttachment + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PermissionsBoundaryAttachment{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PermissionsBoundaryAttachment") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PermissionsBoundaryAttachment_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssoadmin/permissionset/zz_controller.go b/internal/controller/ssoadmin/permissionset/zz_controller.go index 710813e463..d7f4c66c90 100755 --- a/internal/controller/ssoadmin/permissionset/zz_controller.go +++ b/internal/controller/ssoadmin/permissionset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssoadmin/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PermissionSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_permission_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PermissionSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_permission_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PermissionSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PermissionSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PermissionSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PermissionSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PermissionSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/ssoadmin/permissionsetinlinepolicy/zz_controller.go b/internal/controller/ssoadmin/permissionsetinlinepolicy/zz_controller.go index 141a5a9c28..ac94ccf81b 100755 --- a/internal/controller/ssoadmin/permissionsetinlinepolicy/zz_controller.go +++ b/internal/controller/ssoadmin/permissionsetinlinepolicy/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/ssoadmin/v1beta1" @@ -40,15 +41,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PermissionSetInlinePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_permission_set_inline_policy"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PermissionSetInlinePolicy_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_ssoadmin_permission_set_inline_policy"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PermissionSetInlinePolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -60,6 +61,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.PermissionSetInlinePolicy + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.PermissionSetInlinePolicy{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.PermissionSetInlinePolicy") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.PermissionSetInlinePolicy_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/swf/domain/zz_controller.go b/internal/controller/swf/domain/zz_controller.go index bfa7337aa4..1a7354dbfa 100755 --- a/internal/controller/swf/domain/zz_controller.go +++ b/internal/controller/swf/domain/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/swf/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_swf_domain"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_swf_domain"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Domain + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Domain{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Domain") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/timestreamwrite/database/zz_controller.go b/internal/controller/timestreamwrite/database/zz_controller.go index 2d58246883..302f8ba213 100755 --- a/internal/controller/timestreamwrite/database/zz_controller.go +++ b/internal/controller/timestreamwrite/database/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/timestreamwrite/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_timestreamwrite_database"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Database_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_timestreamwrite_database"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Database_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Database + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Database{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Database") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/timestreamwrite/table/zz_controller.go b/internal/controller/timestreamwrite/table/zz_controller.go index f8cdbf05bc..990953c729 100755 --- a/internal/controller/timestreamwrite/table/zz_controller.go +++ b/internal/controller/timestreamwrite/table/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/timestreamwrite/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Table_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_timestreamwrite_table"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Table_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_timestreamwrite_table"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Table_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Table + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Table{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Table") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Table_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/transcribe/languagemodel/zz_controller.go b/internal/controller/transcribe/languagemodel/zz_controller.go index b754d33837..306b734b14 100755 --- a/internal/controller/transcribe/languagemodel/zz_controller.go +++ b/internal/controller/transcribe/languagemodel/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/transcribe/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LanguageModel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transcribe_language_model"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LanguageModel_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transcribe_language_model"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LanguageModel_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.LanguageModel + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.LanguageModel{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.LanguageModel") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.LanguageModel_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/transcribe/vocabulary/zz_controller.go b/internal/controller/transcribe/vocabulary/zz_controller.go index 916d0b4131..f524455a16 100755 --- a/internal/controller/transcribe/vocabulary/zz_controller.go +++ b/internal/controller/transcribe/vocabulary/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/transcribe/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Vocabulary_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transcribe_vocabulary"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Vocabulary_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transcribe_vocabulary"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Vocabulary_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Vocabulary + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Vocabulary{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Vocabulary") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Vocabulary_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/transcribe/vocabularyfilter/zz_controller.go b/internal/controller/transcribe/vocabularyfilter/zz_controller.go index b26535525d..40090cfccf 100755 --- a/internal/controller/transcribe/vocabularyfilter/zz_controller.go +++ b/internal/controller/transcribe/vocabularyfilter/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/transcribe/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VocabularyFilter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transcribe_vocabulary_filter"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VocabularyFilter_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transcribe_vocabulary_filter"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VocabularyFilter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.VocabularyFilter + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.VocabularyFilter{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.VocabularyFilter") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.VocabularyFilter_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/transfer/server/zz_controller.go b/internal/controller/transfer/server/zz_controller.go index 8676aeaeff..f0701a77e4 100755 --- a/internal/controller/transfer/server/zz_controller.go +++ b/internal/controller/transfer/server/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/transfer/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Server_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transfer_server"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Server_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transfer_server"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Server_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Server + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Server{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Server") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Server_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/transfer/sshkey/zz_controller.go b/internal/controller/transfer/sshkey/zz_controller.go index 13f7ba9766..901d84e380 100755 --- a/internal/controller/transfer/sshkey/zz_controller.go +++ b/internal/controller/transfer/sshkey/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/transfer/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SSHKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transfer_ssh_key"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SSHKey_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transfer_ssh_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SSHKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SSHKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SSHKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SSHKey") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SSHKey_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/transfer/tag/zz_controller.go b/internal/controller/transfer/tag/zz_controller.go index 0813bc2af3..35b7322771 100755 --- a/internal/controller/transfer/tag/zz_controller.go +++ b/internal/controller/transfer/tag/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/transfer/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Tag_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transfer_tag"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Tag_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transfer_tag"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Tag_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Tag + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Tag{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Tag") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Tag_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/transfer/user/zz_controller.go b/internal/controller/transfer/user/zz_controller.go index e641ede579..f24764afda 100755 --- a/internal/controller/transfer/user/zz_controller.go +++ b/internal/controller/transfer/user/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/transfer/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transfer_user"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transfer_user"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.User + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.User{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.User") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/transfer/workflow/zz_controller.go b/internal/controller/transfer/workflow/zz_controller.go index 0cf5c5b228..0566fc4aa4 100755 --- a/internal/controller/transfer/workflow/zz_controller.go +++ b/internal/controller/transfer/workflow/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/transfer/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Workflow_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transfer_workflow"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workflow_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_transfer_workflow"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workflow_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Workflow + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Workflow{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Workflow") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Workflow_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/vpc/networkperformancemetricsubscription/zz_controller.go b/internal/controller/vpc/networkperformancemetricsubscription/zz_controller.go index 2196108fbc..2af7f5c4f3 100755 --- a/internal/controller/vpc/networkperformancemetricsubscription/zz_controller.go +++ b/internal/controller/vpc/networkperformancemetricsubscription/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/vpc/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkPerformanceMetricSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_network_performance_metric_subscription"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkPerformanceMetricSubscription_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_vpc_network_performance_metric_subscription"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkPerformanceMetricSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.NetworkPerformanceMetricSubscription + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.NetworkPerformanceMetricSubscription{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.NetworkPerformanceMetricSubscription") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.NetworkPerformanceMetricSubscription_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/waf/bytematchset/zz_controller.go b/internal/controller/waf/bytematchset/zz_controller.go index 3b7bbea871..90082ec9cf 100755 --- a/internal/controller/waf/bytematchset/zz_controller.go +++ b/internal/controller/waf/bytematchset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/waf/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ByteMatchSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_byte_match_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ByteMatchSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_byte_match_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ByteMatchSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ByteMatchSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ByteMatchSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ByteMatchSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ByteMatchSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/waf/geomatchset/zz_controller.go b/internal/controller/waf/geomatchset/zz_controller.go index 2a19cf33e1..ae9ef7acef 100755 --- a/internal/controller/waf/geomatchset/zz_controller.go +++ b/internal/controller/waf/geomatchset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/waf/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GeoMatchSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_geo_match_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GeoMatchSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_geo_match_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GeoMatchSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GeoMatchSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GeoMatchSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GeoMatchSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GeoMatchSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/waf/ipset/zz_controller.go b/internal/controller/waf/ipset/zz_controller.go index cc03010f06..6c36296e3b 100755 --- a/internal/controller/waf/ipset/zz_controller.go +++ b/internal/controller/waf/ipset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/waf/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IPSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_ipset"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IPSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_ipset"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IPSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.IPSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.IPSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.IPSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IPSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/waf/ratebasedrule/zz_controller.go b/internal/controller/waf/ratebasedrule/zz_controller.go index cad9185cf5..8b80fcec22 100755 --- a/internal/controller/waf/ratebasedrule/zz_controller.go +++ b/internal/controller/waf/ratebasedrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/waf/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RateBasedRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_rate_based_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RateBasedRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_rate_based_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RateBasedRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RateBasedRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RateBasedRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RateBasedRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RateBasedRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/waf/regexmatchset/zz_controller.go b/internal/controller/waf/regexmatchset/zz_controller.go index f6cbfff99d..dca596ae51 100755 --- a/internal/controller/waf/regexmatchset/zz_controller.go +++ b/internal/controller/waf/regexmatchset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/waf/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegexMatchSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_regex_match_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegexMatchSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_regex_match_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegexMatchSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RegexMatchSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RegexMatchSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RegexMatchSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RegexMatchSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/waf/regexpatternset/zz_controller.go b/internal/controller/waf/regexpatternset/zz_controller.go index c13fd76de6..716a034911 100755 --- a/internal/controller/waf/regexpatternset/zz_controller.go +++ b/internal/controller/waf/regexpatternset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/waf/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegexPatternSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_regex_pattern_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegexPatternSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_regex_pattern_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegexPatternSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RegexPatternSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RegexPatternSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RegexPatternSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RegexPatternSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/waf/rule/zz_controller.go b/internal/controller/waf/rule/zz_controller.go index 487ccbd694..55144aae35 100755 --- a/internal/controller/waf/rule/zz_controller.go +++ b/internal/controller/waf/rule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/waf/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Rule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Rule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Rule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Rule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Rule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Rule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Rule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/waf/sizeconstraintset/zz_controller.go b/internal/controller/waf/sizeconstraintset/zz_controller.go index 45c6929e82..de9f2f388a 100755 --- a/internal/controller/waf/sizeconstraintset/zz_controller.go +++ b/internal/controller/waf/sizeconstraintset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/waf/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SizeConstraintSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_size_constraint_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SizeConstraintSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_size_constraint_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SizeConstraintSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SizeConstraintSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SizeConstraintSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SizeConstraintSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SizeConstraintSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/waf/sqlinjectionmatchset/zz_controller.go b/internal/controller/waf/sqlinjectionmatchset/zz_controller.go index b5c71efd0f..528d040e17 100755 --- a/internal/controller/waf/sqlinjectionmatchset/zz_controller.go +++ b/internal/controller/waf/sqlinjectionmatchset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/waf/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SQLInjectionMatchSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_sql_injection_match_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SQLInjectionMatchSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_sql_injection_match_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SQLInjectionMatchSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SQLInjectionMatchSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SQLInjectionMatchSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SQLInjectionMatchSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLInjectionMatchSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/waf/webacl/zz_controller.go b/internal/controller/waf/webacl/zz_controller.go index f3de8bb1a6..863752a5c8 100755 --- a/internal/controller/waf/webacl/zz_controller.go +++ b/internal/controller/waf/webacl/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/waf/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WebACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_web_acl"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WebACL_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_web_acl"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WebACL_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.WebACL + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.WebACL{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.WebACL") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.WebACL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/waf/xssmatchset/zz_controller.go b/internal/controller/waf/xssmatchset/zz_controller.go index 82935dc23b..c066358854 100755 --- a/internal/controller/waf/xssmatchset/zz_controller.go +++ b/internal/controller/waf/xssmatchset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/waf/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.XSSMatchSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_xss_match_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.XSSMatchSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_waf_xss_match_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.XSSMatchSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.XSSMatchSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.XSSMatchSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.XSSMatchSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.XSSMatchSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafregional/bytematchset/zz_controller.go b/internal/controller/wafregional/bytematchset/zz_controller.go index a23656874c..cfe17aa54d 100755 --- a/internal/controller/wafregional/bytematchset/zz_controller.go +++ b/internal/controller/wafregional/bytematchset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafregional/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ByteMatchSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_byte_match_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ByteMatchSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_byte_match_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ByteMatchSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.ByteMatchSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ByteMatchSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ByteMatchSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ByteMatchSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafregional/geomatchset/zz_controller.go b/internal/controller/wafregional/geomatchset/zz_controller.go index 5e4701dbcb..5f74ca6b95 100755 --- a/internal/controller/wafregional/geomatchset/zz_controller.go +++ b/internal/controller/wafregional/geomatchset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafregional/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GeoMatchSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_geo_match_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GeoMatchSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_geo_match_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GeoMatchSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.GeoMatchSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.GeoMatchSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.GeoMatchSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.GeoMatchSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafregional/ipset/zz_controller.go b/internal/controller/wafregional/ipset/zz_controller.go index 0afee20d57..01ad9904aa 100755 --- a/internal/controller/wafregional/ipset/zz_controller.go +++ b/internal/controller/wafregional/ipset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafregional/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IPSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_ipset"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IPSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_ipset"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IPSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.IPSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.IPSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.IPSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IPSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafregional/ratebasedrule/zz_controller.go b/internal/controller/wafregional/ratebasedrule/zz_controller.go index 2dd893c6e2..958accc4e3 100755 --- a/internal/controller/wafregional/ratebasedrule/zz_controller.go +++ b/internal/controller/wafregional/ratebasedrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafregional/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RateBasedRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_rate_based_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RateBasedRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_rate_based_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RateBasedRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RateBasedRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RateBasedRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RateBasedRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RateBasedRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafregional/regexmatchset/zz_controller.go b/internal/controller/wafregional/regexmatchset/zz_controller.go index e534b14924..d065348e45 100755 --- a/internal/controller/wafregional/regexmatchset/zz_controller.go +++ b/internal/controller/wafregional/regexmatchset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafregional/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegexMatchSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_regex_match_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegexMatchSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_regex_match_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegexMatchSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RegexMatchSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RegexMatchSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RegexMatchSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RegexMatchSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafregional/regexpatternset/zz_controller.go b/internal/controller/wafregional/regexpatternset/zz_controller.go index 1e850b9bb5..e89f5989f5 100755 --- a/internal/controller/wafregional/regexpatternset/zz_controller.go +++ b/internal/controller/wafregional/regexpatternset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafregional/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegexPatternSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_regex_pattern_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegexPatternSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_regex_pattern_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegexPatternSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RegexPatternSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RegexPatternSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RegexPatternSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RegexPatternSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafregional/rule/zz_controller.go b/internal/controller/wafregional/rule/zz_controller.go index cc3d1f3c94..d6fedac6bf 100755 --- a/internal/controller/wafregional/rule/zz_controller.go +++ b/internal/controller/wafregional/rule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafregional/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Rule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Rule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Rule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Rule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Rule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Rule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Rule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafregional/sizeconstraintset/zz_controller.go b/internal/controller/wafregional/sizeconstraintset/zz_controller.go index 19cc12ce5d..a498431a4a 100755 --- a/internal/controller/wafregional/sizeconstraintset/zz_controller.go +++ b/internal/controller/wafregional/sizeconstraintset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafregional/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SizeConstraintSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_size_constraint_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SizeConstraintSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_size_constraint_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SizeConstraintSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SizeConstraintSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SizeConstraintSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SizeConstraintSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SizeConstraintSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafregional/sqlinjectionmatchset/zz_controller.go b/internal/controller/wafregional/sqlinjectionmatchset/zz_controller.go index 27b1f5d1b1..d20046de25 100755 --- a/internal/controller/wafregional/sqlinjectionmatchset/zz_controller.go +++ b/internal/controller/wafregional/sqlinjectionmatchset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafregional/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SQLInjectionMatchSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_sql_injection_match_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SQLInjectionMatchSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_sql_injection_match_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SQLInjectionMatchSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SQLInjectionMatchSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SQLInjectionMatchSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SQLInjectionMatchSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SQLInjectionMatchSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafregional/webacl/zz_controller.go b/internal/controller/wafregional/webacl/zz_controller.go index 4084bee445..e229d0c14d 100755 --- a/internal/controller/wafregional/webacl/zz_controller.go +++ b/internal/controller/wafregional/webacl/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafregional/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WebACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_web_acl"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WebACL_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_web_acl"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WebACL_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.WebACL + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.WebACL{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.WebACL") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.WebACL_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafregional/xssmatchset/zz_controller.go b/internal/controller/wafregional/xssmatchset/zz_controller.go index d14924af24..39dadee290 100755 --- a/internal/controller/wafregional/xssmatchset/zz_controller.go +++ b/internal/controller/wafregional/xssmatchset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafregional/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.XSSMatchSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_xss_match_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.XSSMatchSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafregional_xss_match_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.XSSMatchSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.XSSMatchSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.XSSMatchSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.XSSMatchSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.XSSMatchSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafv2/ipset/zz_controller.go b/internal/controller/wafv2/ipset/zz_controller.go index 5666c2e6b9..80bfefbdf6 100755 --- a/internal/controller/wafv2/ipset/zz_controller.go +++ b/internal/controller/wafv2/ipset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafv2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IPSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafv2_ip_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IPSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafv2_ip_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IPSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.IPSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.IPSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.IPSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IPSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/wafv2/regexpatternset/zz_controller.go b/internal/controller/wafv2/regexpatternset/zz_controller.go index 702a4b1d81..3df5c0c00a 100755 --- a/internal/controller/wafv2/regexpatternset/zz_controller.go +++ b/internal/controller/wafv2/regexpatternset/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/wafv2/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegexPatternSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafv2_regex_pattern_set"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegexPatternSet_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_wafv2_regex_pattern_set"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegexPatternSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.RegexPatternSet + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.RegexPatternSet{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.RegexPatternSet") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.RegexPatternSet_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/workspaces/directory/zz_controller.go b/internal/controller/workspaces/directory/zz_controller.go index 7ee5a68123..92b7d17716 100755 --- a/internal/controller/workspaces/directory/zz_controller.go +++ b/internal/controller/workspaces/directory/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/workspaces/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Directory_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_workspaces_directory"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Directory_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_workspaces_directory"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Directory_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Directory + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Directory{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Directory") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Directory_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/workspaces/ipgroup/zz_controller.go b/internal/controller/workspaces/ipgroup/zz_controller.go index 260589574f..3601e56e0e 100755 --- a/internal/controller/workspaces/ipgroup/zz_controller.go +++ b/internal/controller/workspaces/ipgroup/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/workspaces/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IPGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_workspaces_ip_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IPGroup_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_workspaces_ip_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IPGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.IPGroup + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.IPGroup{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.IPGroup") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.IPGroup_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/xray/encryptionconfig/zz_controller.go b/internal/controller/xray/encryptionconfig/zz_controller.go index eba3a5cf77..9c1dd01121 100755 --- a/internal/controller/xray/encryptionconfig/zz_controller.go +++ b/internal/controller/xray/encryptionconfig/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/xray/v1beta1" @@ -39,15 +40,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EncryptionConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_xray_encryption_config"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EncryptionConfig_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_xray_encryption_config"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EncryptionConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -59,6 +60,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.EncryptionConfig + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.EncryptionConfig{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.EncryptionConfig") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.EncryptionConfig_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/xray/group/zz_controller.go b/internal/controller/xray/group/zz_controller.go index 4b7fb0d82d..620d3715c2 100755 --- a/internal/controller/xray/group/zz_controller.go +++ b/internal/controller/xray/group/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/xray/v1beta1" @@ -42,15 +43,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_xray_group"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_xray_group"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -62,6 +63,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.Group + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.Group{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.Group") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). diff --git a/internal/controller/xray/samplingrule/zz_controller.go b/internal/controller/xray/samplingrule/zz_controller.go index 5ac3d0a92c..e947e66f3f 100755 --- a/internal/controller/xray/samplingrule/zz_controller.go +++ b/internal/controller/xray/samplingrule/zz_controller.go @@ -21,6 +21,7 @@ import ( tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/xray/v1beta1" @@ -43,15 +44,15 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SamplingRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_xray_sampling_rule"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SamplingRule_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_xray_sampling_rule"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SamplingRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), @@ -63,6 +64,17 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableBetaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } + + // register webhooks for the kind v1beta1.SamplingRule + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.SamplingRule{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.SamplingRule") + } + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.SamplingRule_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr).